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 electrum resolve_height for offchain TXs #214

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/resolvers/electrum_blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,19 @@

// Now we get and parse transaction information to get the number of
// confirmations
let tx_details = check!(self.raw_call("blockchain.transaction.get", vec![
let tx_details = match self.raw_call("blockchain.transaction.get", vec![

Check warning on line 81 in src/resolvers/electrum_blocking.rs

View check run for this annotation

Codecov / codecov/patch

src/resolvers/electrum_blocking.rs#L81

Added line #L81 was not covered by tests
Param::String(txid.to_string()),
Param::Bool(true),
]));
]) {
Err(e)
if e.to_string()
.contains("No such mempool or blockchain transaction") =>
{
return Ok(witness_anchor);

Check warning on line 89 in src/resolvers/electrum_blocking.rs

View check run for this annotation

Codecov / codecov/patch

src/resolvers/electrum_blocking.rs#L84-L89

Added lines #L84 - L89 were not covered by tests
}
Err(e) => return Err(e.to_string()),
Ok(v) => v,
};

Check warning on line 93 in src/resolvers/electrum_blocking.rs

View check run for this annotation

Codecov / codecov/patch

src/resolvers/electrum_blocking.rs#L91-L93

Added lines #L91 - L93 were not covered by tests
let forward = iter::from_fn(|| self.block_headers_pop().ok().flatten()).count() as isize;

let Some(confirmations) = tx_details.get("confirmations") else {
Expand Down
Loading