@@ -87,8 +87,8 @@ pub use event::Event;
87
87
use event:: { EventHandler , EventQueue } ;
88
88
use io:: fs_store:: FilesystemStore ;
89
89
use io:: { KVStore , CHANNEL_MANAGER_PERSISTENCE_KEY , CHANNEL_MANAGER_PERSISTENCE_NAMESPACE } ;
90
- use payment_store:: PaymentInfoStorage ;
91
- pub use payment_store:: { PaymentDirection , PaymentInfo , PaymentStatus } ;
90
+ use payment_store:: PaymentStore ;
91
+ pub use payment_store:: { PaymentDetails , PaymentDirection , PaymentStatus } ;
92
92
use peer_store:: { PeerInfo , PeerInfoStorage } ;
93
93
use types:: {
94
94
ChainMonitor , ChannelManager , GossipSync , KeysManager , NetworkGraph , OnionMessenger ,
@@ -502,8 +502,8 @@ impl Builder {
502
502
) ) ;
503
503
504
504
// Init payment info storage
505
- let payment_store = match io:: utils:: read_payment_info ( Arc :: clone ( & kv_store) ) {
506
- Ok ( payments) => Arc :: new ( PaymentInfoStorage :: from_payments (
505
+ let payment_store = match io:: utils:: read_payments ( Arc :: clone ( & kv_store) ) {
506
+ Ok ( payments) => Arc :: new ( PaymentStore :: from_payments (
507
507
payments,
508
508
Arc :: clone ( & kv_store) ,
509
509
Arc :: clone ( & logger) ,
@@ -591,7 +591,7 @@ pub struct Node {
591
591
logger : Arc < FilesystemLogger > ,
592
592
scorer : Arc < Mutex < Scorer > > ,
593
593
peer_store : Arc < PeerInfoStorage < Arc < FilesystemStore > , Arc < FilesystemLogger > > > ,
594
- payment_store : Arc < PaymentInfoStorage < Arc < FilesystemStore > , Arc < FilesystemLogger > > > ,
594
+ payment_store : Arc < PaymentStore < Arc < FilesystemStore > , Arc < FilesystemLogger > > > ,
595
595
}
596
596
597
597
impl Node {
@@ -1023,15 +1023,15 @@ impl Node {
1023
1023
let amt_msat = invoice. amount_milli_satoshis ( ) . unwrap ( ) ;
1024
1024
log_info ! ( self . logger, "Initiated sending {}msat to {}" , amt_msat, payee_pubkey) ;
1025
1025
1026
- let payment_info = PaymentInfo {
1026
+ let payment = PaymentDetails {
1027
1027
preimage : None ,
1028
- payment_hash,
1028
+ hash : payment_hash,
1029
1029
secret : payment_secret,
1030
1030
amount_msat : invoice. amount_milli_satoshis ( ) ,
1031
1031
direction : PaymentDirection :: Outbound ,
1032
1032
status : PaymentStatus :: Pending ,
1033
1033
} ;
1034
- self . payment_store . insert ( payment_info ) ?;
1034
+ self . payment_store . insert ( payment ) ?;
1035
1035
1036
1036
Ok ( payment_hash)
1037
1037
}
@@ -1118,15 +1118,15 @@ impl Node {
1118
1118
payee_pubkey
1119
1119
) ;
1120
1120
1121
- let payment_info = PaymentInfo {
1122
- payment_hash,
1121
+ let payment = PaymentDetails {
1122
+ hash : payment_hash,
1123
1123
preimage : None ,
1124
1124
secret : payment_secret,
1125
1125
direction : PaymentDirection :: Outbound ,
1126
1126
status : PaymentStatus :: Pending ,
1127
1127
amount_msat : Some ( amount_msat) ,
1128
1128
} ;
1129
- self . payment_store . insert ( payment_info ) ?;
1129
+ self . payment_store . insert ( payment ) ?;
1130
1130
1131
1131
Ok ( payment_hash)
1132
1132
}
@@ -1179,30 +1179,30 @@ impl Node {
1179
1179
Ok ( _payment_id) => {
1180
1180
log_info ! ( self . logger, "Initiated sending {}msat to {}." , amount_msat, node_id) ;
1181
1181
1182
- let payment_info = PaymentInfo {
1183
- payment_hash,
1182
+ let payment = PaymentDetails {
1183
+ hash : payment_hash,
1184
1184
preimage : Some ( payment_preimage) ,
1185
1185
secret : None ,
1186
1186
status : PaymentStatus :: Pending ,
1187
1187
direction : PaymentDirection :: Outbound ,
1188
1188
amount_msat : Some ( amount_msat) ,
1189
1189
} ;
1190
- self . payment_store . insert ( payment_info ) ?;
1190
+ self . payment_store . insert ( payment ) ?;
1191
1191
1192
1192
Ok ( payment_hash)
1193
1193
}
1194
1194
Err ( e) => {
1195
1195
log_error ! ( self . logger, "Failed to send payment: {:?}" , e) ;
1196
1196
1197
- let payment_info = PaymentInfo {
1198
- payment_hash,
1197
+ let payment = PaymentDetails {
1198
+ hash : payment_hash,
1199
1199
preimage : Some ( payment_preimage) ,
1200
1200
secret : None ,
1201
1201
status : PaymentStatus :: Failed ,
1202
1202
direction : PaymentDirection :: Outbound ,
1203
1203
amount_msat : Some ( amount_msat) ,
1204
1204
} ;
1205
- self . payment_store . insert ( payment_info ) ?;
1205
+ self . payment_store . insert ( payment ) ?;
1206
1206
1207
1207
Err ( Error :: PaymentFailed )
1208
1208
}
@@ -1256,22 +1256,22 @@ impl Node {
1256
1256
} ;
1257
1257
1258
1258
let payment_hash = PaymentHash ( ( * invoice. payment_hash ( ) ) . into_inner ( ) ) ;
1259
- let payment_info = PaymentInfo {
1259
+ let payment = PaymentDetails {
1260
+ hash : payment_hash,
1260
1261
preimage : None ,
1261
- payment_hash,
1262
1262
secret : Some ( invoice. payment_secret ( ) . clone ( ) ) ,
1263
1263
amount_msat,
1264
1264
direction : PaymentDirection :: Inbound ,
1265
1265
status : PaymentStatus :: Pending ,
1266
1266
} ;
1267
1267
1268
- self . payment_store . insert ( payment_info ) ?;
1268
+ self . payment_store . insert ( payment ) ?;
1269
1269
1270
1270
Ok ( invoice)
1271
1271
}
1272
1272
1273
1273
/// Query for information about the status of a specific payment.
1274
- pub fn payment_info ( & self , payment_hash : & PaymentHash ) -> Option < PaymentInfo > {
1274
+ pub fn payment ( & self , payment_hash : & PaymentHash ) -> Option < PaymentDetails > {
1275
1275
self . payment_store . get ( payment_hash)
1276
1276
}
1277
1277
}
0 commit comments