Skip to content
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(core-transaction-pool): clear cached transaction ids after accepting block #2916

Merged
merged 3 commits into from
Sep 12, 2019

Conversation

spkjp
Copy link
Contributor

@spkjp spkjp commented Sep 10, 2019

Because of nonces, #2879 changed how the transaction pool processor removes cached transaction ids. They are now removed too early which effectively renders the cache useless. But with nonces it is not trivially possible to generate a different id anymore (without changing the payload) and thus if rejected once (e.g. sent too early or whatever) it will likely be rejected again for quite some time.

The only purpose of the id caching is to "debounce" the transaction broadcasts that happen between peers in the network. Without it, the processor would end up processing the same transactions multiple times, because the endpoint is hit multiple times with the same payload in a short timeframe.

This PR changes it so that the cache is cleared whenever a block is accepted instead. While that solution is still far from perfect, so is the transaction endpoint.

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Refactor
  • Performance
  • Tests
  • Build
  • Documentation
  • Code style update
  • Continuous Integration
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

Does this PR release a new version?

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • It's submitted to the develop branch, not the master branch
  • All tests are passing
  • New/updated tests are included

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

@codecov-io
Copy link

codecov-io commented Sep 11, 2019

Codecov Report

Merging #2916 into develop will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2916      +/-   ##
===========================================
- Coverage    68.14%   68.13%   -0.01%     
===========================================
  Files          406      406              
  Lines         9775     9773       -2     
  Branches       508      508              
===========================================
- Hits          6661     6659       -2     
  Misses        3072     3072              
  Partials        42       42
Impacted Files Coverage Δ
packages/core-transaction-pool/src/connection.ts 91.91% <ø> (-0.05%) ⬇️
packages/core-transaction-pool/src/processor.ts 78.66% <100%> (-0.29%) ⬇️
packages/core-state/src/stores/state.ts 90% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 36a7940...886ce04. Read the comment docs.

@faustbrian faustbrian merged commit 578d3fd into develop Sep 12, 2019
@faustbrian faustbrian deleted the refactor/core-transaction-pool/cached-ids branch September 12, 2019 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants