core: check negative value transactions. Closes #1109

This commit is contained in:
obscuren
2015-05-26 19:50:42 +02:00
parent a55f408c10
commit c37389f19c
4 changed files with 20 additions and 2 deletions

View File

@@ -138,3 +138,17 @@ func TestRemoveTx(t *testing.T) {
t.Error("expected txs to be 0, got", len(pool.txs))
}
}
func TestNegativeValue(t *testing.T) {
pool, key := setupTxPool()
tx := transaction()
tx.Value().Set(big.NewInt(-1))
tx.SignECDSA(key)
from, _ := tx.From()
pool.currentState().AddBalance(from, big.NewInt(1))
err := pool.Add(tx)
if err != ErrNegativeValue {
t.Error("expected", ErrNegativeValue, "got", err)
}
}