Skip to content

Commit c724e21

Browse files
committed
check asset schema is supported on funding request
1 parent dc4e657 commit c724e21

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lightning/src/rgb_utils/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use commit_verify::mpc::MerkleBlock;
2323
use rgb::BlockchainResolver;
2424
use rgb_core::validation::Validity;
2525
use rgb_core::{Operation, Assign, Anchor, TransitionBundle};
26-
use rgb_lib::BitcoinNetwork;
26+
use rgb_lib::{BitcoinNetwork, AssetSchema};
2727
use rgb_lib::utils::{load_rgb_runtime, RgbRuntime};
2828
use serde::{Deserialize, Serialize};
2929
use rgbstd::Txid as RgbTxid;
@@ -558,6 +558,11 @@ pub(crate) fn handle_funding(temporary_channel_id: &[u8; 32], funding_txid: Stri
558558
let consignment_path = ldk_data_dir.join(format!("consignment_{}", hex::encode(temporary_channel_id)));
559559
fs::write(consignment_path.clone(), consignment_bytes).expect("unable to write file");
560560
let consignment = Bindle::<RgbTransfer>::load(consignment_path).expect("successful consignment load");
561+
let schema_id = consignment.schema_id().to_string();
562+
match AssetSchema::from_schema_id(schema_id) {
563+
Ok(AssetSchema::Nia) => {}
564+
_ => return Err(MsgHandleErrInternal::send_err_msg_no_close("Unsupported RGB schema".to_owned(), *temporary_channel_id))
565+
}
561566
let transfer: RgbTransfer = consignment.clone().unbindle();
562567

563568
let mut runtime = get_rgb_runtime(ldk_data_dir);

0 commit comments

Comments
 (0)