diff options
author | obscuren <geffobscura@gmail.com> | 2015-05-16 18:33:55 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-05-16 19:02:30 +0800 |
commit | d98a6f85fc1787a166ab91720c738fed2098185f (patch) | |
tree | 5d10a682f74217f12fc1f6140366cf5ed2f930c8 /core | |
parent | c2ef8682fe90c7e8c6e5d9d8ff30767f5a84e2f1 (diff) | |
download | dexon-d98a6f85fc1787a166ab91720c738fed2098185f.tar dexon-d98a6f85fc1787a166ab91720c738fed2098185f.tar.gz dexon-d98a6f85fc1787a166ab91720c738fed2098185f.tar.bz2 dexon-d98a6f85fc1787a166ab91720c738fed2098185f.tar.lz dexon-d98a6f85fc1787a166ab91720c738fed2098185f.tar.xz dexon-d98a6f85fc1787a166ab91720c738fed2098185f.tar.zst dexon-d98a6f85fc1787a166ab91720c738fed2098185f.zip |
core: further improved uncle error messages
Diffstat (limited to 'core')
-rw-r--r-- | core/block_processor.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/core/block_processor.go b/core/block_processor.go index 9a213686f..cae618b39 100644 --- a/core/block_processor.go +++ b/core/block_processor.go @@ -343,23 +343,23 @@ func (sm *BlockProcessor) VerifyUncles(statedb *state.StateDB, block, parent *ty uncles.Add(block.Hash()) for i, uncle := range block.Uncles() { - if uncles.Has(uncle.Hash()) { + hash := uncle.Hash() + if uncles.Has(hash) { // Error not unique - return UncleError("uncle[%d] not unique", i) + return UncleError("uncle[%d](%x) not unique", i, hash[:4]) } + uncles.Add(hash) - uncles.Add(uncle.Hash()) - - if ancestors.Has(uncle.Hash()) { - return UncleError("uncle[%d] is ancestor", i) + if ancestors.Has(hash) { + return UncleError("uncle[%d](%x) is ancestor", i, hash[:4]) } if !ancestors.Has(uncle.ParentHash) { - return UncleError("uncle[%d]'s parent unknown (%x)", i, uncle.ParentHash[0:4]) + return UncleError("uncle[%d](%x)'s parent unknown (%x)", i, hash[:4], uncle.ParentHash[0:4]) } if err := sm.ValidateHeader(uncle, ancestorHeaders[uncle.ParentHash]); err != nil { - return ValidationError(fmt.Sprintf("uncle[%d](%x) header invalid: %v", i, uncle.Hash().Bytes()[:4], err)) + return ValidationError(fmt.Sprintf("uncle[%d](%x) header invalid: %v", i, hash[:4], err)) } } |