diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-11-16 15:06:02 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2018-12-19 20:54:27 +0800 |
commit | 2c179f34f8ec99ef2b877604470a185fb4c3ae67 (patch) | |
tree | 5795cfb82b93eeb3efd1830c6decd07dbcea8093 | |
parent | ef24529c2930bea0fbe85b340098c6ecc92f907f (diff) | |
download | dexon-2c179f34f8ec99ef2b877604470a185fb4c3ae67.tar.gz dexon-2c179f34f8ec99ef2b877604470a185fb4c3ae67.tar.zst dexon-2c179f34f8ec99ef2b877604470a185fb4c3ae67.zip |
core: revert changes to StateProcessor.Process (#29)
-rw-r--r-- | core/blockchain.go | 16 | ||||
-rw-r--r-- | core/types/block.go | 4 |
2 files changed, 10 insertions, 10 deletions
diff --git a/core/blockchain.go b/core/blockchain.go index 41210757c..4aedc24fb 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1563,6 +1563,13 @@ func (bc *BlockChain) processPendingBlock( currentBlock := bc.CurrentBlock() + var ( + receipts types.Receipts + usedGas = new(uint64) + header = block.Header() + gp = new(GasPool).AddGas(math.MaxUint64) + ) + var parentBlock *types.Block var pendingState *state.StateDB var err error @@ -1575,18 +1582,13 @@ func (bc *BlockChain) processPendingBlock( } else { parentBlock = parent.block } - block.RawHeader().ParentHash = parentBlock.Hash() + + header.ParentHash = parentBlock.Hash() pendingState, err = state.New(parentBlock.Root(), bc.stateCache) if err != nil { return nil, nil, nil, err } - var ( - receipts types.Receipts - usedGas = new(uint64) - header = block.Header() - gp = new(GasPool).AddGas(math.MaxUint64) - ) // Iterate over and process the individual transactions for i, tx := range block.Transactions() { pendingState.Prepare(tx.Hash(), block.Hash(), i) diff --git a/core/types/block.go b/core/types/block.go index f12208934..fb61cadfc 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -318,9 +318,7 @@ func (b *Block) Randomness() []byte { return common.CopyBytes(b.header.Ran func (b *Block) Reward() *big.Int { return new(big.Int).Set(b.header.Reward) } func (b *Block) Round() uint64 { return b.header.Round } func (b *Block) DexconMeta() []byte { return common.CopyBytes(b.header.DexconMeta) } - -func (b *Block) Header() *Header { return CopyHeader(b.header) } -func (b *Block) RawHeader() *Header { return b.header } +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} } |