From 47a7fe5d22fe2a6be783f6576070814fe951eaaf Mon Sep 17 00:00:00 2001 From: Péter Szilágyi Date: Fri, 14 Aug 2015 21:25:41 +0300 Subject: eth: port the synchronisation algo to eth/62 --- core/types/block.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'core') diff --git a/core/types/block.go b/core/types/block.go index 427a3e6cb..777ad9483 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -357,6 +357,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 { -- cgit