From 429dd2a100f3b9e2b612b59bcb48f79a805cd6f9 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 7 Nov 2014 12:18:48 +0100 Subject: Implemented new miner w/ ui interface for merged mining. Closes #177 * Miner has been rewritten * Added new miner pane * Added option for local txs * Added option to read from MergeMining contract and list them for merged mining --- chain/block_manager.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'chain/block_manager.go') diff --git a/chain/block_manager.go b/chain/block_manager.go index ed2fbfe8c..79c18fbe3 100644 --- a/chain/block_manager.go +++ b/chain/block_manager.go @@ -228,7 +228,7 @@ func (sm *BlockManager) Process(block *Block) (td *big.Int, err error) { func (sm *BlockManager) ProcessWithParent(block, parent *Block) (td *big.Int, err error) { sm.lastAttemptedBlock = block - state := parent.State() + state := parent.State().Copy() // Defer the Undo on the Trie. If the block processing happened // we don't want to undo but since undo only happens on dirty @@ -240,20 +240,22 @@ func (sm *BlockManager) ProcessWithParent(block, parent *Block) (td *big.Int, er fmt.Printf("## %x %x ##\n", block.Hash(), block.Number) } + _, err = sm.ApplyDiff(state, parent, block) + if err != nil { + return nil, err + } + + /* Go and C++ don't have consensus here. FIXME txSha := DeriveSha(block.transactions) if bytes.Compare(txSha, block.TxSha) != 0 { return nil, fmt.Errorf("Error validating transaction sha. Received %x, got %x", block.TxSha, txSha) } - receipts, err := sm.ApplyDiff(state, parent, block) - if err != nil { - return nil, err - } - receiptSha := DeriveSha(receipts) if bytes.Compare(receiptSha, block.ReceiptSha) != 0 { return nil, fmt.Errorf("Error validating receipt sha. Received %x, got %x", block.ReceiptSha, receiptSha) } + */ // Block validation if err = sm.ValidateBlock(block, parent); err != nil { @@ -374,7 +376,7 @@ func (sm *BlockManager) AccumelateRewards(state *state.State, block, parent *Blo uncleParent := sm.bc.GetBlock(uncle.PrevHash) if uncleParent == nil { - return UncleError("Uncle's parent unknown") + return UncleError(fmt.Sprintf("Uncle's parent unknown (%x)", uncle.PrevHash[0:4])) } if uncleParent.Number.Cmp(new(big.Int).Sub(parent.Number, big.NewInt(6))) < 0 { -- cgit