mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-22 14:44:30 +00:00
change devnet switch block for large scale test (#205)
* change switch block * use mainnet masternode * update mining and timeout time * add timer on round number * remove bug code
This commit is contained in:
parent
fb7234c93f
commit
f9c0c40515
3 changed files with 22 additions and 7 deletions
|
|
@ -60,6 +60,8 @@ type XDPoS_v2 struct {
|
|||
HookPenalty func(chain consensus.ChainReader, number *big.Int, parentHash common.Hash, candidates []common.Address) ([]common.Address, error)
|
||||
|
||||
ForensicsProcessor *Forensics
|
||||
|
||||
votePoolCollectionTime time.Time
|
||||
}
|
||||
|
||||
func New(config *params.XDPoSConfig, db ethdb.Database, waitPeriodCh chan int) *XDPoS_v2 {
|
||||
|
|
@ -756,6 +758,7 @@ func (x *XDPoS_v2) verifyQC(blockChainReader consensus.ChainReader, quorumCert *
|
|||
log.Warn("[verifyHeader] Invalid QC Signature is nil or empty", "QC", quorumCert, "QCNumber", quorumCert.ProposedBlockInfo.Number, "Signatures len", len(signatures))
|
||||
return utils.ErrInvalidQC
|
||||
}
|
||||
start := time.Now()
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(signatures))
|
||||
|
|
@ -781,6 +784,8 @@ func (x *XDPoS_v2) verifyQC(blockChainReader consensus.ChainReader, quorumCert *
|
|||
}(signature)
|
||||
}
|
||||
wg.Wait()
|
||||
elapsed := time.Since(start)
|
||||
log.Info("[verifyQC] time verify message signatures of qc", "elapsed", elapsed)
|
||||
if haveError != nil {
|
||||
return haveError
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/XinFinOrg/XDPoSChain/common"
|
||||
"github.com/XinFinOrg/XDPoSChain/consensus"
|
||||
|
|
@ -54,7 +55,6 @@ func (x *XDPoS_v2) sendVote(chainReader consensus.ChainReader, blockInfo *types.
|
|||
}
|
||||
|
||||
func (x *XDPoS_v2) voteHandler(chain consensus.ChainReader, voteMsg *types.Vote) error {
|
||||
|
||||
// checkRoundNumber
|
||||
if (voteMsg.ProposedBlockInfo.Round != x.currentRound) && (voteMsg.ProposedBlockInfo.Round != x.currentRound+1) {
|
||||
return &utils.ErrIncomingMessageRoundTooFarFromCurrentRound{
|
||||
|
|
@ -64,6 +64,11 @@ func (x *XDPoS_v2) voteHandler(chain consensus.ChainReader, voteMsg *types.Vote)
|
|||
}
|
||||
}
|
||||
|
||||
if x.votePoolCollectionTime.IsZero() {
|
||||
log.Info("[voteHandler] set vote pool time", "round", x.currentRound)
|
||||
x.votePoolCollectionTime = time.Now()
|
||||
}
|
||||
|
||||
// Collect vote
|
||||
thresholdReached, numberOfVotesInPool, pooledVotes := x.votePool.Add(voteMsg)
|
||||
log.Debug("[voteHandler] collect votes", "number", numberOfVotesInPool)
|
||||
|
|
@ -87,6 +92,9 @@ func (x *XDPoS_v2) voteHandler(chain consensus.ChainReader, voteMsg *types.Vote)
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
elapsed := time.Since(x.votePoolCollectionTime)
|
||||
log.Info("[voteHandler] time cost from receive first vote under QC create", "elapsed", elapsed)
|
||||
x.votePoolCollectionTime = time.Time{}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
@ -99,7 +107,7 @@ func (x *XDPoS_v2) voteHandler(chain consensus.ChainReader, voteMsg *types.Vote)
|
|||
func (x *XDPoS_v2) onVotePoolThresholdReached(chain consensus.ChainReader, pooledVotes map[common.Hash]utils.PoolObj, currentVoteMsg utils.PoolObj, proposedBlockHeader *types.Header) error {
|
||||
|
||||
masternodes := x.GetMasternodes(chain, proposedBlockHeader)
|
||||
|
||||
start := time.Now()
|
||||
// Filter out non-Master nodes signatures
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(pooledVotes))
|
||||
|
|
@ -121,6 +129,8 @@ func (x *XDPoS_v2) onVotePoolThresholdReached(chain consensus.ChainReader, poole
|
|||
counter++
|
||||
}
|
||||
wg.Wait()
|
||||
elapsed := time.Since(start)
|
||||
log.Info("[onVotePoolThresholdReached] verify message signatures of vote pool took", "elapsed", elapsed)
|
||||
|
||||
// The signature list may contain empty entey. we only care the ones with values
|
||||
var validSignatureSlice []types.Signature
|
||||
|
|
|
|||
|
|
@ -54,12 +54,12 @@ var (
|
|||
SkipV2Validation: true,
|
||||
}
|
||||
DevnetXDPoSV2Config = &V2{
|
||||
SwitchBlock: big.NewInt(7060500),
|
||||
CertThreshold: 4,
|
||||
SwitchBlock: big.NewInt(7074000),
|
||||
CertThreshold: common.MaxMasternodesV2*2/3 + 1,
|
||||
TimeoutSyncThreshold: 5,
|
||||
TimeoutPeriod: 10,
|
||||
WaitPeriod: 5,
|
||||
MinePeriod: 5,
|
||||
TimeoutPeriod: 25,
|
||||
WaitPeriod: 10,
|
||||
MinePeriod: 10,
|
||||
}
|
||||
|
||||
// XDPoSChain mainnet config
|
||||
|
|
|
|||
Loading…
Reference in a new issue