Fix BOLT 12 invoice doctests to work with no-std
authorJeffrey Czyz <jkczyz@gmail.com>
Tue, 31 Jan 2023 18:52:08 +0000 (12:52 -0600)
committerJeffrey Czyz <jkczyz@gmail.com>
Fri, 3 Feb 2023 21:14:58 +0000 (15:14 -0600)
lightning/src/offers/invoice.rs

index f423677fbc9dae50568a0d7b3569d0e261db16ab..f82544913ed791753b224045490c30e3187b8a7a 100644 (file)
 //!
 //! // Invoice for the "offer to be paid" flow.
 //! InvoiceRequest::try_from(bytes)?
-//!     .respond_with(payment_paths, payment_hash)?
+#![cfg_attr(feature = "std", doc = "
+    .respond_with(payment_paths, payment_hash)?
+")]
+#![cfg_attr(not(feature = "std"), doc = "
+    .respond_with(payment_paths, payment_hash, core::time::Duration::from_secs(0))?
+")]
 //!     .relative_expiry(3600)
 //!     .allow_mpp()
 //!     .fallback_v0_p2wpkh(&wpubkey_hash)
 //! // Invoice for the "offer for money" flow.
 //! "lnr1qcp4256ypq"
 //!     .parse::<Refund>()?
-//!     .respond_with(payment_paths, payment_hash, pubkey)?
+#![cfg_attr(feature = "std", doc = "
+    .respond_with(payment_paths, payment_hash, pubkey)?
+")]
+#![cfg_attr(not(feature = "std"), doc = "
+    .respond_with(payment_paths, payment_hash, pubkey, core::time::Duration::from_secs(0))?
+")]
 //!     .relative_expiry(3600)
 //!     .allow_mpp()
 //!     .fallback_v0_p2wpkh(&wpubkey_hash)