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

Prevent transient negative missingCoin amount sent to QRCode display #4258

Merged
merged 1 commit into from May 16, 2020
Merged

Prevent transient negative missingCoin amount sent to QRCode display #4258

merged 1 commit into from May 16, 2020

Conversation

ghost
Copy link

@ghost ghost commented May 15, 2020

In /pull/4223 a fix was made to the QRCode display of amount needed to fund an offer. This accidentally introduced a bug whereby if the user overpaid the funding, then the QRCode would throw an error Coin must be positive. This is due to a race condition in OfferDataModel which was setting a property first to a negative amount before checking if it was negative and if so then setting it to zero. The fix here is to check for negative before setting the property so that any listeners do not get an event (negative) followed by another event (zero).

In /pull/4223 a fix was made to the QRCode display
of amount needed to fund an offer.  This accidentally introduced a
bug whereby if the user overpaid the funding, then the QRCode would
throw an error `Coin must be positive`.  This is due to a race
condition in OfferDataModel which was setting a property first
to a negative amount before checking if it was negative and if so
then setting it to zero.  The fix here is to check for negative
before setting the property so that any listeners do not get an
event (negative) followed by another event (zero).
@ghost
Copy link
Author

ghost commented May 15, 2020

Testing

To reproduce the error: create an offer and fund it from your external wallet. If you send more than the required amount, an error message will pop up.

image

Verification

Make the same test (overfund your trade from an external wallet). With the fix, no error message will be displayed, and the QRCode will indicate the amount remaining = 0.

image

@ghost ghost mentioned this pull request May 15, 2020
Copy link
Member

@sqrrm sqrrm left a comment

Choose a reason for hiding this comment

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

utACK

Good fix. Reminder to not set properties that are observed to intermediary values.

@sqrrm sqrrm merged commit 2bd4f1a into bisq-network:master May 16, 2020
@ripcurlx ripcurlx added this to the v1.3.5 milestone Jun 4, 2020
@ghost ghost mentioned this pull request Jun 11, 2020
@ghost ghost deleted the fix_stale_qrcode_display branch June 29, 2020 20:43
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.

2 participants