Skip to content

Commit 9b304ac

Browse files
Move Payee::Blinded from a tuple to a struct enum variant
1 parent ab08af1 commit 9b304ac

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lightning/src/routing/router.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ impl Writeable for PaymentParameters {
545545
let mut blinded_hints = &vec![];
546546
match &self.payee {
547547
Payee::Clear { route_hints, .. } => clear_hints = route_hints,
548-
Payee::Blinded(hints) => blinded_hints = hints,
548+
Payee::Blinded { route_hints } => blinded_hints = route_hints,
549549
}
550550
write_tlv_fields!(writer, {
551551
(0, self.payee.node_id(), option),
@@ -581,7 +581,7 @@ impl ReadableArgs<u32> for PaymentParameters {
581581
let blinded_route_hints = blinded_route_hints.unwrap_or(vec![]);
582582
let payee = if blinded_route_hints.len() != 0 {
583583
if clear_route_hints.len() != 0 || payee_pubkey.is_some() { return Err(DecodeError::InvalidValue) }
584-
Payee::Blinded(blinded_route_hints)
584+
Payee::Blinded { route_hints: blinded_route_hints }
585585
} else {
586586
Payee::Clear {
587587
route_hints: clear_route_hints,
@@ -633,7 +633,7 @@ impl PaymentParameters {
633633
///
634634
/// This is not exported to bindings users since bindings don't support move semantics
635635
pub fn with_bolt11_features(self, features: InvoiceFeatures) -> Result<Self, ()> {
636-
if let Payee::Blinded(_) = self.payee { return Err(()) }
636+
if let Payee::Blinded { .. } = self.payee { return Err(()) }
637637
Ok(Self { features: Some(features), ..self })
638638
}
639639

@@ -643,7 +643,7 @@ impl PaymentParameters {
643643
/// This is not exported to bindings users since bindings don't support move semantics
644644
pub fn with_route_hints(self, route_hints: Vec<RouteHint>) -> Result<Self, ()> {
645645
match self.payee {
646-
Payee::Blinded(_) => Err(()),
646+
Payee::Blinded { .. } => Err(()),
647647
Payee::Clear { node_id, .. } =>
648648
Ok(Self { payee: Payee::Clear { route_hints, node_id }, ..self })
649649
}
@@ -684,7 +684,11 @@ impl PaymentParameters {
684684
pub enum Payee {
685685
/// The recipient provided blinded paths and payinfo to reach them. The blinded paths themselves
686686
/// will be included in the final [`Route`].
687-
Blinded(Vec<(BlindedPayInfo, BlindedPath)>),
687+
Blinded {
688+
/// Aggregated routing info and blinded paths, for routing to the payee without knowing their
689+
/// node id.
690+
route_hints: Vec<(BlindedPayInfo, BlindedPath)>,
691+
},
688692
/// The recipient included these route hints in their BOLT11 invoice.
689693
Clear {
690694
/// The node id of the payee.

0 commit comments

Comments
 (0)