Skip to content

Commit f3067b8

Browse files
committed
Drop the fails_paying_for_bolt12_invoice test
`fails_paying_for_bolt12_invoice` tests that we fail to send a payment if the router returns `Ok` but includes a bogus route (one with 0-length paths). While this marginally increases our test coverage, in the next commit we'll be testing that all routes round-trip serialization, which fails here as bogus routes are not supported in deserialization. Because this isn't particularly critical test coverage, we simply opt to drop the test entirely here.
1 parent 3fd4b39 commit f3067b8

File tree

1 file changed

+0
-59
lines changed

1 file changed

+0
-59
lines changed

lightning/src/ln/outbound_payment.rs

-59
Original file line numberDiff line numberDiff line change
@@ -2283,65 +2283,6 @@ mod tests {
22832283
assert!(pending_events.lock().unwrap().is_empty());
22842284
}
22852285

2286-
#[test]
2287-
fn fails_paying_for_bolt12_invoice() {
2288-
let logger = test_utils::TestLogger::new();
2289-
let network_graph = Arc::new(NetworkGraph::new(Network::Testnet, &logger));
2290-
let scorer = RwLock::new(test_utils::TestScorer::new());
2291-
let router = test_utils::TestRouter::new(network_graph, &logger, &scorer);
2292-
let keys_manager = test_utils::TestKeysInterface::new(&[0; 32], Network::Testnet);
2293-
2294-
let pending_events = Mutex::new(VecDeque::new());
2295-
let outbound_payments = OutboundPayments::new();
2296-
let payment_id = PaymentId([0; 32]);
2297-
let expiration = StaleExpiration::AbsoluteTimeout(Duration::from_secs(100));
2298-
2299-
let invoice = OfferBuilder::new("foo".into(), recipient_pubkey())
2300-
.amount_msats(1000)
2301-
.build().unwrap()
2302-
.request_invoice(vec![1; 32], payer_pubkey()).unwrap()
2303-
.build().unwrap()
2304-
.sign(payer_sign).unwrap()
2305-
.respond_with_no_std(payment_paths(), payment_hash(), now()).unwrap()
2306-
.build().unwrap()
2307-
.sign(recipient_sign).unwrap();
2308-
2309-
assert!(
2310-
outbound_payments.add_new_awaiting_invoice(
2311-
payment_id, expiration, Retry::Attempts(0),
2312-
Some(invoice.amount_msats() / 100 + 50_000)
2313-
).is_ok()
2314-
);
2315-
assert!(outbound_payments.has_pending_payments());
2316-
2317-
let route_params = RouteParameters::from_payment_params_and_value(
2318-
PaymentParameters::from_bolt12_invoice(&invoice),
2319-
invoice.amount_msats(),
2320-
);
2321-
router.expect_find_route(
2322-
route_params.clone(), Ok(Route { paths: vec![], route_params: Some(route_params) })
2323-
);
2324-
2325-
assert_eq!(
2326-
outbound_payments.send_payment_for_bolt12_invoice(
2327-
&invoice, payment_id, &&router, vec![], || InFlightHtlcs::new(), &&keys_manager,
2328-
&&keys_manager, 0, &&logger, &pending_events, |_| panic!()
2329-
),
2330-
Ok(()),
2331-
);
2332-
assert!(!outbound_payments.has_pending_payments());
2333-
2334-
let payment_hash = invoice.payment_hash();
2335-
let reason = Some(PaymentFailureReason::UnexpectedError);
2336-
2337-
assert!(!pending_events.lock().unwrap().is_empty());
2338-
assert_eq!(
2339-
pending_events.lock().unwrap().pop_front(),
2340-
Some((Event::PaymentFailed { payment_id, payment_hash, reason }, None)),
2341-
);
2342-
assert!(pending_events.lock().unwrap().is_empty());
2343-
}
2344-
23452286
#[test]
23462287
fn sends_payment_for_bolt12_invoice() {
23472288
let logger = test_utils::TestLogger::new();

0 commit comments

Comments
 (0)