diff options
Diffstat (limited to 'vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go')
-rw-r--r-- | vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go index 0f665f29a..0f4daa766 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go +++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go @@ -41,8 +41,6 @@ var ( "hash of block is incorrect") ErrIncorrectSignature = fmt.Errorf( "signature of block is incorrect") - ErrGenesisBlockNotEmpty = fmt.Errorf( - "genesis block should be empty") ErrUnknownBlockProposed = fmt.Errorf( "unknown block is proposed") ErrIncorrectAgreementResultPosition = fmt.Errorf( @@ -831,6 +829,16 @@ func (con *Consensus) initialRound( con.initialRound( startHeight+config.RoundLength, nextRound, nextConfig) }) + // Touch nodeSetCache for next round. + con.event.RegisterHeight(startHeight+config.RoundLength*9/10, func(uint64) { + go func() { + // TODO(jimmy): check DKGResetCount and do not touch if nextRound is reset. + if err := con.nodeSetCache.Touch(round + 1); err != nil { + con.logger.Warn("Failed to update nodeSetCache", + "round", round+1, "error", err) + } + }() + }) } // Stop the Consensus core. @@ -1242,8 +1250,5 @@ func (con *Consensus) proposeBlock(position types.Position) ( if err = con.signer.SignCRS(b, crs); err != nil { return nil, err } - if b.IsGenesis() && len(b.Payload) != 0 { - return nil, ErrGenesisBlockNotEmpty - } return b, nil } |