aboutsummaryrefslogtreecommitdiffstats
path: root/core/transaction_pool.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-05-27 08:07:03 +0800
committerobscuren <geffobscura@gmail.com>2015-05-27 08:07:03 +0800
commit70867904a0255bd044851585a9ad2dc34391ced2 (patch)
tree9c5dfc6a9b8944c37f874a81cc9f8fd3d697ad4e /core/transaction_pool.go
parentceea1a7051ddc7d2660117204aeb3392b7cf8314 (diff)
parent2c532a7255919bc09e01cca6866bfc15682509a3 (diff)
downloadgo-tangerine-0.9.25.tar
go-tangerine-0.9.25.tar.gz
go-tangerine-0.9.25.tar.bz2
go-tangerine-0.9.25.tar.lz
go-tangerine-0.9.25.tar.xz
go-tangerine-0.9.25.tar.zst
go-tangerine-0.9.25.zip
Merge branch 'release/0.9.25'v0.9.25
Diffstat (limited to 'core/transaction_pool.go')
-rw-r--r--core/transaction_pool.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/transaction_pool.go b/core/transaction_pool.go
index e68f7406a..c896488d1 100644
--- a/core/transaction_pool.go
+++ b/core/transaction_pool.go
@@ -25,6 +25,7 @@ var (
ErrInsufficientFunds = errors.New("Insufficient funds for gas * price + value")
ErrIntrinsicGas = errors.New("Intrinsic gas too low")
ErrGasLimit = errors.New("Exceeds block gas limit")
+ ErrNegativeValue = errors.New("Negative value")
)
const txPoolQueueSize = 50
@@ -125,6 +126,10 @@ func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error {
return ErrGasLimit
}
+ if tx.Amount.Cmp(common.Big0) < 0 {
+ return ErrNegativeValue
+ }
+
total := new(big.Int).Mul(tx.Price, tx.GasLimit)
total.Add(total, tx.Value())
if pool.currentState().GetBalance(from).Cmp(total) < 0 {