Skip to content

Allow transaction extraction from wallet #427

Closed

Description

@rajarshimaitra

We recently changed the maintain_single_recipient() function to allow_shrinking(). But allow_shrinking takes in a scriptpubkey to identify which output to shrink. One use case of allow shrinking is in bdk-cli https://github.com/bitcoindevkit/bdk-cli/blob/4fd39b7734baa515867d00f6d710c4b2084de02d/src/lib.rs#L799-L801.

IIUC, BDK doesn't have currently any public API to fetch the scriptpubkey (or the transaction) to use in allow_shrinking. It seems like an useful function to have. People might wanna get the full transaction detail specific to an ID directly from their wallet.

Creating this issue to maintain discussion on this.

Activity

  1. LLFourn commented on Aug 27, 2021

    @LLFourn
    Collaborator

    I think what you're saying is that you can't inspect the tx to find the script pubkey of the output you want to shrink?
    There is of course list_transactions but you awkwardly have to filter them to find the one you're looking for. The right solution is to be able to directly query the database yourself I think.
    I had to add this functionality to my branch of bdk for gun. See: https://github.com/LLFourn/gun/blob/40eddd9010e5e3e535f3e6e8cef4fafb8cd5316e/src/party/mod.rs#L208

    I plan for this change to make its way to main bdk eventually.

  2. rajarshimaitra commented on Aug 27, 2021

    @rajarshimaitra
    ContributorAuthor

    Yes that's exactly what I am looking for. Its little awkward to use list transactions, but it still can be done, and I can use that to handle breaking the situation in bdk-cli. Thanks for pointing that out.

    Do you think its useful to have a public API to fetch a transaction with ID directly from the wallet? I suppose it would be a very simple function, as most of the codes to do that is available, but are private to the wallet. Only question is weather we would want it in a public API.

  3. LLFourn commented on Sep 6, 2021

    @LLFourn
    Collaborator

    @rajarshimaitra Yes I think get_tx on wallet makes sense given how the wallet api already allows inspecting the database.

  4. LLFourn commented on Oct 19, 2021

    @LLFourn
    Collaborator

    This can be closed @notmandatory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions