diff options
author | Felix Lange <fjl@twurst.com> | 2015-08-27 06:03:59 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-08-27 06:03:59 +0800 |
commit | 6ec13e7e2bab1ebdb580819a48629055bbbb5fb3 (patch) | |
tree | cd23c3deac1a41b34a5157c1f7c5361ca56b4137 /core/types | |
parent | 79b644c7a35bbc835b7e78ddf8a31c37e69b0784 (diff) | |
parent | 17f65cd1e5e0fea6e4f7b96c60767aaa0ada366d (diff) | |
download | dexon-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.tar dexon-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.tar.gz dexon-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.tar.bz2 dexon-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.tar.lz dexon-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.tar.xz dexon-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.tar.zst dexon-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.zip |
Merge pull request #1701 from karalabe/eth62-sync-rebase
eth: implement eth/62 synchronization logic
Diffstat (limited to 'core/types')
-rw-r--r-- | core/types/block.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/types/block.go b/core/types/block.go index 2188e6d4d..fd81db04c 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -360,6 +360,20 @@ func (b *Block) WithMiningResult(nonce uint64, mixDigest common.Hash) *Block { } } +// WithBody returns a new block with the given transaction and uncle contents. +func (b *Block) WithBody(transactions []*Transaction, uncles []*Header) *Block { + block := &Block{ + header: copyHeader(b.header), + transactions: make([]*Transaction, len(transactions)), + uncles: make([]*Header, len(uncles)), + } + copy(block.transactions, transactions) + for i := range uncles { + block.uncles[i] = copyHeader(uncles[i]) + } + return block +} + // Implement pow.Block func (b *Block) Hash() common.Hash { |