aboutsummaryrefslogtreecommitdiffstats
path: root/tests/block_test_util.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-06-16 18:41:50 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-06-30 00:51:47 +0800
commit1d42888d3047dabfb352c94a2051e7af14d2a509 (patch)
tree8ca68ca98bd697f26f2033a5480e78ccbf064162 /tests/block_test_util.go
parent654564e164b3b6f7f4ba1e8bbd6fcd64776068fa (diff)
downloaddexon-1d42888d3047dabfb352c94a2051e7af14d2a509.tar
dexon-1d42888d3047dabfb352c94a2051e7af14d2a509.tar.gz
dexon-1d42888d3047dabfb352c94a2051e7af14d2a509.tar.bz2
dexon-1d42888d3047dabfb352c94a2051e7af14d2a509.tar.lz
dexon-1d42888d3047dabfb352c94a2051e7af14d2a509.tar.xz
dexon-1d42888d3047dabfb352c94a2051e7af14d2a509.tar.zst
dexon-1d42888d3047dabfb352c94a2051e7af14d2a509.zip
core/types: make blocks immutable
Diffstat (limited to 'tests/block_test_util.go')
-rw-r--r--tests/block_test_util.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/block_test_util.go b/tests/block_test_util.go
index 5fdc6402e..450ef86a1 100644
--- a/tests/block_test_util.go
+++ b/tests/block_test_util.go
@@ -245,7 +245,7 @@ func (t *BlockTest) TryBlocksInsert(chainManager *core.ChainManager) error {
if b.BlockHeader == nil {
continue // OK - block is supposed to be invalid, continue with next block
} else {
- return fmt.Errorf("Block RLP decoding failed when expected to succeed: ", err)
+ return fmt.Errorf("Block RLP decoding failed when expected to succeed: %v", err)
}
}
// RLP decoding worked, try to insert into chain:
@@ -254,7 +254,7 @@ func (t *BlockTest) TryBlocksInsert(chainManager *core.ChainManager) error {
if b.BlockHeader == nil {
continue // OK - block is supposed to be invalid, continue with next block
} else {
- return fmt.Errorf("Block insertion into chain failed: ", err)
+ return fmt.Errorf("Block insertion into chain failed: %v", err)
}
}
if b.BlockHeader == nil {
@@ -262,7 +262,7 @@ func (t *BlockTest) TryBlocksInsert(chainManager *core.ChainManager) error {
}
err = t.validateBlockHeader(b.BlockHeader, cb.Header())
if err != nil {
- return fmt.Errorf("Block header validation failed: ", err)
+ return fmt.Errorf("Block header validation failed: %v", err)
}
}
return nil
@@ -286,7 +286,7 @@ func (s *BlockTest) validateBlockHeader(h *btHeader, h2 *types.Header) error {
expectedNonce := mustConvertBytes(h.Nonce)
if !bytes.Equal(expectedNonce, h2.Nonce[:]) {
- return fmt.Errorf("Nonce: expected: %v, decoded: %v", expectedNonce, h2.Nonce[:])
+ return fmt.Errorf("Nonce: expected: %v, decoded: %v", expectedNonce, h2.Nonce)
}
expectedNumber := mustConvertBigInt(h.Number, 16)
@@ -423,9 +423,8 @@ func mustConvertHeader(in btHeader) *types.Header {
GasLimit: mustConvertBigInt(in.GasLimit, 16),
Difficulty: mustConvertBigInt(in.Difficulty, 16),
Time: mustConvertUint(in.Timestamp, 16),
+ Nonce: types.EncodeNonce(mustConvertUint(in.Nonce, 16)),
}
- // XXX cheats? :-)
- header.SetNonce(mustConvertUint(in.Nonce, 16))
return header
}