@@ -1010,7 +1010,9 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
1010
1010
let payment_hash = PaymentHash ( ( * invoice. payment_hash ( ) ) . into_inner ( ) ) ;
1011
1011
1012
1012
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
+ {
1014
1016
log_error ! ( self . logger, "Payment error: an invoice must not be paid twice." ) ;
1015
1017
return Err ( Error :: DuplicatePayment ) ;
1016
1018
}
@@ -1057,7 +1059,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
1057
1059
secret : payment_secret,
1058
1060
amount_msat : invoice. amount_milli_satoshis ( ) ,
1059
1061
direction : PaymentDirection :: Outbound ,
1060
- status : PaymentStatus :: SendingFailed ,
1062
+ status : PaymentStatus :: Failed ,
1061
1063
} ;
1062
1064
1063
1065
self . payment_store . insert ( payment) ?;
@@ -1093,7 +1095,9 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
1093
1095
1094
1096
let payment_hash = PaymentHash ( ( * invoice. payment_hash ( ) ) . into_inner ( ) ) ;
1095
1097
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
+ {
1097
1101
log_error ! ( self . logger, "Payment error: an invoice must not be paid twice." ) ;
1098
1102
return Err ( Error :: DuplicatePayment ) ;
1099
1103
}
@@ -1160,7 +1164,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
1160
1164
secret : payment_secret,
1161
1165
amount_msat : Some ( amount_msat) ,
1162
1166
direction : PaymentDirection :: Outbound ,
1163
- status : PaymentStatus :: SendingFailed ,
1167
+ status : PaymentStatus :: Failed ,
1164
1168
} ;
1165
1169
self . payment_store . insert ( payment) ?;
1166
1170
@@ -1184,7 +1188,9 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
1184
1188
let payment_hash = PaymentHash ( Sha256 :: hash ( & payment_preimage. 0 ) . into_inner ( ) ) ;
1185
1189
1186
1190
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
+ {
1188
1194
log_error ! ( self . logger, "Payment error: must not send duplicate payments." ) ;
1189
1195
return Err ( Error :: DuplicatePayment ) ;
1190
1196
}
@@ -1233,7 +1239,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
1233
1239
hash : payment_hash,
1234
1240
preimage : Some ( payment_preimage) ,
1235
1241
secret : None ,
1236
- status : PaymentStatus :: SendingFailed ,
1242
+ status : PaymentStatus :: Failed ,
1237
1243
direction : PaymentDirection :: Outbound ,
1238
1244
amount_msat : Some ( amount_msat) ,
1239
1245
} ;
0 commit comments