mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
getSigners via EVM at API call
This commit is contained in:
parent
702a8ed560
commit
914ea2892e
2 changed files with 9 additions and 7 deletions
|
|
@ -203,7 +203,7 @@ func GetSignersFromContract(state *state.StateDB, block *types.Block) ([]common.
|
|||
}
|
||||
|
||||
// Get signers signed for blockNumber from blockSigner contract.
|
||||
func GetSignersFromContract1(addrBlockSigner common.Address, client bind.ContractBackend, blockHash common.Hash) ([]common.Address, error) {
|
||||
func GetSignersByExecutingEVM(addrBlockSigner common.Address, client bind.ContractBackend, blockHash common.Hash) ([]common.Address, error) {
|
||||
blockSigner, err := contract.NewBlockSigner(addrBlockSigner, client)
|
||||
if err != nil {
|
||||
log.Error("Fail get instance of blockSigner", "error", err)
|
||||
|
|
|
|||
|
|
@ -855,17 +855,19 @@ func (s *PublicBlockChainAPI) rpcOutputBlock(b *types.Block, inclTx bool, fullTx
|
|||
}
|
||||
fields["uncles"] = uncleHashes
|
||||
|
||||
// Get signers for block.
|
||||
client, err := s.b.GetIPCClient()
|
||||
if err != nil {
|
||||
log.Error("Fail to connect IPC client for block status", "error", err)
|
||||
}
|
||||
|
||||
var signers []common.Address
|
||||
var filterSigners []common.Address
|
||||
finality := int32(0)
|
||||
if b.Number().Int64() > 0 {
|
||||
engine := s.b.GetEngine()
|
||||
blockNr := rpc.BlockNumber(b.Number().Int64())
|
||||
state, _, err := s.b.StateAndHeaderByNumber(ctx, blockNr)
|
||||
if state == nil || err != nil {
|
||||
return nil, err
|
||||
}
|
||||
signers, err = contracts.GetSignersFromContract(state, b)
|
||||
addrBlockSigner := common.HexToAddress(common.BlockSigners)
|
||||
signers, err = contracts.GetSignersByExecutingEVM(addrBlockSigner, client, b.Hash())
|
||||
if err != nil {
|
||||
log.Error("Fail to get signers from block signer SC.", "error", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue