@@ -87,8 +87,8 @@ pub use event::Event;
8787use event:: { EventHandler , EventQueue } ;
8888use io:: fs_store:: FilesystemStore ;
8989use 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 } ;
9292use peer_store:: { PeerInfo , PeerInfoStorage } ;
9393use types:: {
9494 ChainMonitor , ChannelManager , GossipSync , KeysManager , NetworkGraph , OnionMessenger ,
@@ -502,8 +502,8 @@ impl Builder {
502502 ) ) ;
503503
504504 // 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 (
507507 payments,
508508 Arc :: clone ( & kv_store) ,
509509 Arc :: clone ( & logger) ,
@@ -591,7 +591,7 @@ pub struct Node {
591591 logger : Arc < FilesystemLogger > ,
592592 scorer : Arc < Mutex < Scorer > > ,
593593 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 > > > ,
595595}
596596
597597impl Node {
@@ -1023,15 +1023,15 @@ impl Node {
10231023 let amt_msat = invoice. amount_milli_satoshis ( ) . unwrap ( ) ;
10241024 log_info ! ( self . logger, "Initiated sending {}msat to {}" , amt_msat, payee_pubkey) ;
10251025
1026- let payment_info = PaymentInfo {
1026+ let payment = PaymentDetails {
10271027 preimage : None ,
1028- payment_hash,
1028+ hash : payment_hash,
10291029 secret : payment_secret,
10301030 amount_msat : invoice. amount_milli_satoshis ( ) ,
10311031 direction : PaymentDirection :: Outbound ,
10321032 status : PaymentStatus :: Pending ,
10331033 } ;
1034- self . payment_store . insert ( payment_info ) ?;
1034+ self . payment_store . insert ( payment ) ?;
10351035
10361036 Ok ( payment_hash)
10371037 }
@@ -1118,15 +1118,15 @@ impl Node {
11181118 payee_pubkey
11191119 ) ;
11201120
1121- let payment_info = PaymentInfo {
1122- payment_hash,
1121+ let payment = PaymentDetails {
1122+ hash : payment_hash,
11231123 preimage : None ,
11241124 secret : payment_secret,
11251125 direction : PaymentDirection :: Outbound ,
11261126 status : PaymentStatus :: Pending ,
11271127 amount_msat : Some ( amount_msat) ,
11281128 } ;
1129- self . payment_store . insert ( payment_info ) ?;
1129+ self . payment_store . insert ( payment ) ?;
11301130
11311131 Ok ( payment_hash)
11321132 }
@@ -1179,30 +1179,30 @@ impl Node {
11791179 Ok ( _payment_id) => {
11801180 log_info ! ( self . logger, "Initiated sending {}msat to {}." , amount_msat, node_id) ;
11811181
1182- let payment_info = PaymentInfo {
1183- payment_hash,
1182+ let payment = PaymentDetails {
1183+ hash : payment_hash,
11841184 preimage : Some ( payment_preimage) ,
11851185 secret : None ,
11861186 status : PaymentStatus :: Pending ,
11871187 direction : PaymentDirection :: Outbound ,
11881188 amount_msat : Some ( amount_msat) ,
11891189 } ;
1190- self . payment_store . insert ( payment_info ) ?;
1190+ self . payment_store . insert ( payment ) ?;
11911191
11921192 Ok ( payment_hash)
11931193 }
11941194 Err ( e) => {
11951195 log_error ! ( self . logger, "Failed to send payment: {:?}" , e) ;
11961196
1197- let payment_info = PaymentInfo {
1198- payment_hash,
1197+ let payment = PaymentDetails {
1198+ hash : payment_hash,
11991199 preimage : Some ( payment_preimage) ,
12001200 secret : None ,
12011201 status : PaymentStatus :: Failed ,
12021202 direction : PaymentDirection :: Outbound ,
12031203 amount_msat : Some ( amount_msat) ,
12041204 } ;
1205- self . payment_store . insert ( payment_info ) ?;
1205+ self . payment_store . insert ( payment ) ?;
12061206
12071207 Err ( Error :: PaymentFailed )
12081208 }
@@ -1256,22 +1256,22 @@ impl Node {
12561256 } ;
12571257
12581258 let payment_hash = PaymentHash ( ( * invoice. payment_hash ( ) ) . into_inner ( ) ) ;
1259- let payment_info = PaymentInfo {
1259+ let payment = PaymentDetails {
1260+ hash : payment_hash,
12601261 preimage : None ,
1261- payment_hash,
12621262 secret : Some ( invoice. payment_secret ( ) . clone ( ) ) ,
12631263 amount_msat,
12641264 direction : PaymentDirection :: Inbound ,
12651265 status : PaymentStatus :: Pending ,
12661266 } ;
12671267
1268- self . payment_store . insert ( payment_info ) ?;
1268+ self . payment_store . insert ( payment ) ?;
12691269
12701270 Ok ( invoice)
12711271 }
12721272
12731273 /// 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 > {
12751275 self . payment_store . get ( payment_hash)
12761276 }
12771277}
0 commit comments