aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-12-16 19:19:02 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-12-16 19:30:39 +0800
commitc44830ebf316bf22104d01aa114d2b6d765d7a76 (patch)
tree0d8f7fdc157acc378e94555166dbe16fff9a5bb1 /core
parent38827dd9ca87c1a8ffab32027400abb6e88f073b (diff)
downloadgo-tangerine-c44830ebf316bf22104d01aa114d2b6d765d7a76.tar
go-tangerine-c44830ebf316bf22104d01aa114d2b6d765d7a76.tar.gz
go-tangerine-c44830ebf316bf22104d01aa114d2b6d765d7a76.tar.bz2
go-tangerine-c44830ebf316bf22104d01aa114d2b6d765d7a76.tar.lz
go-tangerine-c44830ebf316bf22104d01aa114d2b6d765d7a76.tar.xz
go-tangerine-c44830ebf316bf22104d01aa114d2b6d765d7a76.tar.zst
go-tangerine-c44830ebf316bf22104d01aa114d2b6d765d7a76.zip
core, light: allow zero cost txs from inexistent accounts too
Diffstat (limited to 'core')
-rw-r--r--core/tx_pool.go24
-rw-r--r--core/tx_pool_test.go4
2 files changed, 8 insertions, 20 deletions
diff --git a/core/tx_pool.go b/core/tx_pool.go
index 65e076df9..c5421fa02 100644
--- a/core/tx_pool.go
+++ b/core/tx_pool.go
@@ -37,15 +37,14 @@ import (
var (
// Transaction Pool Errors
- ErrInvalidSender = errors.New("Invalid sender")
- ErrNonce = errors.New("Nonce too low")
- ErrCheap = errors.New("Gas price too low for acceptance")
- ErrBalance = errors.New("Insufficient balance")
- ErrNonExistentAccount = errors.New("Account does not exist or account balance too low")
- 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")
+ ErrInvalidSender = errors.New("Invalid sender")
+ ErrNonce = errors.New("Nonce too low")
+ ErrCheap = errors.New("Gas price too low for acceptance")
+ ErrBalance = errors.New("Insufficient balance")
+ 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")
)
var (
@@ -287,13 +286,6 @@ func (pool *TxPool) validateTx(tx *types.Transaction) error {
if err != nil {
return ErrInvalidSender
}
-
- // Make sure the account exist. Non existent accounts
- // haven't got funds and well therefor never pass.
- if !currentState.Exist(from) {
- return ErrNonExistentAccount
- }
-
// Last but not least check for nonce errors
if currentState.GetNonce(from) > tx.Nonce() {
return ErrNonce
diff --git a/core/tx_pool_test.go b/core/tx_pool_test.go
index 3e516735b..f5fcac19f 100644
--- a/core/tx_pool_test.go
+++ b/core/tx_pool_test.go
@@ -129,10 +129,6 @@ func TestInvalidTransactions(t *testing.T) {
pool, key := setupTxPool()
tx := transaction(0, big.NewInt(100), key)
- if err := pool.Add(tx); err != ErrNonExistentAccount {
- t.Error("expected", ErrNonExistentAccount)
- }
-
from, _ := deriveSender(tx)
currentState, _ := pool.currentState()
currentState.AddBalance(from, big.NewInt(1))