You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
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:
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
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
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.
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.
Activity
Organize feature separation for ergonomics (#501)
spacebear21 commentedon Feb 7, 2025
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-featureswould now require all of them. Even more complicating,main.rsconditionally importsv1::Apporv2::Appdepending 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-featuresand 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).nothingmuch commentedon Feb 7, 2025
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:
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
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
bitcoindmethod 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 specadding 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.
DanGould commentedon Feb 13, 2025
emphasis my own. Why not feature gated in the config? So
AppConfigcan be totally shared? That requires moving theOhttpKeysparsing to theAppstructure or otherwise always depending onpayjoin/v2sinceOhttpKeysis feature gated.Make payjoin-cli v1 / v2 features additive (#538)