|
|
@ -25,6 +25,7 @@ var ( |
|
|
|
ErrInsufficientFunds = errors.New("Insufficient funds for gas * price + value") |
|
|
|
ErrInsufficientFunds = errors.New("Insufficient funds for gas * price + value") |
|
|
|
ErrIntrinsicGas = errors.New("Intrinsic gas too low") |
|
|
|
ErrIntrinsicGas = errors.New("Intrinsic gas too low") |
|
|
|
ErrGasLimit = errors.New("Exceeds block gas limit") |
|
|
|
ErrGasLimit = errors.New("Exceeds block gas limit") |
|
|
|
|
|
|
|
ErrNegativeValue = errors.New("Negative value") |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
const txPoolQueueSize = 50 |
|
|
|
const txPoolQueueSize = 50 |
|
|
@ -125,6 +126,10 @@ func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error { |
|
|
|
return ErrGasLimit |
|
|
|
return ErrGasLimit |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if tx.Amount.Cmp(common.Big0) < 0 { |
|
|
|
|
|
|
|
return ErrNegativeValue |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
total := new(big.Int).Mul(tx.Price, tx.GasLimit) |
|
|
|
total := new(big.Int).Mul(tx.Price, tx.GasLimit) |
|
|
|
total.Add(total, tx.Value()) |
|
|
|
total.Add(total, tx.Value()) |
|
|
|
if pool.currentState().GetBalance(from).Cmp(total) < 0 { |
|
|
|
if pool.currentState().GetBalance(from).Cmp(total) < 0 { |
|
|
|