Update API for writeable async offer cache to be bytes
What changed, and why it matters
This is a small API refactor in a Lightning network library. It changes one internal persistence helper from returning a generic 'writeable' object to returning raw bytes, so it can be more easily used across language bindings. There is no direct evidence this fixes a security vulnerability.
No immediate security action required. Treat as a normal API/serialization refactor. If auditing, verify that the new `WithoutLength` serialization remains backward-compatible or properly version-gated during persistence deserialization.
Security signals we found
Serialization format change for persisted state
API signature change from `impl Writeable` to `Vec<u8>`
Use of `WithoutLength` wrapper in TLV serialization
Evidence from the diff
The commit modifies ChannelManager::write to persist self.flow.writeable_async_receive_offer_cache() wrapped in WithoutLength(...), and changes Flow::writeable_async_receive_offer_cache to return Vec<u8> instead of impl Writeable + '_. The stated reason is compatibility with language bindings. The change removes a length prefix from the serialized field in ChannelManager’s TLV stream by using WithoutLength, because the underlying value is now already encoded as bytes. This is a serialization/API adjustment, not a patch for a disclosed vulnerability.
Changed components
lightning/src/ln/channelmanager.rslightning/src/offers/flow.rsInspect captured patch +4 / −4
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index fa584dd..923632a 100644
--- a/lightning/src/ln/channelmanager.rs
+++ b/lightning/src/ln/channelmanager.rs
@@ -130,7 +130,7 @@ use crate::util::logger::{Level, Logger, WithContext};
use crate::util::scid_utils::fake_scid;
use crate::util::ser::{
BigSize, FixedLengthReader, LengthReadable, MaybeReadable, Readable, ReadableArgs, VecWriter,
- Writeable, Writer,
+ WithoutLength, Writeable, Writer,
};
use crate::util::wakers::{Future, Notifier};
@@ -15248,7 +15248,7 @@ where
(15, self.inbound_payment_id_secret, required),
(17, in_flight_monitor_updates, option),
(19, peer_storage_dir, optional_vec),
- (21, self.flow.writeable_async_receive_offer_cache(), required),
+ (21, WithoutLength(&self.flow.writeable_async_receive_offer_cache()), required),
});
Ok(())
diff --git a/lightning/src/offers/flow.rs b/lightning/src/offers/flow.rs
index dde7d58..6bc9f3c 100644
--- a/lightning/src/offers/flow.rs
+++ b/lightning/src/offers/flow.rs
@@ -1657,8 +1657,8 @@ where
cache.static_invoice_persisted(context, self.duration_since_epoch())
}
- /// Get the [`AsyncReceiveOfferCache`] for persistence.
- pub fn writeable_async_receive_offer_cache(&self) -> impl Writeable + '_ {
+ /// Get the encoded [`AsyncReceiveOfferCache`] for persistence.
+ pub fn writeable_async_receive_offer_cache(&self) -> Vec<u8> {
self.async_receive_offer_cache.encode()
}
}
Why this scored 17/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.