#1586 select_relay axis
move OHTTP-relay choice into the payjoin crate as a minimal primitive now (breaking), with a hinge so the AS-aware selection of #919/ #1514 plugs in additively in 1.1 (non-breaking).
integrations diverges today (#1586 (comment))
| wallet |
relay selection now |
converges? |
RelaySelector |
shared selection fn over the caller's list: uniform-random over non-failed + relay-scoped failover |
target |
| Liana |
single relay (user-config) |
❌ (list, 1 relay, no rotation) |
| payjoin-cli |
random at bootstrap, cached per session (RelayManager) |
❌ (fixable) |
| ldk-node |
user list, walk from random start (relay_order) |
❌ (fixable) |
| Cake |
built-in 3-list, random per poll |
❌ (fixable) |
| BBM |
same 3-list, shuffle once, in-order |
❌ (fixable) |
| Boltz |
single relay (hardcoded) |
❌ (list, hardcoded) |
target is the shared select() call: today the body is uniform-random over non-failed relays; #919/#1514 fills SelectContext (key-derived, AS-aware, POST/POLL split, ~30s windows, self-AS, dir-AS, role) additively in 1.1, so the call site never changes. failure-tracking stays.
proposed API:
// payjoin::relay
#[non_exhaustive]
pub struct SelectContext {} // empty = uniform random; #919 adds
impl SelectContext { pub fn random() -> Self }
pub struct RelaySelector { /* relays + failed */ }
impl RelaySelector {
pub fn new(relays: Vec<Url>) -> Self;
pub fn select<R: Rng>(&self, ctx: &SelectContext, rng: &mut R) -> Option<Url>;
pub fn mark_failed(&mut self, relay: &Url);
}
// breaking: was (relay, dir) -> OhttpKeys
fetch_ohttp_keys(relays: &[Url], dir) -> (OhttpKeys, Url)
payjoin-cli drops its RelayManager, select() sig never changes, #919 fills SelectContext (request kind,
time window, receiver key) as private fields, and the asmap data arrives via a new constructor on the selector
part of #1586
sounds good?
#1586
select_relayaxismove OHTTP-relay choice into the payjoin crate as a minimal primitive now (breaking), with a hinge so the AS-aware selection of #919/ #1514 plugs in additively in 1.1 (non-breaking).
integrations diverges today (#1586 (comment))
RelaySelectorRelayManager)relay_order)target is the shared
select()call: today the body is uniform-random over non-failed relays; #919/#1514 fillsSelectContext(key-derived, AS-aware, POST/POLL split, ~30s windows, self-AS, dir-AS, role) additively in 1.1, so the call site never changes. failure-tracking stays.proposed API:
payjoin-clidrops itsRelayManager,select()sig never changes, #919 fillsSelectContext(request kind,time window, receiver key) as private fields, and the asmap data arrives via a new constructor on the selector
part of #1586
sounds good?