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-03 04:28:48 +0800
commit0b4fe8d1929ad64ed576f7560dde4179d71ecfcb (patch)
tree923d7b795c59ddb0e5d338f2b2e6536e00a58c88 /core/blockchain.go
parente14f8a408c17fd6c57d769cd4635ad6cc8bde769 (diff)
downloadgo-tangerine-0b4fe8d1929ad64ed576f7560dde4179d71ecfcb.tar
go-tangerine-0b4fe8d1929ad64ed576f7560dde4179d71ecfcb.tar.gz
go-tangerine-0b4fe8d1929ad64ed576f7560dde4179d71ecfcb.tar.bz2
go-tangerine-0b4fe8d1929ad64ed576f7560dde4179d71ecfcb.tar.lz
go-tangerine-0b4fe8d1929ad64ed576f7560dde4179d71ecfcb.tar.xz
go-tangerine-0b4fe8d1929ad64ed576f7560dde4179d71ecfcb.tar.zst
go-tangerine-0b4fe8d1929ad64ed576f7560dde4179d71ecfcb.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 dd3edeb45..20ab71b4d 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -288,9 +288,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
}
@@ -904,7 +904,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 {
@@ -1074,8 +1074,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)