aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/transaction_pool.go
diff options
context:
space:
mode:
Diffstat (limited to 'ethchain/transaction_pool.go')
-rw-r--r--ethchain/transaction_pool.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/ethchain/transaction_pool.go b/ethchain/transaction_pool.go
index 9acd39e31..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, block *Block) (err error) {
+func (pool *TxPool) ProcessTransaction(tx *Transaction, block *Block, toContract bool) (err error) {
defer func() {
if r := recover(); r != nil {
log.Println(r)
@@ -108,7 +108,7 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, block *Block) (err error
}
if sender.Nonce != tx.Nonce {
- return fmt.Errorf("[TXPL] Invalid account nonce, state nonce is %d transactoin nonce is %d instead", sender.Nonce, tx.Nonce)
+ return fmt.Errorf("[TXPL] Invalid account nonce, state nonce is %d transaction nonce is %d instead", sender.Nonce, tx.Nonce)
}
// Get the receiver
@@ -119,6 +119,8 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, block *Block) (err error
if bytes.Compare(tx.Recipient, tx.Sender()) == 0 {
// Subtract the fee
sender.Amount.Sub(sender.Amount, new(big.Int).Mul(TxFee, TxFeeRat))
+ } else if toContract {
+ sender.Amount.Sub(sender.Amount, new(big.Int).Mul(TxFee, TxFeeRat))
} else {
// Subtract the amount from the senders account
sender.Amount.Sub(sender.Amount, totAmount)