diff options
author | obscuren <geffobscura@gmail.com> | 2014-04-09 21:08:10 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-04-09 21:08:10 +0800 |
commit | 035f0ffb8ac95faa1742c0575cc9b5409ec54379 (patch) | |
tree | e35c99b1489b72b7068b58a69504664b8239fb47 | |
parent | 527a3bbc2aa9cfd26bd8419d33b50adef536067d (diff) | |
download | dexon-035f0ffb8ac95faa1742c0575cc9b5409ec54379.tar dexon-035f0ffb8ac95faa1742c0575cc9b5409ec54379.tar.gz dexon-035f0ffb8ac95faa1742c0575cc9b5409ec54379.tar.bz2 dexon-035f0ffb8ac95faa1742c0575cc9b5409ec54379.tar.lz dexon-035f0ffb8ac95faa1742c0575cc9b5409ec54379.tar.xz dexon-035f0ffb8ac95faa1742c0575cc9b5409ec54379.tar.zst dexon-035f0ffb8ac95faa1742c0575cc9b5409ec54379.zip |
Reverted changes
-rw-r--r-- | ethchain/state_manager.go | 4 | ||||
-rw-r--r-- | ethchain/transaction_pool.go | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/ethchain/state_manager.go b/ethchain/state_manager.go index 4b0ea2515..c33ba9272 100644 --- a/ethchain/state_manager.go +++ b/ethchain/state_manager.go @@ -114,12 +114,12 @@ func (sm *StateManager) ApplyTransactions(block *Block, txs []*Transaction) { // contract instead of moving funds between accounts. var err error if contract := sm.procState.GetContract(tx.Recipient); contract != nil { - err = sm.Ethereum.TxPool().ProcessTransaction(tx, sm.procState, true) + err = sm.Ethereum.TxPool().ProcessTransaction(tx, block, true) if err == nil { sm.ProcessContract(contract, tx, block) } } else { - err = sm.Ethereum.TxPool().ProcessTransaction(tx, sm.procState, false) + err = sm.Ethereum.TxPool().ProcessTransaction(tx, block, false) } if err != nil { diff --git a/ethchain/transaction_pool.go b/ethchain/transaction_pool.go index 849909677..0bcfe6923 100644 --- a/ethchain/transaction_pool.go +++ b/ethchain/transaction_pool.go @@ -90,7 +90,7 @@ func (pool *TxPool) addTransaction(tx *Transaction) { // Process transaction validates the Tx and processes funds from the // sender to the recipient. -func (pool *TxPool) ProcessTransaction(tx *Transaction, state *State, toContract bool) (err error) { +func (pool *TxPool) ProcessTransaction(tx *Transaction, block *Block, toContract bool) (err error) { defer func() { if r := recover(); r != nil { log.Println(r) @@ -98,7 +98,7 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, state *State, toContract } }() // Get the sender - sender := state.GetAccount(tx.Sender()) + sender := block.state.GetAccount(tx.Sender()) // Make sure there's enough in the sender's account. Having insufficient // funds won't invalidate this transaction but simple ignores it. @@ -112,7 +112,7 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, state *State, toContract } // Get the receiver - receiver := state.GetAccount(tx.Recipient) + receiver := block.state.GetAccount(tx.Recipient) sender.Nonce += 1 // Send Tx to self @@ -128,10 +128,10 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, state *State, toContract // Add the amount to receivers account which should conclude this transaction receiver.Amount.Add(receiver.Amount, tx.Value) - state.UpdateAccount(tx.Recipient, receiver) + block.state.UpdateAccount(tx.Recipient, receiver) } - state.UpdateAccount(tx.Sender(), sender) + block.state.UpdateAccount(tx.Sender(), sender) log.Printf("[TXPL] Processed Tx %x\n", tx.Hash()) |