Skip to content

Make payjoin-cli v1 / v2 features additive #500

Closed

Description

@DanGould
No description provided.

Activity

  1. spacebear21 commented on Feb 7, 2025

    @spacebear21
    Collaborator

    I tried my hand at this but it actually isn't all that straightforward.

    There are App config parameters that are unique to v1 or v2 only, but compiling with --all-features would now require all of them. Even more complicating, main.rs conditionally imports v1::App or v2::App depending on which feature is enabled, and cannot import both.

    It seems to me the payjoin-cli features really are exclusive. One workaround may be to allow compilation with --all-features and have runtime logic check which version to actually use based on which config parameters are provided (erroring if both v1-only and v2-only params are given).

  2. nothingmuch commented on Feb 7, 2025

    @nothingmuch
    Contributor

    I agree, and Idon't think that would be a workaround. See also #478, i got stuck on the same issue when trying to reduce duplication in between the App trait implementations. I haven't yet gotten back to this to give it a try but what I was considering trying doing next:

    1. make appconfig more hierarchical, and support both v1 and v2 specific options in sub-structures, that are not feature gated. also move bitcoind related stuff to its own substructure

    2. out of appconfig, generate helper stuff, again i was focused on a struct representing bitcoind (or more generally wallet) capabilities for payjoin, to avoid needing to impl the bitcoind method in the trait impls and to hide the details (e.g. error checking, psbt parsing, etc) from the actual App impls, optimizing readability to correspond high level description of the spec

    3. adding an explicit --prefer-bip-78 or option, or something similar, for payjoin-cli compiled with both. due to the backwards compatibility of bip77 that probably requires more than one flag or something that is not just boolean valued, e.g. as a sender be able to send bip78 only even to a bip77 receiver and even if v2 support is compiled can be useful for e2e testing with a single build

    my goal was making sure both app/v{1,2}.rs kind of give a high level overview of both the protocol and the code, de-emphasizing the details like how to talk to bitcoind and emphasizing its role as a reference implementation for bip 77 specifically.

  3. DanGould commented on Feb 13, 2025

    @DanGould
    MemberAuthor

    make appconfig more hierarchical, and support both v1 and v2 specific options in sub-structures, that are not feature gated

    emphasis my own. Why not feature gated in the config? So AppConfig can be totally shared? That requires moving the OhttpKeys parsing to the App structure or otherwise always depending on payjoin/v2 since OhttpKeys is feature gated.

  4. added a commit that references this issue on Feb 25, 2025
    8777c16
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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions