|
|
|
@ -112,16 +112,21 @@ func (sm *StateManager) ApplyTransactions(block *Block, txs []*Transaction) { |
|
|
|
|
// Figure out if the address this transaction was sent to is a
|
|
|
|
|
// contract or an actual account. In case of a contract, we process that
|
|
|
|
|
// 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, block, true) |
|
|
|
|
if err == nil { |
|
|
|
|
sm.ProcessContract(contract, tx, block) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
err := sm.Ethereum.TxPool().ProcessTransaction(tx, block) |
|
|
|
|
err = sm.Ethereum.TxPool().ProcessTransaction(tx, block, false) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
ethutil.Config.Log.Infoln("[STATE]", err) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// The prepare function, prepares the state manager for the next
|
|
|
|
@ -283,7 +288,7 @@ func (sm *StateManager) AccumelateRewards(block *Block) error { |
|
|
|
|
// Reward amount of ether to the coinbase address
|
|
|
|
|
addr.AddFee(CalculateBlockReward(block, len(block.Uncles))) |
|
|
|
|
|
|
|
|
|
var acc []byte |
|
|
|
|
acc := make([]byte, len(block.Coinbase)) |
|
|
|
|
copy(acc, block.Coinbase) |
|
|
|
|
sm.procState.UpdateAccount(acc, addr) |
|
|
|
|
|
|
|
|
@ -323,4 +328,7 @@ func (sm *StateManager) ProcessContract(contract *Contract, tx *Transaction, blo |
|
|
|
|
txData: nil, |
|
|
|
|
}) |
|
|
|
|
closure.Call(vm, nil) |
|
|
|
|
|
|
|
|
|
// Update the account (refunds)
|
|
|
|
|
sm.procState.UpdateAccount(tx.Sender(), caller) |
|
|
|
|
} |
|
|
|
|