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

proof of concept: implement cancel_tx #1764

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ValuedMammal
Copy link
Contributor

@ValuedMammal ValuedMammal commented Dec 8, 2024

Description

This is not a merge candidate. The goal of this PR is implement cancel_tx, as doing so has the potential to fix a long-standing TODO in the library saying "make this free up reserved utxos when that's implemented". This was initiated in response to user feedback claiming that the method has no effect.

issue #1743

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

Copy link

@ErikDeSmedt ErikDeSmedt left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this.

I'm not very familiar with the BDK-codebase but I am happy to see where this is going

Canceled,
/// new details added. note, when applied this will overwrite existing
Details(Details),
}

Choose a reason for hiding this comment

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

I don't really understand the design of this enum.

What is the difference between Record::Canceled and Record::Details { canceled: true}.
Why are both structs required?

@@ -44,6 +44,95 @@ const P2WPKH_FAKE_WITNESS_SIZE: usize = 106;

const DB_MAGIC: &[u8] = &[0x21, 0x24, 0x48];

#[test]
fn cancel_tx_frees_spent_inputs() -> anyhow::Result<()> {

Choose a reason for hiding this comment

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

Nice, this test behaves exactly as I would expect

@evanlinjin
Copy link
Member

@ValuedMammal could you further elaborate on the goals of this PR? Thanks!

@ValuedMammal ValuedMammal changed the title proof of concept: cancel_tx + tx details proof of concept: implement cancel_tx Dec 11, 2024
@buffrr
Copy link

buffrr commented Dec 18, 2024

Even after PR #1765, I think cancel_tx would still be needed for different reasons. If a transaction gets dropped from the mempool but persisted in the wallet as unconfirmed, we need a way to handle it - otherwise it would stay as unconfirmed in the wallet db forever, right? Users would have no choice but to rescan their wallet (I guess they could try to rebroadcast or bump the fee)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants