From db7e69667303fb4ba8c2ae6e792d09442260d7ad Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Wed, 24 Apr 2024 13:59:01 -0500 Subject: [PATCH] Don't require Refund::description in API Refunds currently require a description, though this may change to be optional. Remove the description requirement from the API, setting and empty string by default. --- lightning/src/ln/channelmanager.rs | 10 ++-- lightning/src/ln/offers_tests.rs | 30 ++++------- lightning/src/offers/invoice.rs | 12 ++--- lightning/src/offers/refund.rs | 81 ++++++++++++++++-------------- 4 files changed, 64 insertions(+), 69 deletions(-) diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index e05a3ba46..c9f431b0e 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -1658,13 +1658,13 @@ where /// let payment_id = PaymentId([42; 32]); /// let refund = channel_manager /// .create_refund_builder( -/// "coffee".to_string(), amount_msats, absolute_expiry, payment_id, retry, -/// max_total_routing_fee_msat +/// amount_msats, absolute_expiry, payment_id, retry, max_total_routing_fee_msat /// )? /// # ; /// # // Needed for compiling for c_bindings /// # let builder: lightning::offers::refund::RefundBuilder<_> = refund.into(); /// # let refund = builder +/// .description("coffee".to_string()) /// .payer_note("refund for order 1234".to_string()) /// .build()?; /// let bech32_refund = refund.to_string(); @@ -8621,8 +8621,8 @@ macro_rules! create_refund_builder { ($self: ident, $builder: ty) => { /// [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths /// [Avoiding Duplicate Payments]: #avoiding-duplicate-payments pub fn create_refund_builder( - &$self, description: String, amount_msats: u64, absolute_expiry: Duration, - payment_id: PaymentId, retry_strategy: Retry, max_total_routing_fee_msat: Option + &$self, amount_msats: u64, absolute_expiry: Duration, payment_id: PaymentId, + retry_strategy: Retry, max_total_routing_fee_msat: Option ) -> Result<$builder, Bolt12SemanticError> { let node_id = $self.get_our_node_id(); let expanded_key = &$self.inbound_payment_key; @@ -8631,7 +8631,7 @@ macro_rules! create_refund_builder { ($self: ident, $builder: ty) => { let path = $self.create_blinded_path().map_err(|_| Bolt12SemanticError::MissingPaths)?; let builder = RefundBuilder::deriving_payer_id( - description, node_id, expanded_key, entropy, secp_ctx, amount_msats, payment_id + node_id, expanded_key, entropy, secp_ctx, amount_msats, payment_id )? .chain_hash($self.chain_hash) .absolute_expiry(absolute_expiry) diff --git a/lightning/src/ln/offers_tests.rs b/lightning/src/ln/offers_tests.rs index b36e9de39..24ff1c25c 100644 --- a/lightning/src/ln/offers_tests.rs +++ b/lightning/src/ln/offers_tests.rs @@ -484,9 +484,7 @@ fn creates_and_pays_for_refund_using_two_hop_blinded_path() { let absolute_expiry = Duration::from_secs(u64::MAX); let payment_id = PaymentId([1; 32]); let refund = david.node - .create_refund_builder( - "refund".to_string(), 10_000_000, absolute_expiry, payment_id, Retry::Attempts(0), None - ) + .create_refund_builder(10_000_000, absolute_expiry, payment_id, Retry::Attempts(0), None) .unwrap() .build().unwrap(); assert_eq!(refund.amount_msats(), 10_000_000); @@ -613,9 +611,7 @@ fn creates_and_pays_for_refund_using_one_hop_blinded_path() { let absolute_expiry = Duration::from_secs(u64::MAX); let payment_id = PaymentId([1; 32]); let refund = bob.node - .create_refund_builder( - "refund".to_string(), 10_000_000, absolute_expiry, payment_id, Retry::Attempts(0), None - ) + .create_refund_builder(10_000_000, absolute_expiry, payment_id, Retry::Attempts(0), None) .unwrap() .build().unwrap(); assert_eq!(refund.amount_msats(), 10_000_000); @@ -724,9 +720,7 @@ fn pays_for_refund_without_blinded_paths() { let absolute_expiry = Duration::from_secs(u64::MAX); let payment_id = PaymentId([1; 32]); let refund = bob.node - .create_refund_builder( - "refund".to_string(), 10_000_000, absolute_expiry, payment_id, Retry::Attempts(0), None - ) + .create_refund_builder(10_000_000, absolute_expiry, payment_id, Retry::Attempts(0), None) .unwrap() .clear_paths() .build().unwrap(); @@ -780,7 +774,7 @@ fn fails_creating_refund_without_blinded_paths() { let payment_id = PaymentId([1; 32]); match nodes[0].node.create_refund_builder( - "refund".to_string(), 10_000, absolute_expiry, payment_id, Retry::Attempts(0), None + 10_000, absolute_expiry, payment_id, Retry::Attempts(0), None ) { Ok(_) => panic!("Expected error"), Err(e) => assert_eq!(e, Bolt12SemanticError::MissingPaths), @@ -831,9 +825,7 @@ fn fails_sending_invoice_with_unsupported_chain_for_refund() { let absolute_expiry = Duration::from_secs(u64::MAX); let payment_id = PaymentId([1; 32]); let refund = bob.node - .create_refund_builder( - "refund".to_string(), 10_000_000, absolute_expiry, payment_id, Retry::Attempts(0), None - ) + .create_refund_builder(10_000_000, absolute_expiry, payment_id, Retry::Attempts(0), None) .unwrap() .chain(Network::Signet) .build().unwrap(); @@ -932,13 +924,13 @@ fn fails_creating_refund_with_duplicate_payment_id() { let payment_id = PaymentId([1; 32]); assert!( nodes[0].node.create_refund_builder( - "refund".to_string(), 10_000, absolute_expiry, payment_id, Retry::Attempts(0), None + 10_000, absolute_expiry, payment_id, Retry::Attempts(0), None ).is_ok() ); expect_recent_payment!(nodes[0], RecentPaymentDetails::AwaitingInvoice, payment_id); match nodes[0].node.create_refund_builder( - "refund".to_string(), 10_000, absolute_expiry, payment_id, Retry::Attempts(0), None + 10_000, absolute_expiry, payment_id, Retry::Attempts(0), None ) { Ok(_) => panic!("Expected error"), Err(e) => assert_eq!(e, Bolt12SemanticError::DuplicatePaymentId), @@ -1049,9 +1041,7 @@ fn fails_sending_invoice_without_blinded_payment_paths_for_refund() { let absolute_expiry = Duration::from_secs(u64::MAX); let payment_id = PaymentId([1; 32]); let refund = david.node - .create_refund_builder( - "refund".to_string(), 10_000_000, absolute_expiry, payment_id, Retry::Attempts(0), None - ) + .create_refund_builder(10_000_000, absolute_expiry, payment_id, Retry::Attempts(0), None) .unwrap() .build().unwrap(); @@ -1100,9 +1090,7 @@ fn fails_paying_invoice_more_than_once() { let absolute_expiry = Duration::from_secs(u64::MAX); let payment_id = PaymentId([1; 32]); let refund = david.node - .create_refund_builder( - "refund".to_string(), 10_000_000, absolute_expiry, payment_id, Retry::Attempts(0), None - ) + .create_refund_builder(10_000_000, absolute_expiry, payment_id, Retry::Attempts(0), None) .unwrap() .build().unwrap(); expect_recent_payment!(david, RecentPaymentDetails::AwaitingInvoice, payment_id); diff --git a/lightning/src/offers/invoice.rs b/lightning/src/offers/invoice.rs index 647da4c4f..d2e2eecde 100644 --- a/lightning/src/offers/invoice.rs +++ b/lightning/src/offers/invoice.rs @@ -1673,7 +1673,7 @@ mod tests { let payment_paths = payment_paths(); let payment_hash = payment_hash(); let now = now(); - let invoice = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let invoice = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .build().unwrap() .respond_with_no_std(payment_paths.clone(), payment_hash, recipient_pubkey(), now) .unwrap() @@ -1688,7 +1688,7 @@ mod tests { assert_eq!(invoice.offer_chains(), None); assert_eq!(invoice.metadata(), None); assert_eq!(invoice.amount(), None); - assert_eq!(invoice.description(), PrintableString("foo")); + assert_eq!(invoice.description(), PrintableString("")); assert_eq!(invoice.offer_features(), None); assert_eq!(invoice.absolute_expiry(), None); assert_eq!(invoice.message_paths(), &[]); @@ -1724,7 +1724,7 @@ mod tests { metadata: None, currency: None, amount: None, - description: Some(&String::from("foo")), + description: Some(&String::from("")), features: None, absolute_expiry: None, paths: None, @@ -1803,7 +1803,7 @@ mod tests { let future_expiry = Duration::from_secs(u64::max_value()); let past_expiry = Duration::from_secs(0); - if let Err(e) = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + if let Err(e) = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .absolute_expiry(future_expiry) .build().unwrap() .respond_with(payment_paths(), payment_hash(), recipient_pubkey()) @@ -1813,7 +1813,7 @@ mod tests { panic!("error building invoice: {:?}", e); } - match RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + match RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .absolute_expiry(past_expiry) .build().unwrap() .respond_with(payment_paths(), payment_hash(), recipient_pubkey()) @@ -1887,7 +1887,7 @@ mod tests { let entropy = FixedEntropy {}; let secp_ctx = Secp256k1::new(); - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .build().unwrap(); if let Err(e) = refund diff --git a/lightning/src/offers/refund.rs b/lightning/src/offers/refund.rs index f9aa90ba0..bcbab0fd0 100644 --- a/lightning/src/offers/refund.rs +++ b/lightning/src/offers/refund.rs @@ -48,7 +48,8 @@ //! let pubkey = PublicKey::from(keys); //! //! let expiration = SystemTime::now() + Duration::from_secs(24 * 60 * 60); -//! let refund = RefundBuilder::new("coffee, large".to_string(), vec![1; 32], pubkey, 20_000)? +//! let refund = RefundBuilder::new(vec![1; 32], pubkey, 20_000)? +//! .description("coffee, large".to_string()) //! .absolute_expiry(expiration.duration_since(SystemTime::UNIX_EPOCH).unwrap()) //! .issuer("Foo Bar".to_string()) //! .path(create_blinded_path()) @@ -149,8 +150,8 @@ macro_rules! refund_explicit_metadata_builder_methods { () => { /// Creates a new builder for a refund using the [`Refund::payer_id`] for the public node id to /// send to if no [`Refund::paths`] are set. Otherwise, it may be a transient pubkey. /// - /// Additionally, sets the required [`Refund::description`], [`Refund::payer_metadata`], and - /// [`Refund::amount_msats`]. + /// Additionally, sets the required (empty) [`Refund::description`], [`Refund::payer_metadata`], + /// and [`Refund::amount_msats`]. /// /// # Note /// @@ -160,7 +161,7 @@ macro_rules! refund_explicit_metadata_builder_methods { () => { /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager /// [`ChannelManager::create_refund_builder`]: crate::ln::channelmanager::ChannelManager::create_refund_builder pub fn new( - description: String, metadata: Vec, payer_id: PublicKey, amount_msats: u64 + metadata: Vec, payer_id: PublicKey, amount_msats: u64 ) -> Result { if amount_msats > MAX_VALUE_MSAT { return Err(Bolt12SemanticError::InvalidAmount); @@ -169,8 +170,8 @@ macro_rules! refund_explicit_metadata_builder_methods { () => { let metadata = Metadata::Bytes(metadata); Ok(Self { refund: RefundContents { - payer: PayerContents(metadata), description, absolute_expiry: None, issuer: None, - chain: None, amount_msats, features: InvoiceRequestFeatures::empty(), + payer: PayerContents(metadata), description: String::new(), absolute_expiry: None, + issuer: None, chain: None, amount_msats, features: InvoiceRequestFeatures::empty(), quantity: None, payer_id, payer_note: None, paths: None, }, secp_ctx: None, @@ -195,7 +196,7 @@ macro_rules! refund_builder_methods { ( /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest /// [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey pub fn deriving_payer_id( - description: String, node_id: PublicKey, expanded_key: &ExpandedKey, entropy_source: ES, + node_id: PublicKey, expanded_key: &ExpandedKey, entropy_source: ES, secp_ctx: &'a Secp256k1<$secp_context>, amount_msats: u64, payment_id: PaymentId ) -> Result where ES::Target: EntropySource { if amount_msats > MAX_VALUE_MSAT { @@ -208,14 +209,22 @@ macro_rules! refund_builder_methods { ( let metadata = Metadata::DerivedSigningPubkey(derivation_material); Ok(Self { refund: RefundContents { - payer: PayerContents(metadata), description, absolute_expiry: None, issuer: None, - chain: None, amount_msats, features: InvoiceRequestFeatures::empty(), + payer: PayerContents(metadata), description: String::new(), absolute_expiry: None, + issuer: None, chain: None, amount_msats, features: InvoiceRequestFeatures::empty(), quantity: None, payer_id: node_id, payer_note: None, paths: None, }, secp_ctx: Some(secp_ctx), }) } + /// Sets the [`Refund::description`]. + /// + /// Successive calls to this method will override the previous setting. + pub fn description($($self_mut)* $self: $self_type, description: String) -> $return_type { + $self.refund.description = description; + $return_value + } + /// Sets the [`Refund::absolute_expiry`] as seconds since the Unix epoch. Any expiry that has /// already passed is valid and can be checked for using [`Refund::is_expired`]. /// @@ -944,7 +953,7 @@ mod tests { #[test] fn builds_refund_with_defaults() { - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .build().unwrap(); let mut buffer = Vec::new(); @@ -952,7 +961,7 @@ mod tests { assert_eq!(refund.bytes, buffer.as_slice()); assert_eq!(refund.payer_metadata(), &[1; 32]); - assert_eq!(refund.description(), PrintableString("foo")); + assert_eq!(refund.description(), PrintableString("")); assert_eq!(refund.absolute_expiry(), None); #[cfg(feature = "std")] assert!(!refund.is_expired()); @@ -973,7 +982,7 @@ mod tests { metadata: None, currency: None, amount: None, - description: Some(&String::from("foo")), + description: Some(&String::from("")), features: None, absolute_expiry: None, paths: None, @@ -1000,7 +1009,7 @@ mod tests { #[test] fn fails_building_refund_with_invalid_amount() { - match RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), MAX_VALUE_MSAT + 1) { + match RefundBuilder::new(vec![1; 32], payer_pubkey(), MAX_VALUE_MSAT + 1) { Ok(_) => panic!("expected error"), Err(e) => assert_eq!(e, Bolt12SemanticError::InvalidAmount), } @@ -1008,7 +1017,6 @@ mod tests { #[test] fn builds_refund_with_metadata_derived() { - let desc = "foo".to_string(); let node_id = payer_pubkey(); let expanded_key = ExpandedKey::new(&KeyMaterial([42; 32])); let entropy = FixedEntropy {}; @@ -1016,7 +1024,7 @@ mod tests { let payment_id = PaymentId([1; 32]); let refund = RefundBuilder - ::deriving_payer_id(desc, node_id, &expanded_key, &entropy, &secp_ctx, 1000, payment_id) + ::deriving_payer_id(node_id, &expanded_key, &entropy, &secp_ctx, 1000, payment_id) .unwrap() .build().unwrap(); assert_eq!(refund.payer_id(), node_id); @@ -1063,7 +1071,6 @@ mod tests { #[test] fn builds_refund_with_derived_payer_id() { - let desc = "foo".to_string(); let node_id = payer_pubkey(); let expanded_key = ExpandedKey::new(&KeyMaterial([42; 32])); let entropy = FixedEntropy {}; @@ -1080,7 +1087,7 @@ mod tests { }; let refund = RefundBuilder - ::deriving_payer_id(desc, node_id, &expanded_key, &entropy, &secp_ctx, 1000, payment_id) + ::deriving_payer_id(node_id, &expanded_key, &entropy, &secp_ctx, 1000, payment_id) .unwrap() .path(blinded_path) .build().unwrap(); @@ -1132,7 +1139,7 @@ mod tests { let past_expiry = Duration::from_secs(0); let now = future_expiry - Duration::from_secs(1_000); - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .absolute_expiry(future_expiry) .build() .unwrap(); @@ -1143,7 +1150,7 @@ mod tests { assert_eq!(refund.absolute_expiry(), Some(future_expiry)); assert_eq!(tlv_stream.absolute_expiry, Some(future_expiry.as_secs())); - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .absolute_expiry(future_expiry) .absolute_expiry(past_expiry) .build() @@ -1177,7 +1184,7 @@ mod tests { }, ]; - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .path(paths[0].clone()) .path(paths[1].clone()) .build() @@ -1192,7 +1199,7 @@ mod tests { #[test] fn builds_refund_with_issuer() { - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .issuer("bar".into()) .build() .unwrap(); @@ -1200,7 +1207,7 @@ mod tests { assert_eq!(refund.issuer(), Some(PrintableString("bar"))); assert_eq!(tlv_stream.issuer, Some(&String::from("bar"))); - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .issuer("bar".into()) .issuer("baz".into()) .build() @@ -1215,21 +1222,21 @@ mod tests { let mainnet = ChainHash::using_genesis_block(Network::Bitcoin); let testnet = ChainHash::using_genesis_block(Network::Testnet); - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .chain(Network::Bitcoin) .build().unwrap(); let (_, _, tlv_stream) = refund.as_tlv_stream(); assert_eq!(refund.chain(), mainnet); assert_eq!(tlv_stream.chain, None); - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .chain(Network::Testnet) .build().unwrap(); let (_, _, tlv_stream) = refund.as_tlv_stream(); assert_eq!(refund.chain(), testnet); assert_eq!(tlv_stream.chain, Some(&testnet)); - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .chain(Network::Regtest) .chain(Network::Testnet) .build().unwrap(); @@ -1240,14 +1247,14 @@ mod tests { #[test] fn builds_refund_with_quantity() { - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .quantity(10) .build().unwrap(); let (_, _, tlv_stream) = refund.as_tlv_stream(); assert_eq!(refund.quantity(), Some(10)); assert_eq!(tlv_stream.quantity, Some(10)); - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .quantity(10) .quantity(1) .build().unwrap(); @@ -1258,14 +1265,14 @@ mod tests { #[test] fn builds_refund_with_payer_note() { - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .payer_note("bar".into()) .build().unwrap(); let (_, _, tlv_stream) = refund.as_tlv_stream(); assert_eq!(refund.payer_note(), Some(PrintableString("bar"))); assert_eq!(tlv_stream.payer_note, Some(&String::from("bar"))); - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .payer_note("bar".into()) .payer_note("baz".into()) .build().unwrap(); @@ -1276,7 +1283,7 @@ mod tests { #[test] fn fails_responding_with_unknown_required_features() { - match RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + match RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .features_unchecked(InvoiceRequestFeatures::unknown()) .build().unwrap() .respond_with_no_std(payment_paths(), payment_hash(), recipient_pubkey(), now()) @@ -1288,7 +1295,7 @@ mod tests { #[test] fn parses_refund_with_metadata() { - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .build().unwrap(); if let Err(e) = refund.to_string().parse::() { panic!("error parsing refund: {:?}", e); @@ -1307,7 +1314,7 @@ mod tests { #[test] fn parses_refund_with_description() { - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .build().unwrap(); if let Err(e) = refund.to_string().parse::() { panic!("error parsing refund: {:?}", e); @@ -1326,7 +1333,7 @@ mod tests { #[test] fn parses_refund_with_amount() { - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .build().unwrap(); if let Err(e) = refund.to_string().parse::() { panic!("error parsing refund: {:?}", e); @@ -1355,7 +1362,7 @@ mod tests { #[test] fn parses_refund_with_payer_id() { - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .build().unwrap(); if let Err(e) = refund.to_string().parse::() { panic!("error parsing refund: {:?}", e); @@ -1394,7 +1401,7 @@ mod tests { }, ]; - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .absolute_expiry(past_expiry) .issuer("bar".into()) .path(paths[0].clone()) @@ -1423,7 +1430,7 @@ mod tests { #[test] fn fails_parsing_refund_with_unexpected_fields() { - let refund = RefundBuilder::new("foo".into(), vec![1; 32], payer_pubkey(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], payer_pubkey(), 1000).unwrap() .build().unwrap(); if let Err(e) = refund.to_string().parse::() { panic!("error parsing refund: {:?}", e); @@ -1499,7 +1506,7 @@ mod tests { fn fails_parsing_refund_with_extra_tlv_records() { let secp_ctx = Secp256k1::new(); let keys = KeyPair::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32]).unwrap()); - let refund = RefundBuilder::new("foo".into(), vec![1; 32], keys.public_key(), 1000).unwrap() + let refund = RefundBuilder::new(vec![1; 32], keys.public_key(), 1000).unwrap() .build().unwrap(); let mut encoded_refund = Vec::new(); -- 2.39.5