Skip to content

Commit 519ec01

Browse files
committed
f - separate impl block for unchecked test-only methods
1 parent 4157cc0 commit 519ec01

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

lightning/src/offers/invoice_request.rs

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,6 @@ impl<'a> InvoiceRequestBuilder<'a> {
107107
Ok(self)
108108
}
109109

110-
#[cfg(test)]
111-
fn chain_unchecked(mut self, network: Network) -> Self {
112-
let chain = ChainHash::using_genesis_block(network);
113-
self.invoice_request.chain = Some(chain);
114-
self
115-
}
116-
117110
/// Sets the [`InvoiceRequest::amount_msats`] for paying an invoice. Errors if `amount_msats` is
118111
/// not at least the expected invoice amount (i.e., [`Offer::amount`] times [`quantity`]).
119112
///
@@ -128,12 +121,6 @@ impl<'a> InvoiceRequestBuilder<'a> {
128121
Ok(self)
129122
}
130123

131-
#[cfg(test)]
132-
fn amount_msats_unchecked(mut self, amount_msats: u64) -> Self {
133-
self.invoice_request.amount_msats = Some(amount_msats);
134-
self
135-
}
136-
137124
/// Sets the [`InvoiceRequest::features`].
138125
///
139126
/// Successive calls to this method will override the previous setting.
@@ -153,12 +140,6 @@ impl<'a> InvoiceRequestBuilder<'a> {
153140
Ok(self)
154141
}
155142

156-
#[cfg(test)]
157-
fn quantity_unchecked(mut self, quantity: u64) -> Self {
158-
self.invoice_request.quantity = Some(quantity);
159-
self
160-
}
161-
162143
/// Sets the [`InvoiceRequest::payer_note`].
163144
///
164145
/// Successive calls to this method will override the previous setting.
@@ -197,8 +178,26 @@ impl<'a> InvoiceRequestBuilder<'a> {
197178
let InvoiceRequestBuilder { offer, invoice_request } = self;
198179
Ok(UnsignedInvoiceRequest { offer, invoice_request })
199180
}
181+
}
182+
183+
#[cfg(test)]
184+
impl<'a> InvoiceRequestBuilder<'a> {
185+
fn chain_unchecked(mut self, network: Network) -> Self {
186+
let chain = ChainHash::using_genesis_block(network);
187+
self.invoice_request.chain = Some(chain);
188+
self
189+
}
190+
191+
fn amount_msats_unchecked(mut self, amount_msats: u64) -> Self {
192+
self.invoice_request.amount_msats = Some(amount_msats);
193+
self
194+
}
195+
196+
fn quantity_unchecked(mut self, quantity: u64) -> Self {
197+
self.invoice_request.quantity = Some(quantity);
198+
self
199+
}
200200

201-
#[cfg(test)]
202201
fn build_unchecked(self) -> UnsignedInvoiceRequest<'a> {
203202
let InvoiceRequestBuilder { offer, invoice_request } = self;
204203
UnsignedInvoiceRequest { offer, invoice_request }

0 commit comments

Comments
 (0)