mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
Bug Fix: V2 getSigner API (#313)
This commit is contained in:
parent
9369f7b3fa
commit
938db0afcc
3 changed files with 10 additions and 1 deletions
|
|
@ -459,7 +459,7 @@ func (x *XDPoS) GetSnapshot(chain consensus.ChainReader, header *types.Header) (
|
|||
func (x *XDPoS) GetAuthorisedSignersFromSnapshot(chain consensus.ChainReader, header *types.Header) ([]common.Address, error) {
|
||||
switch x.config.BlockConsensusVersion(header.Number, header.Extra, ExtraFieldCheck) {
|
||||
case params.ConsensusEngineVersion2:
|
||||
return []common.Address{}, nil
|
||||
return x.EngineV2.GetSignersFromSnapshot(chain, header)
|
||||
default: // Default "v1"
|
||||
return x.EngineV1.GetAuthorisedSignersFromSnapshot(chain, header)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import (
|
|||
|
||||
"github.com/XinFinOrg/XDPoSChain/accounts"
|
||||
"github.com/XinFinOrg/XDPoSChain/common"
|
||||
"github.com/XinFinOrg/XDPoSChain/consensus"
|
||||
"github.com/XinFinOrg/XDPoSChain/consensus/XDPoS/utils"
|
||||
"github.com/XinFinOrg/XDPoSChain/core/types"
|
||||
"github.com/XinFinOrg/XDPoSChain/crypto"
|
||||
|
|
@ -157,3 +158,8 @@ func (x *XDPoS_v2) GetRoundNumber(header *types.Header) (types.Round, error) {
|
|||
return decodedExtraField.Round, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (x *XDPoS_v2) GetSignersFromSnapshot(chain consensus.ChainReader, header *types.Header) ([]common.Address, error) {
|
||||
snap, err := x.getSnapshot(chain, header.Number.Uint64(), false)
|
||||
return snap.NextEpochMasterNodes, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3035,6 +3035,9 @@ func GetSignersFromBlocks(b Backend, blockNumber uint64, blockHash common.Hash,
|
|||
return addrs, err
|
||||
}
|
||||
blockData, err := b.BlockByNumber(nil, rpc.BlockNumber(i))
|
||||
if err != nil {
|
||||
return addrs, err
|
||||
}
|
||||
signTxs := engine.CacheSigningTxs(header.Hash(), blockData.Transactions())
|
||||
for _, signtx := range signTxs {
|
||||
blkHash := common.BytesToHash(signtx.Data()[len(signtx.Data())-32:])
|
||||
|
|
|
|||
Loading…
Reference in a new issue