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

we expect unspent outputs but play it safe #517

Merged
merged 1 commit into from
Sep 14, 2020

Conversation

antiochp
Copy link
Member

Related: #516

We call the get_unspent_outputs api and expect to receive a collection of unspent outputs.
This is a reasonable assumption but we are brittle on the receiving/parsing side as each output in the response must contain a block height. If we receive a spent output for any reason the wallet is rendered inoperable as we can no longer refresh outputs.

This PR adds a (hopefully redundant) level of robustness by explicitly filtering out spent outputs from the list returned by the api.

See #516 for some background where the node api was inadvertently changed to return spent and unspent outputs, causing the wallet to fail.

@quentinlesceller
Copy link
Member

Any idea why we are receiving a spent output? Shouldn't we filter them server side instead (or also)?

@antiochp
Copy link
Member Author

Any idea why we are receiving a spent output? Shouldn't we filter them server side instead (or also)?

This was actually against a node running with code from mimblewimble/grin#3428
So this was an unintentional break of the api contract (returned spent outputs when it should not).

But - I think we should filter these on both sides. The wallet should make as few assumptions as possible regarding data returned by the node.
So we should filter client side also.

Copy link
Member

@quentinlesceller quentinlesceller left a comment

Choose a reason for hiding this comment

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

👍 then

@antiochp antiochp merged commit 8077d01 into mimblewimble:master Sep 14, 2020
@antiochp antiochp deleted the unspent_api_robustness branch September 14, 2020 11:17
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.

None yet

3 participants