aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/dexon-foundation/dexon-consensus/core/blockchain.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/dexon-foundation/dexon-consensus/core/blockchain.go')
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/blockchain.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/blockchain.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/blockchain.go
index 1efd867e7..4fae221c7 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/blockchain.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/blockchain.go
@@ -21,6 +21,7 @@ import (
"bytes"
"errors"
"fmt"
+ "math"
"sort"
"sync"
"time"
@@ -49,6 +50,8 @@ var (
ErrMissingRandomness = errors.New("missing block randomness")
)
+const notReadyHeight uint64 = math.MaxUint64
+
type pendingBlockRecord struct {
position types.Position
block *types.Block
@@ -384,6 +387,10 @@ func (bc *blockChain) nextBlock() (uint64, time.Time) {
if tip == nil {
return types.GenesisHeight, bc.dMoment
}
+ if tip != bc.lastDelivered {
+ // If tip is not delivered, we should not proceed to next block.
+ return notReadyHeight, time.Time{}
+ }
return tip.Position.Height + 1, tip.Timestamp.Add(config.minBlockInterval)
}