Merge pull request #1711 from Gustav-Simonsson/timestamp_big_int

Add tests for uncle timestamps and refactor timestamp type
(cherry picked from commit abce09954b)
This commit is contained in:
Felix Lange
2015-08-25 15:49:36 +02:00
committed by Gustav Simonsson
parent dc3fb69dce
commit fd512fa12c
21 changed files with 380 additions and 43 deletions

View File

@ -365,8 +365,8 @@ func (s *BlockTest) validateBlockHeader(h *btHeader, h2 *types.Header) error {
return fmt.Errorf("GasUsed: expected: %v, decoded: %v", expectedGasUsed, h2.GasUsed)
}
expectedTimestamp := mustConvertUint(h.Timestamp, 16)
if expectedTimestamp != h2.Time {
expectedTimestamp := mustConvertBigInt(h.Timestamp, 16)
if expectedTimestamp.Cmp(h2.Time) != 0 {
return fmt.Errorf("Timestamp: expected: %v, decoded: %v", expectedTimestamp, h2.Time)
}
@ -461,7 +461,7 @@ func mustConvertHeader(in btHeader) *types.Header {
GasUsed: mustConvertBigInt(in.GasUsed, 16),
GasLimit: mustConvertBigInt(in.GasLimit, 16),
Difficulty: mustConvertBigInt(in.Difficulty, 16),
Time: mustConvertUint(in.Timestamp, 16),
Time: mustConvertBigInt(in.Timestamp, 16),
Nonce: types.EncodeNonce(mustConvertUint(in.Nonce, 16)),
}
return header