aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/transaction_pool.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-04-16 10:06:51 +0800
committerobscuren <geffobscura@gmail.com>2014-04-16 10:06:51 +0800
commit9c6aca78933c14ca107da30c4690808950718368 (patch)
treeda641b2904ea6ed05870a1ded486543529eae5a3 /ethchain/transaction_pool.go
parentca13e3b1058f0d680b79dc1d9319d427a09493f8 (diff)
downloadgo-tangerine-9c6aca78933c14ca107da30c4690808950718368.tar
go-tangerine-9c6aca78933c14ca107da30c4690808950718368.tar.gz
go-tangerine-9c6aca78933c14ca107da30c4690808950718368.tar.bz2
go-tangerine-9c6aca78933c14ca107da30c4690808950718368.tar.lz
go-tangerine-9c6aca78933c14ca107da30c4690808950718368.tar.xz
go-tangerine-9c6aca78933c14ca107da30c4690808950718368.tar.zst
go-tangerine-9c6aca78933c14ca107da30c4690808950718368.zip
Merged accounts and contracts in to StateObject
* Account removed * Contract removed * Address state changed to CachedStateObject * Added StateObject
Diffstat (limited to 'ethchain/transaction_pool.go')
-rw-r--r--ethchain/transaction_pool.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/ethchain/transaction_pool.go b/ethchain/transaction_pool.go
index 0bcfe6923..5cdda17e2 100644
--- a/ethchain/transaction_pool.go
+++ b/ethchain/transaction_pool.go
@@ -118,20 +118,20 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, block *Block, toContract
// Send Tx to self
if bytes.Compare(tx.Recipient, tx.Sender()) == 0 {
// Subtract the fee
- sender.Amount.Sub(sender.Amount, new(big.Int).Mul(TxFee, TxFeeRat))
+ sender.SubAmount(new(big.Int).Mul(TxFee, TxFeeRat))
} else if toContract {
- sender.Amount.Sub(sender.Amount, new(big.Int).Mul(TxFee, TxFeeRat))
+ sender.SubAmount(new(big.Int).Mul(TxFee, TxFeeRat))
} else {
// Subtract the amount from the senders account
- sender.Amount.Sub(sender.Amount, totAmount)
+ sender.SubAmount(totAmount)
// Add the amount to receivers account which should conclude this transaction
- receiver.Amount.Add(receiver.Amount, tx.Value)
+ receiver.AddAmount(tx.Value)
- block.state.UpdateAccount(tx.Recipient, receiver)
+ block.state.UpdateStateObject(receiver)
}
- block.state.UpdateAccount(tx.Sender(), sender)
+ block.state.UpdateStateObject(sender)
log.Printf("[TXPL] Processed Tx %x\n", tx.Hash())
@@ -151,7 +151,7 @@ func (pool *TxPool) ValidateTransaction(tx *Transaction) error {
// Get the sender
accountState := pool.Ethereum.StateManager().GetAddrState(tx.Sender())
- sender := accountState.Account
+ sender := accountState.Object
totAmount := new(big.Int).Add(tx.Value, new(big.Int).Mul(TxFee, TxFeeRat))
// Make sure there's enough in the sender's account. Having insufficient