aboutsummaryrefslogtreecommitdiffstats
path: root/core/blockchain.go
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2019-04-03 04:28:48 +0800
committerPéter Szilágyi <peterke@gmail.com>2019-04-08 17:00:42 +0800
commitaf401d03a395c21fdb297edb687edf8af3470cb2 (patch)
treed2ee3476c9005ffe1aca7abbe7152765da0efe32 /core/blockchain.go
parent80a2a35bc3aaf208b5f91a1fb1d803975d4bb01c (diff)
downloaddexon-af401d03a395c21fdb297edb687edf8af3470cb2.tar
dexon-af401d03a395c21fdb297edb687edf8af3470cb2.tar.gz
dexon-af401d03a395c21fdb297edb687edf8af3470cb2.tar.bz2
dexon-af401d03a395c21fdb297edb687edf8af3470cb2.tar.lz
dexon-af401d03a395c21fdb297edb687edf8af3470cb2.tar.xz
dexon-af401d03a395c21fdb297edb687edf8af3470cb2.tar.zst
dexon-af401d03a395c21fdb297edb687edf8af3470cb2.zip
all: simplify timestamps to uint64 (#19372)
* all: simplify timestamps to uint64 * tests: update definitions * clef, faucet, mobile: leftover uint64 fixups * ethash: fix tests * graphql: update schema for timestamp * ethash: remove unused variable
Diffstat (limited to 'core/blockchain.go')
-rw-r--r--core/blockchain.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/blockchain.go b/core/blockchain.go
index 0d2d71b4d..e40fc39fa 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -267,9 +267,9 @@ func (bc *BlockChain) loadLastState() error {
blockTd := bc.GetTd(currentBlock.Hash(), currentBlock.NumberU64())
fastTd := bc.GetTd(currentFastBlock.Hash(), currentFastBlock.NumberU64())
- log.Info("Loaded most recent local header", "number", currentHeader.Number, "hash", currentHeader.Hash(), "td", headerTd, "age", common.PrettyAge(time.Unix(currentHeader.Time.Int64(), 0)))
- log.Info("Loaded most recent local full block", "number", currentBlock.Number(), "hash", currentBlock.Hash(), "td", blockTd, "age", common.PrettyAge(time.Unix(currentBlock.Time().Int64(), 0)))
- log.Info("Loaded most recent local fast block", "number", currentFastBlock.Number(), "hash", currentFastBlock.Hash(), "td", fastTd, "age", common.PrettyAge(time.Unix(currentFastBlock.Time().Int64(), 0)))
+ log.Info("Loaded most recent local header", "number", currentHeader.Number, "hash", currentHeader.Hash(), "td", headerTd, "age", common.PrettyAge(time.Unix(int64(currentHeader.Time), 0)))
+ log.Info("Loaded most recent local full block", "number", currentBlock.Number(), "hash", currentBlock.Hash(), "td", blockTd, "age", common.PrettyAge(time.Unix(int64(currentBlock.Time()), 0)))
+ log.Info("Loaded most recent local fast block", "number", currentFastBlock.Number(), "hash", currentFastBlock.Hash(), "td", fastTd, "age", common.PrettyAge(time.Unix(int64(currentFastBlock.Time()), 0)))
return nil
}
@@ -894,7 +894,7 @@ func (bc *BlockChain) InsertReceiptChain(blockChain types.Blocks, receiptChain [
context := []interface{}{
"count", stats.processed, "elapsed", common.PrettyDuration(time.Since(start)),
- "number", head.Number(), "hash", head.Hash(), "age", common.PrettyAge(time.Unix(head.Time().Int64(), 0)),
+ "number", head.Number(), "hash", head.Hash(), "age", common.PrettyAge(time.Unix(int64(head.Time()), 0)),
"size", common.StorageSize(bytes),
}
if stats.ignored > 0 {
@@ -1058,8 +1058,8 @@ func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types.
// accepted for future processing, and returns an error if the block is too far
// ahead and was not added.
func (bc *BlockChain) addFutureBlock(block *types.Block) error {
- max := big.NewInt(time.Now().Unix() + maxTimeFutureBlocks)
- if block.Time().Cmp(max) > 0 {
+ max := uint64(time.Now().Unix() + maxTimeFutureBlocks)
+ if block.Time() > max {
return fmt.Errorf("future block timestamp %v > allowed %v", block.Time(), max)
}
bc.futureBlocks.Add(block.Hash(), block)