aboutsummaryrefslogtreecommitdiffstats
path: root/chain/transaction_pool.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-02 07:14:34 +0800
committerobscuren <geffobscura@gmail.com>2014-12-02 07:14:34 +0800
commitb4eeffa8f1f4c3c1f94d338b3dafcc899fd6edcb (patch)
treee79e2cf69f4c5efb0b32662ba6238117d3b63449 /chain/transaction_pool.go
parent2df8ad6307d741d0a6d2f746d53f97c7b27ad796 (diff)
downloadgo-tangerine-b4eeffa8f1f4c3c1f94d338b3dafcc899fd6edcb.tar.gz
go-tangerine-b4eeffa8f1f4c3c1f94d338b3dafcc899fd6edcb.tar.zst
go-tangerine-b4eeffa8f1f4c3c1f94d338b3dafcc899fd6edcb.zip
Transaction strictness
Diffstat (limited to 'chain/transaction_pool.go')
-rw-r--r--chain/transaction_pool.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/chain/transaction_pool.go b/chain/transaction_pool.go
index fbf882163..0c2083088 100644
--- a/chain/transaction_pool.go
+++ b/chain/transaction_pool.go
@@ -102,11 +102,15 @@ func (pool *TxPool) ValidateTransaction(tx *Transaction) error {
block := pool.Ethereum.ChainManager().CurrentBlock
// Something has gone horribly wrong if this happens
if block == nil {
- return fmt.Errorf("[TXPL] No last block on the block chain")
+ return fmt.Errorf("No last block on the block chain")
}
if len(tx.Recipient) != 0 && len(tx.Recipient) != 20 {
- return fmt.Errorf("[TXPL] Invalid recipient. len = %d", len(tx.Recipient))
+ return fmt.Errorf("Invalid recipient. len = %d", len(tx.Recipient))
+ }
+
+ if tx.v > 28 || tx.v < 27 {
+ return fmt.Errorf("tx.v != (28 || 27)")
}
if tx.GasPrice.Cmp(MinGasPrice) < 0 {
@@ -120,12 +124,12 @@ func (pool *TxPool) ValidateTransaction(tx *Transaction) error {
// Make sure there's enough in the sender's account. Having insufficient
// funds won't invalidate this transaction but simple ignores it.
if sender.Balance().Cmp(totAmount) < 0 {
- return fmt.Errorf("[TXPL] Insufficient amount in sender's (%x) account", tx.Sender())
+ return fmt.Errorf("Insufficient amount in sender's (%x) account", tx.Sender())
}
if tx.IsContract() {
if tx.GasPrice.Cmp(big.NewInt(minGasPrice)) < 0 {
- return fmt.Errorf("[TXPL] Gasprice too low, %s given should be at least %d.", tx.GasPrice, minGasPrice)
+ return fmt.Errorf("Gasprice too low, %s given should be at least %d.", tx.GasPrice, minGasPrice)
}
}