aboutsummaryrefslogtreecommitdiffstats
path: root/core/types
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-08-15 02:25:41 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-08-25 22:48:47 +0800
commit47a7fe5d22fe2a6be783f6576070814fe951eaaf (patch)
tree61f2f691c6775fa5ae3547b8d769a709b7b3f04c /core/types
parentca88e18f59af84f34ad67da21fd27a6407eea87c (diff)
downloaddexon-47a7fe5d22fe2a6be783f6576070814fe951eaaf.tar
dexon-47a7fe5d22fe2a6be783f6576070814fe951eaaf.tar.gz
dexon-47a7fe5d22fe2a6be783f6576070814fe951eaaf.tar.bz2
dexon-47a7fe5d22fe2a6be783f6576070814fe951eaaf.tar.lz
dexon-47a7fe5d22fe2a6be783f6576070814fe951eaaf.tar.xz
dexon-47a7fe5d22fe2a6be783f6576070814fe951eaaf.tar.zst
dexon-47a7fe5d22fe2a6be783f6576070814fe951eaaf.zip
eth: port the synchronisation algo to eth/62
Diffstat (limited to 'core/types')
-rw-r--r--core/types/block.go14
1 files changed, 14 insertions, 0 deletions
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 {