diff options
author | Stephen Buttolph <[email protected]> | 2020-08-25 13:49:24 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2020-08-25 13:49:24 -0400 |
commit | 5f9c76b5f4eb5bb08b8d3e3125b223f3737631d3 (patch) | |
tree | 9de0af77831340eb38c28c613849f1e7b65f3a54 /core/types/block.go | |
parent | 1bb314f767785fe617c3c5efeca1a64127339506 (diff) | |
parent | b05d11d451fb73843abcf6bd5fc8664b069433a4 (diff) |
Merge pull request #11 from ava-labs/TS_fix_gasv0.2.13
Fix gas handling
Diffstat (limited to 'core/types/block.go')
-rw-r--r-- | core/types/block.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/core/types/block.go b/core/types/block.go index b3dbcd3..4096d86 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -144,6 +144,8 @@ func rlpHash(x interface{}) (h common.Hash) { type Body struct { Transactions []*Transaction Uncles []*Header + Version uint32 + ExtData []byte `rlp:"nil"` } // Block represents an entire block in the Ethereum blockchain. @@ -212,7 +214,7 @@ type storageblock struct { // The values of TxHash, UncleHash, ReceiptHash and Bloom in header // are ignored and set to values derived from the given txs, uncles // and receipts. -func NewBlock(header *Header, txs []*Transaction, uncles []*Header, receipts []*Receipt) *Block { +func NewBlock(header *Header, txs []*Transaction, uncles []*Header, receipts []*Receipt, extdata []byte) *Block { b := &Block{header: CopyHeader(header), td: new(big.Int)} // TODO: panic if len(txs) != len(receipts) @@ -241,6 +243,9 @@ func NewBlock(header *Header, txs []*Transaction, uncles []*Header, receipts []* } } + b.extdata = make([]byte, len(extdata)) + copy(b.extdata, extdata) + return b } @@ -387,7 +392,7 @@ func (b *Block) Extra() []byte { return common.CopyBytes(b.header.Ext func (b *Block) Header() *Header { return CopyHeader(b.header) } // Body returns the non-header content of the block. -func (b *Block) Body() *Body { return &Body{b.transactions, b.uncles} } +func (b *Block) Body() *Body { return &Body{b.transactions, b.uncles, b.version, b.extdata} } // Size returns the true RLP encoded storage size of the block, either by encoding // and returning it, or returning a previsouly cached value. @@ -434,13 +439,16 @@ func (b *Block) WithSeal(header *Header) *Block { } // WithBody returns a new block with the given transaction and uncle contents. -func (b *Block) WithBody(transactions []*Transaction, uncles []*Header) *Block { +func (b *Block) WithBody(transactions []*Transaction, uncles []*Header, version uint32, extdata []byte) *Block { block := &Block{ header: CopyHeader(b.header), transactions: make([]*Transaction, len(transactions)), uncles: make([]*Header, len(uncles)), + extdata: make([]byte, len(extdata)), + version: version, } copy(block.transactions, transactions) + copy(block.extdata, extdata) for i := range uncles { block.uncles[i] = CopyHeader(uncles[i]) } |