},
{
desc: "timestamp greater than max limit (blocktest#1006)",
- blockTime: 9999999999,
- parentTime: []uint64{1520000000},
+ blockTime: 99999999990000,
+ parentTime: []uint64{15200000000000},
err: errBadTimestamp,
},
{
desc: "timestamp of the block and the parent block are both greater than max limit (blocktest#1007)",
- blockTime: uint64(time.Now().Unix()) + consensus.MaxTimeOffsetSeconds + 2,
- parentTime: []uint64{uint64(time.Now().Unix()) + consensus.MaxTimeOffsetSeconds + 1},
+ blockTime: uint64(time.Now().UnixNano()/int64(time.Millisecond)) + consensus.MaxTimeOffsetMs + 2000,
+ parentTime: []uint64{uint64(time.Now().UnixNano()/int64(time.Millisecond)) + consensus.MaxTimeOffsetMs + 1000},
err: errBadTimestamp,
},
}
BlockHeader: &bc.BlockHeader{
Version: 1,
Height: 1,
- Timestamp: 1523352601,
+ Timestamp: 1523352601000,
PreviousBlockId: &bc.Hash{V0: 0},
},
},
parent: &state.BlockNode{
Version: 1,
Height: 0,
- Timestamp: 1523352600,
+ Timestamp: 1523352600000,
Hash: bc.Hash{V0: 0},
},
err: nil,
BlockHeader: &bc.BlockHeader{
Version: 1,
Height: 1,
- Timestamp: 1523352601,
+ Timestamp: 1523352601000,
PreviousBlockId: &bc.Hash{V0: 0},
TransactionsRoot: &bc.Hash{V0: 1},
},
parent: &state.BlockNode{
Version: 1,
Height: 0,
- Timestamp: 1523352600,
+ Timestamp: 1523352600000,
Hash: bc.Hash{V0: 0},
},
err: errMismatchedMerkleRoot,
BlockHeader: &bc.BlockHeader{
Version: 1,
Height: 1,
- Timestamp: 1523352601,
+ Timestamp: 1523352601000,
PreviousBlockId: &bc.Hash{V0: 0},
TransactionsRoot: &bc.Hash{V0: 6294987741126419124, V1: 12520373106916389157, V2: 5040806596198303681, V3: 1151748423853876189},
TransactionStatusHash: &bc.Hash{V0: 1},
parent: &state.BlockNode{
Version: 1,
Height: 0,
- Timestamp: 1523352600,
+ Timestamp: 1523352600000,
Hash: bc.Hash{V0: 0},
},
err: errMismatchedMerkleRoot,
BlockHeader: &bc.BlockHeader{
Version: 1,
Height: 1,
- Timestamp: 1523352601,
+ Timestamp: 1523352601000,
PreviousBlockId: &bc.Hash{V0: 0},
},
Transactions: []*bc.Tx{
parent: &state.BlockNode{
Version: 1,
Height: 0,
- Timestamp: 1523352600,
+ Timestamp: 1523352600000,
Hash: bc.Hash{V0: 0},
},
err: ErrWrongCoinbaseTransaction,
parent := &state.BlockNode{
Version: 1,
Height: 0,
- Timestamp: 1523352600,
+ Timestamp: 1523352600000,
Hash: bc.Hash{V0: 0},
}
block := &bc.Block{
BlockHeader: &bc.BlockHeader{
Version: 1,
Height: 1,
- Timestamp: 1523352601,
+ Timestamp: 1523352601000,
PreviousBlockId: &bc.Hash{V0: 0},
TransactionsRoot: &bc.Hash{V0: 1},
},
parent := &state.BlockNode{
Version: 1,
Height: 0,
- Timestamp: 1523352600,
+ Timestamp: 1523352600000,
Hash: bc.Hash{V0: 0},
}
block := &bc.Block{
BlockHeader: &bc.BlockHeader{
Version: 1,
Height: 1,
- Timestamp: 1523352601,
+ Timestamp: 1523352601000,
PreviousBlockId: &bc.Hash{V0: 0},
TransactionsRoot: &bc.Hash{V0: 10011341401654852692, V1: 8144266100226420640, V2: 18332298251154128538, V3: 7663092454615786384},
TransactionStatusHash: &bc.Hash{V0: 8682965660674182538, V1: 8424137560837623409, V2: 6979974817894224946, V3: 4673809519342015041},