@@ -1010,7 +1010,9 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
10101010 let payment_hash = PaymentHash ( ( * invoice. payment_hash ( ) ) . into_inner ( ) ) ;
10111011
10121012 if let Some ( payment) = self . payment_store . get ( & payment_hash) {
1013- if payment. status != PaymentStatus :: SendingFailed {
1013+ if payment. status == PaymentStatus :: Pending
1014+ || payment. status == PaymentStatus :: Succeeded
1015+ {
10141016 log_error ! ( self . logger, "Payment error: an invoice must not be paid twice." ) ;
10151017 return Err ( Error :: DuplicatePayment ) ;
10161018 }
@@ -1057,7 +1059,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
10571059 secret : payment_secret,
10581060 amount_msat : invoice. amount_milli_satoshis ( ) ,
10591061 direction : PaymentDirection :: Outbound ,
1060- status : PaymentStatus :: SendingFailed ,
1062+ status : PaymentStatus :: Failed ,
10611063 } ;
10621064
10631065 self . payment_store . insert ( payment) ?;
@@ -1093,7 +1095,9 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
10931095
10941096 let payment_hash = PaymentHash ( ( * invoice. payment_hash ( ) ) . into_inner ( ) ) ;
10951097 if let Some ( payment) = self . payment_store . get ( & payment_hash) {
1096- if payment. status != PaymentStatus :: SendingFailed {
1098+ if payment. status == PaymentStatus :: Pending
1099+ || payment. status == PaymentStatus :: Succeeded
1100+ {
10971101 log_error ! ( self . logger, "Payment error: an invoice must not be paid twice." ) ;
10981102 return Err ( Error :: DuplicatePayment ) ;
10991103 }
@@ -1160,7 +1164,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
11601164 secret : payment_secret,
11611165 amount_msat : Some ( amount_msat) ,
11621166 direction : PaymentDirection :: Outbound ,
1163- status : PaymentStatus :: SendingFailed ,
1167+ status : PaymentStatus :: Failed ,
11641168 } ;
11651169 self . payment_store . insert ( payment) ?;
11661170
@@ -1184,7 +1188,9 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
11841188 let payment_hash = PaymentHash ( Sha256 :: hash ( & payment_preimage. 0 ) . into_inner ( ) ) ;
11851189
11861190 if let Some ( payment) = self . payment_store . get ( & payment_hash) {
1187- if payment. status != PaymentStatus :: SendingFailed {
1191+ if payment. status == PaymentStatus :: Pending
1192+ || payment. status == PaymentStatus :: Succeeded
1193+ {
11881194 log_error ! ( self . logger, "Payment error: must not send duplicate payments." ) ;
11891195 return Err ( Error :: DuplicatePayment ) ;
11901196 }
@@ -1233,7 +1239,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
12331239 hash : payment_hash,
12341240 preimage : Some ( payment_preimage) ,
12351241 secret : None ,
1236- status : PaymentStatus :: SendingFailed ,
1242+ status : PaymentStatus :: Failed ,
12371243 direction : PaymentDirection :: Outbound ,
12381244 amount_msat : Some ( amount_msat) ,
12391245 } ;
0 commit comments