@@ -6,7 +6,6 @@ use crate::ln::chan_utils::{
66} ;
77use crate :: ln:: channel:: { ChannelContext , ChannelError , FundingScope } ;
88use crate :: ln:: channel_state:: ChannelDetails ;
9- use crate :: ln:: channelmanager:: MsgHandleErrInternal ;
109use crate :: ln:: types:: ChannelId ;
1110use crate :: sign:: SignerProvider ;
1211use crate :: types:: features:: ChannelTypeFeatures ;
@@ -218,7 +217,7 @@ async fn _accept_transfer(
218217 account_xpub_colored,
219218 master_fingerprint,
220219 ) ;
221- wallet. go_online ( true , indexer_url) . unwrap ( ) ;
220+ wallet. go_online ( true , indexer_url) ? ;
222221 wallet. accept_transfer (
223222 funding_txid. clone ( ) ,
224223 funding_vout,
@@ -648,7 +647,7 @@ pub(crate) fn rename_rgb_files(
648647pub ( crate ) fn handle_funding (
649648 temporary_channel_id : & ChannelId , funding_txid : String , ldk_data_dir : & Path ,
650649 consignment_endpoint : RgbTransport , push_asset_amount : Option < u64 > ,
651- ) -> Result < ( ) , MsgHandleErrInternal > {
650+ ) -> Result < ( ) , ChannelError > {
652651 let handle = Handle :: current ( ) ;
653652 let _ = handle. enter ( ) ;
654653 let accept_res = futures:: executor:: block_on ( _accept_transfer (
@@ -659,35 +658,23 @@ pub(crate) fn handle_funding(
659658 let ( consignment, remote_rgb_assignments) = match accept_res {
660659 Ok ( res) => res,
661660 Err ( RgbLibError :: InvalidConsignment ) => {
662- return Err ( MsgHandleErrInternal :: send_err_msg_no_close (
663- "Invalid RGB consignment for funding" . to_owned ( ) ,
664- * temporary_channel_id,
665- ) )
661+ return Err ( ChannelError :: close ( "Invalid RGB consignment for funding" . to_owned ( ) ) )
666662 } ,
667663 Err ( RgbLibError :: NoConsignment ) => {
668- return Err ( MsgHandleErrInternal :: send_err_msg_no_close (
669- "Failed to find RGB consignment" . to_owned ( ) ,
670- * temporary_channel_id,
671- ) )
664+ return Err ( ChannelError :: close ( "Failed to find RGB consignment" . to_owned ( ) ) )
672665 } ,
673666 Err ( RgbLibError :: UnknownRgbSchema { schema_id } ) => {
674- return Err ( MsgHandleErrInternal :: send_err_msg_no_close (
675- format ! ( "Unknown RGB schema: {schema_id}" ) ,
676- * temporary_channel_id,
677- ) )
667+ return Err ( ChannelError :: close ( format ! ( "Unknown RGB schema: {schema_id}" ) ) )
678668 } ,
679669 Err ( RgbLibError :: UnsupportedSchema { asset_schema } ) => {
680- return Err ( MsgHandleErrInternal :: send_err_msg_no_close (
681- format ! ( "Unsupported RGB schema: {asset_schema}" ) ,
682- * temporary_channel_id,
683- ) )
670+ return Err ( ChannelError :: close ( format ! ( "Unsupported RGB schema: {asset_schema}" ) ) )
684671 } ,
685- Err ( e) => {
686- return Err ( MsgHandleErrInternal :: send_err_msg_no_close (
687- format ! ( "Unexpected error: {e}" ) ,
688- * temporary_channel_id,
689- ) )
672+ Err ( RgbLibError :: Indexer { details } )
673+ | Err ( RgbLibError :: InvalidIndexer { details } )
674+ | Err ( RgbLibError :: Network { details } ) => {
675+ return Err ( ChannelError :: close ( format ! ( "Failed to connect to indexer: {details}" ) ) )
690676 } ,
677+ Err ( e) => return Err ( ChannelError :: close ( format ! ( "Unexpected error: {e}" ) ) ) ,
691678 } ;
692679
693680 let consignment_path = ldk_data_dir. join ( format ! ( "consignment_{}" , funding_txid) ) ;
@@ -697,10 +684,10 @@ pub(crate) fn handle_funding(
697684 consignment. save_file ( consignment_path) . expect ( "unable to write file" ) ;
698685
699686 if remote_rgb_assignments. len ( ) != 1 {
700- return Err ( MsgHandleErrInternal :: send_err_msg_no_close (
701- format ! ( "Unexpected number of RGB assignments: {}" , remote_rgb_assignments . len ( ) ) ,
702- * temporary_channel_id ,
703- ) ) ;
687+ return Err ( ChannelError :: close ( format ! (
688+ "Unexpected number of RGB assignments: {}" ,
689+ remote_rgb_assignments . len ( )
690+ ) ) ) ;
704691 }
705692 let channel_rgb_amount = match remote_rgb_assignments[ 0 ] {
706693 Assignment :: Fungible ( amt) => amt,
0 commit comments