neo-go/pkg/core/mempool
Roman Khimov 55b2cbb74d core: refactor and improve verification and pooling
Now we have VerifyTx() and PoolTx() APIs that either verify transaction in
isolation or verify it against the mempool (either the primary one or the one
given) and then add it there. There is no possibility to check against the
mempool, but not add a transaction to it, but I doubt we really need it.

It allows to remove some duplication between old PoolTx and verifyTx where
they both tried to check transaction against mempool (verifying first and then
adding it). It also saves us utility token balance check because it's done by
the mempool anyway and we no longer need to do that explicitly in verifyTx.

It makes AddBlock() and verifyBlock() transaction's checks more correct,
because previously they could miss that even though sender S has enough
balance to pay for A, B or C, he can't pay for all of them.

Caveats:
 * consensus is running concurrently to other processes, so things could
   change while verifyBlock() is iterating over transactions, this will be
   mitigated in subsequent commits

Improves TPS value for single node by at least 11%.

Fixes #667, fixes #668.
2020-08-20 18:50:18 +03:00
..
feer.go core: use big.Int to store NEP5 balances 2020-07-09 13:26:39 +03:00
mem_pool.go core: refactor and improve verification and pooling 2020-08-20 18:50:18 +03:00
mem_pool_test.go mempool: rename NewMemPool into New 2020-08-20 18:50:18 +03:00
prometheus.go mempool: remove unverified transactions pool 2020-02-06 15:45:16 +03:00