Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(pool): remove unnecessary check from validateTransactions() (#…
…2951) * refactor(pool): remove unnecessary check from validateTransactions() We would call handler.throwIfCannotBeApplied(transaction, sender, databaseWalletManager); followed by handler.applyToSender(transaction, localWalletManager); but applyToSender() calls throwIfCannotBeApplied() internally, so we don't need to call it ourselves. Also, it was wrong to use the databaseWalletManager in that call because we are applying the transactions to localWalletManager, so the databaseWalletManager will be outdated (e.g. sender nonce and balance will be stale in databaseWalletManager). So, remove the unnecessary call to throwIfCannotBeApplied(). * test: adjust "should handle getTransaction() not finding transaction" throwIfCannotBeApplied() is not called directly anymore. It is only called from applyToSender(), but that method is mocked. * test: remove irrelevant test We don't call throwIfCannotBeApplied() before applyToSender() anymore, so the test becomes irrelevant - it fakes an exception from throwIfCannotBeApplied() and checks that applyToSender() is not called. * test(core-transaction-pool): fix test to use correct nonces The test was trying to use transaction mockData.dummyLarge1 which has nonce=2, but without having prior transactions from that sender applied. So, use mockData.dummy10 which is from that sender and has nonce=1. * test: fix to not break due to leftovers from previous tests
- Loading branch information