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

API: don't error on missing output #3256

Merged
merged 6 commits into from
Mar 4, 2020

Conversation

jaspervdm
Copy link
Contributor

@jaspervdm jaspervdm commented Feb 29, 2020

When the wallet is querying the api for a list of commitment containing unconfirmed outputs, they show up as errors in the log like this:

20190614 21:37:47.937 ERROR grin_api::handlers::chain_api - Failure to get output for commitment 0951860ff6a74dc41902f08cbe7614b440af0fff2ad629d2847cd0a8c4a9211fd4 with error Not found.
20190614 21:37:47.937 ERROR grin_api::handlers::chain_api - Failure to get output for commitment 08707b918dacbc8e5e4990dc1e47ce0c28b879297f3440959953cce7954683d21f with error Not found.
20190614 21:37:47.938 ERROR grin_api::handlers::chain_api - Failure to get output for commitment 087dd75eaa1f0e43bf54f0773ccde17005683c4fd02aa9b0e19fac51727b10c74a with error Not found.

This is not really necessary, since it is expected behaviour that some of the commitments are not in the unspent set. Furthermore, those errors were discarded higher up in the call chain, meaning real errors were not propagated to the wallet response properly.

This PR fixes both these behaviours by changing some internal functions from Result<.., Error> to Result<Option<..>, Error>.

@jaspervdm jaspervdm requested a review from antiochp February 29, 2020 00:49
@jaspervdm jaspervdm changed the title Node API: don't error on missing output [DNM] Node API: don't error on missing output Feb 29, 2020
@jaspervdm jaspervdm changed the title [DNM] Node API: don't error on missing output API: don't error on missing output Mar 2, 2020
Copy link
Member

@antiochp antiochp left a comment

Choose a reason for hiding this comment

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

👍 Looks good. Couple of comments about renaming a fn and the api needing to lookup twice.

api/src/handlers/utils.rs Show resolved Hide resolved
api/src/handlers/utils.rs Show resolved Hide resolved
chain/src/chain.rs Outdated Show resolved Hide resolved
chain/src/txhashset/txhashset.rs Outdated Show resolved Hide resolved
Copy link
Member

@antiochp antiochp left a comment

Choose a reason for hiding this comment

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

👍 Lets do this.

Copy link
Member

@antiochp antiochp left a comment

Choose a reason for hiding this comment

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

👍

@jaspervdm jaspervdm merged commit d5b5232 into mimblewimble:master Mar 4, 2020
@jyap808 jyap808 mentioned this pull request Mar 7, 2020
@jaspervdm jaspervdm deleted the missing_output_no_error branch November 26, 2020 17:58
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