From 98ccbcc44d1525d148f9d268f6688fa42635dd6c Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Fri, 2 Sep 2022 15:41:44 -0400 Subject: [PATCH] Conditionally advertise OM support in InitFeatures Based on whether the PeerManager's OnionMessageHandler supports forwarding --- lightning/src/ln/features.rs | 6 ++++++ lightning/src/ln/peer_handler.rs | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lightning/src/ln/features.rs b/lightning/src/ln/features.rs index 1d971d76019..755fa5cecaf 100644 --- a/lightning/src/ln/features.rs +++ b/lightning/src/ln/features.rs @@ -548,6 +548,12 @@ impl InitFeatures { pub(crate) fn to_context(&self) -> Features { self.to_context_internal() } + + pub(crate) fn known_without_onion_messages() -> Self { + let mut features = Self::known(); + features.flags[4] &= 0b00111111; + features + } } impl InvoiceFeatures { diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index a09cc158ff3..179d4076e9f 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -1033,7 +1033,8 @@ impl