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

chore: suppress tx already submitted error logs #3733

Merged
merged 1 commit into from Nov 26, 2023

Conversation

bradleystachurski
Copy link
Member

@bradleystachurski bradleystachurski commented Nov 26, 2023

Closes #3676

These changes suppress error logs returned when submitting a transaction already in a block, since this is a success case (see issue thread for more details).

We are unable to address the issue with esplora (#3732) and aren't able to handle errors with electrs as gracefully as I'd like (#3731). The associated followup issues will allow us to handle these errors gracefully across all clients but requires upstream PR merges/releases and for us to update our clients.

Relevant discussion from previous PR #2016 (comment)

@bradleystachurski bradleystachurski requested a review from a team as a code owner November 26, 2023 19:50
Copy link

codecov bot commented Nov 26, 2023

Codecov Report

Attention: 14 lines in your changes are missing coverage. Please review.

Comparison is base (764d772) 57.74% compared to head (fde641c) 57.71%.
Report is 70 commits behind head on master.

Files Patch % Lines
fedimint-bitcoind/src/electrum.rs 82.75% 5 Missing ⚠️
fedimint-bitcoind/src/esplora.rs 0.00% 5 Missing ⚠️
fedimint-bitcoind/src/bitcoincore.rs 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3733      +/-   ##
==========================================
- Coverage   57.74%   57.71%   -0.03%     
==========================================
  Files         192      193       +1     
  Lines       41808    41976     +168     
==========================================
+ Hits        24142    24228      +86     
- Misses      17666    17748      +82     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member Author

@bradleystachurski bradleystachurski left a comment

Choose a reason for hiding this comment

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

Added logs prior to these changes as comments to the PR instead of comments in the codebase since that seemed too cluttered.

// This is considered a success case, so we don't surface the error log.
//
// https://github.com/bitcoin/bitcoin/blob/daa56f7f665183bcce3df146f143be37f33c123e/src/rpc/protocol.h#L48
Err(JsonRpc(Rpc(e))) if e.code == -27 => (),
Copy link
Member Author

Choose a reason for hiding this comment

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

2023-11-26T19:54:48.505711Z  INFO fedimint_bitcoind::bitcoincore: Error broadcasting transaction error=JsonRpc(Rpc(RpcError { code: -27, message: "Transaction already in block chain", data: None }))

// TODO: Filter `electrs` errors using codes instead of string when available in
// `electrum-client`
// https://github.com/fedimint/fedimint/issues/3731
match error.get("message").and_then(|value| value.as_str()) {
Copy link
Member Author

Choose a reason for hiding this comment

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

2023-11-26T19:58:26.863259Z  INFO fedimint_bitcoind::electrum: Error broadcasting transaction error=Protocol(Object {"code": Number(2), "message": String("Transaction already in block chain")})

// from detecting errors for transactions already submitted.
// TODO: Suppress `esplora-client` already submitted errors when client is
// updated
// https://github.com/fedimint/fedimint/issues/3732
Copy link
Member Author

Choose a reason for hiding this comment

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

2023-11-26T19:59:21.563877Z  INFO fedimint_bitcoind::esplora: Error broadcasting transaction error=Reqwest(reqwest::Error { kind: Status(400), url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Ipv4(127.0.0.1)), port: Some(16009), path: "/tx", query: None, fragment: None } })

@dpc dpc added this pull request to the merge queue Nov 26, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 26, 2023
@dpc dpc added this pull request to the merge queue Nov 26, 2023
Merged via the queue into fedimint:master with commit 681e6cc Nov 26, 2023
20 checks passed
@bradleystachurski bradleystachurski deleted the tx-in-block branch November 26, 2023 22:32
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.

Wallet module should ignore transactions that have already been accepted in the blockchain
2 participants