@@ -1410,7 +1410,41 @@ fn creates_offer_with_blinded_path_using_unannounced_introduction_node() {
14101410 route_bolt12_payment ( bob, & [ alice] , & invoice) ;
14111411 expect_recent_payment ! ( bob, RecentPaymentDetails :: Pending , payment_id) ;
14121412
1413- claim_bolt12_payment ( bob, & [ alice] , payment_context, & invoice) ;
1413+ // Extract PaymentClaimable, verify context, and obtain the payment preimage.
1414+ let recipient = & alice;
1415+ let payment_purpose = match get_event ! ( recipient, Event :: PaymentClaimable ) {
1416+ Event :: PaymentClaimable { purpose, .. } => purpose,
1417+ _ => panic ! ( "No Event::PaymentClaimable" ) ,
1418+ } ;
1419+
1420+ let payment_preimage = payment_purpose
1421+ . preimage ( )
1422+ . expect ( "No preimage in Event::PaymentClaimable" ) ;
1423+
1424+ match payment_purpose {
1425+ PaymentPurpose :: Bolt12OfferPayment { payment_context : ctx, .. } => {
1426+ assert_eq ! ( PaymentContext :: Bolt12Offer ( ctx) , payment_context) ;
1427+ } ,
1428+ PaymentPurpose :: Bolt12RefundPayment { payment_context : ctx, .. } => {
1429+ assert_eq ! ( PaymentContext :: Bolt12Refund ( ctx) , payment_context) ;
1430+ } ,
1431+ _ => panic ! ( "Unexpected payment purpose: {:?}" , payment_purpose) ,
1432+ } ;
1433+
1434+ // Build ClaimAlongRouteArgs and compensate for the expected overpayment
1435+ // caused by the payer being the introduction node of the blinded path with
1436+ // dummy hops.
1437+ let expected_paths: & [ & [ & Node ] ] = & [ & [ alice] ] ;
1438+ let args = ClaimAlongRouteArgs :: new (
1439+ bob,
1440+ expected_paths,
1441+ payment_preimage,
1442+ ) . with_expected_extra_total_fees_msat ( 1000 ) ;
1443+
1444+ // Execute the claim and verify the invoice was fulfilled.
1445+ let ( inv, _events) = claim_payment_along_route ( args) ;
1446+ assert_eq ! ( inv, Some ( PaidBolt12Invoice :: Bolt12Invoice ( invoice. clone( ) ) ) ) ;
1447+
14141448 expect_recent_payment ! ( bob, RecentPaymentDetails :: Fulfilled , payment_id) ;
14151449}
14161450
@@ -2425,9 +2459,9 @@ fn rejects_keysend_to_non_static_invoice_path() {
24252459 . expect_failure ( HTLCHandlingFailureType :: Receive { payment_hash } ) ;
24262460 do_pass_along_path ( args) ;
24272461 let mut updates = get_htlc_update_msgs ( & nodes[ 1 ] , & nodes[ 0 ] . node . get_our_node_id ( ) ) ;
2428- nodes[ 0 ] . node . handle_update_fail_htlc ( nodes[ 1 ] . node . get_our_node_id ( ) , & updates. update_fail_htlcs [ 0 ] ) ;
2462+ nodes[ 0 ] . node . handle_update_fail_malformed_htlc ( nodes[ 1 ] . node . get_our_node_id ( ) , & updates. update_fail_malformed_htlcs [ 0 ] ) ;
24292463 do_commitment_signed_dance ( & nodes[ 0 ] , & nodes[ 1 ] , & updates. commitment_signed , false , false ) ;
2430- expect_payment_failed_conditions ( & nodes[ 0 ] , payment_hash, true , PaymentFailedConditions :: new ( ) ) ;
2464+ expect_payment_failed_conditions ( & nodes[ 0 ] , payment_hash, false , PaymentFailedConditions :: new ( ) ) ;
24312465}
24322466
24332467#[ test]
0 commit comments