-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(pool): remove unnecessary check from validateTransactions() #2951
Conversation
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().
Codecov Report
@@ Coverage Diff @@
## develop #2951 +/- ##
=========================================
Coverage ? 29.1%
=========================================
Files ? 405
Lines ? 9825
Branches ? 464
=========================================
Hits ? 2860
Misses ? 6929
Partials ? 36
Continue to review full report at Codecov.
|
throwIfCannotBeApplied() is not called directly anymore. It is only called from applyToSender(), but that method is mocked.
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.
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.
…move-throwIfCannotBeApplied * ArkEcosystem/core/develop: chore: drop node 11 support (#2965) test(e2e): No need to run as root the chmod command when modifying own's files (#2958) refactor(crypto): change maximum recipients of multipayment via milestone (#2961) ci: split functional job into 1 job per type (#2963) refactor(core-p2p): make peer reply errors less verbose (#2962) fix(core-state): index recipient wallets during bootstrap (#2947)
Codecov Report
@@ Coverage Diff @@
## develop #2951 +/- ##
==========================================
Coverage ? 29.11%
==========================================
Files ? 405
Lines ? 9826
Branches ? 465
==========================================
Hits ? 2861
Misses ? 6929
Partials ? 36
Continue to review full report at Codecov.
|
…ts-nonce * ArkEcosystem/core/develop: refactor(core-transaction-pool): don't accept expired v1 transactions (#2948) fix(core-snapshots): remove bogus skipRoundRows (#2973) feat(core-api): endpoints for locks/businesses/bridgechains (#2940) fix(core-blockchain): round deletion during rollback (#2970) fix: range selection in pool's getTransactions() (#2952) feat: expose `isValidPeer` via ajv format rule (#2960) chore: remove trailing whitespace (#2971) fix(core-transactions): update wallet nonce when applying v1 transaction (#2959) fix(core-blockchain): do not reset `noBlockCounter` when `downloadBlocks` succeeds (#2968) refactor(pool): remove unnecessary check from validateTransactions() (#2951) ci: temporarily disable pull_request.synchronize event (#2966) refactor: strengthen a nonce check in performGenericWalletChecks() (#2949) ci: setup github action workflow for e2e tests (#2964) chore: drop node 11 support (#2965) test(e2e): No need to run as root the chmod command when modifying own's files (#2958) refactor(crypto): change maximum recipients of multipayment via milestone (#2961) ci: split functional job into 1 job per type (#2963) refactor(core-p2p): make peer reply errors less verbose (#2962) fix(core-state): index recipient wallets during bootstrap (#2947) Tell git to ignore vim's temporary files (#2957) ci: force exit tests if there are hanging promises ci: use different test coverage directories for each type (#2956)
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().
A summary of what changes this PR introduces and why they were made.
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
Does this PR release a new version?
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
develop
branch, not themaster
branchIf adding a new feature, the PR's description includes: