aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-24 17:33:00 +0800
committerobscuren <geffobscura@gmail.com>2015-03-24 17:33:00 +0800
commitd8e21b39b30f3951c17a618baffcc3592afae0b1 (patch)
tree1044a5a6007356f74b09c612202c5c3fdfaf2812
parent0ee0094cc02e81d3a9f5b00cd7cdd421ee069492 (diff)
downloaddexon-d8e21b39b30f3951c17a618baffcc3592afae0b1.tar.gz
dexon-d8e21b39b30f3951c17a618baffcc3592afae0b1.tar.zst
dexon-d8e21b39b30f3951c17a618baffcc3592afae0b1.zip
Added copy function
-rw-r--r--core/types/block.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/types/block.go b/core/types/block.go
index a4fb44040..cf2a7080e 100644
--- a/core/types/block.go
+++ b/core/types/block.go
@@ -301,6 +301,23 @@ func (self *Block) ParentHash() common.Hash {
}
}
+func (self *Block) Copy() *Block {
+ block := NewBlock(self.ParentHash(), self.Coinbase(), self.Root(), self.Difficulty(), self.Nonce(), self.header.Extra)
+ block.header.Bloom = self.header.Bloom
+ block.header.TxHash = self.header.TxHash
+ block.transactions = self.transactions
+ block.header.UncleHash = self.header.UncleHash
+ block.uncles = self.uncles
+ block.header.GasLimit.Set(self.header.GasLimit)
+ block.header.GasUsed.Set(self.header.GasUsed)
+ block.header.ReceiptHash = self.header.ReceiptHash
+ block.header.Difficulty.Set(self.header.Difficulty)
+ block.header.Number = self.header.Number
+ block.header.Time = self.header.Time
+ block.header.MixDigest = self.header.MixDigest
+ return block
+}
+
func (self *Block) String() string {
return fmt.Sprintf(`BLOCK(%x): Size: %v TD: %v {
NoNonce: %x