aboutsummaryrefslogtreecommitdiffstats
path: root/chain/block_manager.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-11-07 19:18:48 +0800
committerobscuren <geffobscura@gmail.com>2014-11-07 19:18:48 +0800
commit429dd2a100f3b9e2b612b59bcb48f79a805cd6f9 (patch)
treec91fee673e461a192d4d783193c8ddbead4a97d2 /chain/block_manager.go
parent48488017e498916c81122c01cfe1880afdd00d48 (diff)
downloaddexon-429dd2a100f3b9e2b612b59bcb48f79a805cd6f9.tar
dexon-429dd2a100f3b9e2b612b59bcb48f79a805cd6f9.tar.gz
dexon-429dd2a100f3b9e2b612b59bcb48f79a805cd6f9.tar.bz2
dexon-429dd2a100f3b9e2b612b59bcb48f79a805cd6f9.tar.lz
dexon-429dd2a100f3b9e2b612b59bcb48f79a805cd6f9.tar.xz
dexon-429dd2a100f3b9e2b612b59bcb48f79a805cd6f9.tar.zst
dexon-429dd2a100f3b9e2b612b59bcb48f79a805cd6f9.zip
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
Diffstat (limited to 'chain/block_manager.go')
-rw-r--r--chain/block_manager.go16
1 files changed, 9 insertions, 7 deletions
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 {