@@ -1439,22 +1439,23 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
14391439 }
14401440 Err ( payment:: PaymentError :: Sending ( e) ) => {
14411441 log_error ! ( self . logger, "Failed to send payment: {:?}" , e) ;
1442-
1443- let payment = PaymentDetails {
1444- preimage : None ,
1445- hash : payment_hash,
1446- secret : payment_secret,
1447- amount_msat : invoice. amount_milli_satoshis ( ) ,
1448- direction : PaymentDirection :: Outbound ,
1449- status : PaymentStatus :: SendingFailed ,
1450- } ;
1451- self . payment_store . insert ( payment) ?;
1452-
14531442 match e {
14541443 channelmanager:: RetryableSendFailure :: DuplicatePayment => {
14551444 Err ( Error :: DuplicatePayment )
14561445 }
1457- _ => Err ( Error :: PaymentSendingFailed ) ,
1446+ _ => {
1447+ let payment = PaymentDetails {
1448+ preimage : None ,
1449+ hash : payment_hash,
1450+ secret : payment_secret,
1451+ amount_msat : invoice. amount_milli_satoshis ( ) ,
1452+ direction : PaymentDirection :: Outbound ,
1453+ status : PaymentStatus :: SendingFailed ,
1454+ } ;
1455+
1456+ self . payment_store . insert ( payment) ?;
1457+ Err ( Error :: PaymentSendingFailed )
1458+ }
14581459 }
14591460 }
14601461 }
@@ -1541,21 +1542,23 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
15411542 Err ( payment:: PaymentError :: Sending ( e) ) => {
15421543 log_error ! ( self . logger, "Failed to send payment: {:?}" , e) ;
15431544
1544- let payment = PaymentDetails {
1545- hash : payment_hash,
1546- preimage : None ,
1547- secret : payment_secret,
1548- amount_msat : Some ( amount_msat) ,
1549- direction : PaymentDirection :: Outbound ,
1550- status : PaymentStatus :: SendingFailed ,
1551- } ;
1552- self . payment_store . insert ( payment) ?;
1553-
15541545 match e {
15551546 channelmanager:: RetryableSendFailure :: DuplicatePayment => {
15561547 Err ( Error :: DuplicatePayment )
15571548 }
1558- _ => Err ( Error :: PaymentSendingFailed ) ,
1549+ _ => {
1550+ let payment = PaymentDetails {
1551+ hash : payment_hash,
1552+ preimage : None ,
1553+ secret : payment_secret,
1554+ amount_msat : Some ( amount_msat) ,
1555+ direction : PaymentDirection :: Outbound ,
1556+ status : PaymentStatus :: SendingFailed ,
1557+ } ;
1558+ self . payment_store . insert ( payment) ?;
1559+
1560+ Err ( Error :: PaymentSendingFailed )
1561+ }
15591562 }
15601563 }
15611564 }
@@ -1614,21 +1617,23 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
16141617 Err ( e) => {
16151618 log_error ! ( self . logger, "Failed to send payment: {:?}" , e) ;
16161619
1617- let payment = PaymentDetails {
1618- hash : payment_hash,
1619- preimage : Some ( payment_preimage) ,
1620- secret : None ,
1621- status : PaymentStatus :: SendingFailed ,
1622- direction : PaymentDirection :: Outbound ,
1623- amount_msat : Some ( amount_msat) ,
1624- } ;
1625- self . payment_store . insert ( payment) ?;
1626-
16271620 match e {
16281621 channelmanager:: RetryableSendFailure :: DuplicatePayment => {
16291622 Err ( Error :: DuplicatePayment )
16301623 }
1631- _ => Err ( Error :: PaymentSendingFailed ) ,
1624+ _ => {
1625+ let payment = PaymentDetails {
1626+ hash : payment_hash,
1627+ preimage : Some ( payment_preimage) ,
1628+ secret : None ,
1629+ status : PaymentStatus :: SendingFailed ,
1630+ direction : PaymentDirection :: Outbound ,
1631+ amount_msat : Some ( amount_msat) ,
1632+ } ;
1633+
1634+ self . payment_store . insert ( payment) ?;
1635+ Err ( Error :: PaymentSendingFailed )
1636+ }
16321637 }
16331638 }
16341639 }
0 commit comments