@@ -573,8 +573,8 @@ pub fn write_rgb_payment_info_file(
573573 . expect ( "able to write rgb payment info pending" ) ;
574574}
575575
576- /// Rename RGB channel info from temporary to final channel ID in KVStore
577- pub ( crate ) fn rename_rgb_files (
576+ /// update RGB data from temporary to final channel ID in KVStore
577+ pub ( crate ) fn update_rgb_channel_id (
578578 channel_id : & ChannelId , temporary_channel_id : & ChannelId , kv_store : & dyn KVStoreSync ,
579579) {
580580 let temp_chan_id = temporary_channel_id. 0 . as_hex ( ) . to_string ( ) ;
@@ -723,7 +723,7 @@ pub trait RgbKvStoreExt {
723723 /// filter first hops to only include channels with sufficient RGB assets
724724 fn filter_first_hops (
725725 & self , payment_hash : & PaymentHash , first_hops : & mut Vec < ChannelDetails > ,
726- ) ;
726+ ) -> ( ContractId , u64 ) ;
727727}
728728
729729impl < K : KVStoreSync + ?Sized > RgbKvStoreExt for K {
@@ -795,11 +795,11 @@ impl<K: KVStoreSync + ?Sized> RgbKvStoreExt for K {
795795 || self . read_rgb_payment_info ( payment_hash, true ) . is_ok ( )
796796 }
797797
798- fn filter_first_hops ( & self , payment_hash : & PaymentHash , first_hops : & mut Vec < ChannelDetails > ) {
799- let rgb_payment_info = match self . read_rgb_payment_info ( payment_hash, false ) {
800- Ok ( info ) => info ,
801- Err ( _ ) => return ,
802- } ;
798+ fn filter_first_hops (
799+ & self , payment_hash : & PaymentHash , first_hops : & mut Vec < ChannelDetails > ,
800+ ) -> ( ContractId , u64 ) {
801+ let rgb_payment_info = self . read_rgb_payment_info ( payment_hash , false )
802+ . expect ( "payment info must exist" ) ;
803803 let contract_id = rgb_payment_info. contract_id ;
804804 let rgb_amount = rgb_payment_info. amount ;
805805 first_hops. retain ( |h| {
@@ -811,5 +811,6 @@ impl<K: KVStoreSync + ?Sized> RgbKvStoreExt for K {
811811 Err ( _) => false ,
812812 }
813813 } ) ;
814+ ( contract_id, rgb_amount)
814815 }
815816}
0 commit comments