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

fix(wallet): correctly deal with new coinbase transactions for the same height #3151

Merged

Conversation

philipr-za
Copy link
Contributor

Description

A bug was observed that now and then a Coinbase Transaction would not conclude its monitoring with this error:
ValueNotFound(CompletedTransaction(15645503741743694020))

This occurred when due to a small network reorg the miner would request a block for the same height. The new request would often have a different amount of fees which would mean this transaction needs to be cancelled in favour of the new transaction. However, with the transaction being cancelled the coinbase monitoring task will come around to checking the DB if the transaction is still there so it can continue to poll the base node and will get the ValueNotFound error. This is correct behaviour so should not have been logged as an error. The error case also means that the TransactionCancelled event is never fired which resulted in the console wallet UI not updating the state of that transaction which left it in the transaction list erroneous.

So this PR handles that “Error” properly and sends the event before ending the coinbase monitoring task.

How Has This Been Tested?

unit tests

Checklist:

  • I'm merging against the development branch.
  • I have squashed my commits into a single commit.

hansieodendaal
hansieodendaal previously approved these changes Jul 30, 2021
Copy link
Contributor

@hansieodendaal hansieodendaal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice deduction.

A bug was observed that now and then a Coinbase Transaction would not conclude its monitoring with this error:
`ValueNotFound(CompletedTransaction(15645503741743694020))`

This occurred when due to a small network reorg the miner would request a block for the same height. The new request would often have a different amount of fees which would mean this transaction needs to be cancelled in favour of the new transaction. However, with the transaction being cancelled the coinbase monitoring task will come around to checking the DB if the transaction is still there so it can continue to poll the base node and will get the ValueNotFound error. This is correct behaviour so should not have been logged as an error. The error case also means that the TransactionCancelled event is never fired which resulted in the console wallet UI not updating the state of that transaction which left it in the transaction list erroneous.

So this PR handles that “Error” properly and sends the event before ending the coinbase monitoring	task.
Copy link
Collaborator

@SWvheerden SWvheerden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aviator-app
Copy link
Contributor

aviator-app bot commented Aug 4, 2021

PR queued successfully. Your position in queue is: 3

@stringhandler stringhandler changed the title Fix: Correctly deal with new coinbase transactions for the same height fix(wallet): correctly deal with new coinbase transactions for the same height Aug 4, 2021
@aviator-app
Copy link
Contributor

aviator-app bot commented Aug 4, 2021

PR is on top of the queue now

@aviator-app aviator-app bot merged commit 564ef5a into tari-project:development Aug 4, 2021
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.

4 participants