@@ -1334,22 +1334,23 @@ impl Node {
13341334 }
13351335 Err ( payment:: PaymentError :: Sending ( e) ) => {
13361336 log_error ! ( self . logger, "Failed to send payment: {:?}" , e) ;
1337-
1338- let payment = PaymentDetails {
1339- preimage : None ,
1340- hash : payment_hash,
1341- secret : payment_secret,
1342- amount_msat : invoice. amount_milli_satoshis ( ) ,
1343- direction : PaymentDirection :: Outbound ,
1344- status : PaymentStatus :: SendingFailed ,
1345- } ;
1346- self . payment_store . insert ( payment) ?;
1347-
13481337 match e {
13491338 channelmanager:: RetryableSendFailure :: DuplicatePayment => {
13501339 Err ( Error :: DuplicatePayment )
13511340 }
1352- _ => Err ( Error :: PaymentSendingFailed ) ,
1341+ _ => {
1342+ let payment = PaymentDetails {
1343+ preimage : None ,
1344+ hash : payment_hash,
1345+ secret : payment_secret,
1346+ amount_msat : invoice. amount_milli_satoshis ( ) ,
1347+ direction : PaymentDirection :: Outbound ,
1348+ status : PaymentStatus :: SendingFailed ,
1349+ } ;
1350+
1351+ self . payment_store . insert ( payment) ?;
1352+ Err ( Error :: PaymentSendingFailed )
1353+ }
13531354 }
13541355 }
13551356 }
@@ -1436,21 +1437,23 @@ impl Node {
14361437 Err ( payment:: PaymentError :: Sending ( e) ) => {
14371438 log_error ! ( self . logger, "Failed to send payment: {:?}" , e) ;
14381439
1439- let payment = PaymentDetails {
1440- hash : payment_hash,
1441- preimage : None ,
1442- secret : payment_secret,
1443- amount_msat : Some ( amount_msat) ,
1444- direction : PaymentDirection :: Outbound ,
1445- status : PaymentStatus :: SendingFailed ,
1446- } ;
1447- self . payment_store . insert ( payment) ?;
1448-
14491440 match e {
14501441 channelmanager:: RetryableSendFailure :: DuplicatePayment => {
14511442 Err ( Error :: DuplicatePayment )
14521443 }
1453- _ => Err ( Error :: PaymentSendingFailed ) ,
1444+ _ => {
1445+ let payment = PaymentDetails {
1446+ hash : payment_hash,
1447+ preimage : None ,
1448+ secret : payment_secret,
1449+ amount_msat : Some ( amount_msat) ,
1450+ direction : PaymentDirection :: Outbound ,
1451+ status : PaymentStatus :: SendingFailed ,
1452+ } ;
1453+ self . payment_store . insert ( payment) ?;
1454+
1455+ Err ( Error :: PaymentSendingFailed )
1456+ }
14541457 }
14551458 }
14561459 }
@@ -1509,21 +1512,23 @@ impl Node {
15091512 Err ( e) => {
15101513 log_error ! ( self . logger, "Failed to send payment: {:?}" , e) ;
15111514
1512- let payment = PaymentDetails {
1513- hash : payment_hash,
1514- preimage : Some ( payment_preimage) ,
1515- secret : None ,
1516- status : PaymentStatus :: SendingFailed ,
1517- direction : PaymentDirection :: Outbound ,
1518- amount_msat : Some ( amount_msat) ,
1519- } ;
1520- self . payment_store . insert ( payment) ?;
1521-
15221515 match e {
15231516 channelmanager:: RetryableSendFailure :: DuplicatePayment => {
15241517 Err ( Error :: DuplicatePayment )
15251518 }
1526- _ => Err ( Error :: PaymentSendingFailed ) ,
1519+ _ => {
1520+ let payment = PaymentDetails {
1521+ hash : payment_hash,
1522+ preimage : Some ( payment_preimage) ,
1523+ secret : None ,
1524+ status : PaymentStatus :: SendingFailed ,
1525+ direction : PaymentDirection :: Outbound ,
1526+ amount_msat : Some ( amount_msat) ,
1527+ } ;
1528+
1529+ self . payment_store . insert ( payment) ?;
1530+ Err ( Error :: PaymentSendingFailed )
1531+ }
15271532 }
15281533 }
15291534 }
0 commit comments