Invoice request parsing tests
[rust-lightning] / lightning / src / offers / offer.rs
index d890ab3f642cfb14fffe70f843b3086f8688fdcb..680f4094162ff49021bd47f1a705ff6f154cb375 100644 (file)
@@ -145,7 +145,7 @@ impl OfferBuilder {
        /// Sets the [`Offer::amount`].
        ///
        /// Successive calls to this method will override the previous setting.
-       fn amount(mut self, amount: Amount) -> Self {
+       pub(super) fn amount(mut self, amount: Amount) -> Self {
                self.offer.amount = Some(amount);
                self
        }
@@ -220,6 +220,13 @@ impl OfferBuilder {
                self.offer.features = features;
                self
        }
+
+       pub(super) fn build_unchecked(self) -> Offer {
+               let mut bytes = Vec::new();
+               self.offer.write(&mut bytes).unwrap();
+
+               Offer { bytes, contents: self.offer }
+       }
 }
 
 /// An `Offer` is a potentially long-lived proposal for payment of a good or service.
@@ -379,7 +386,7 @@ impl Offer {
        }
 
        #[cfg(test)]
-       fn as_tlv_stream(&self) -> OfferTlvStreamRef {
+       pub(super) fn as_tlv_stream(&self) -> OfferTlvStreamRef {
                self.contents.as_tlv_stream()
        }
 }