mirror of
https://github.com/stakwork/sphinx-key.git
synced 2025-12-19 00:04:25 +01:00
Check that broker and signer are on the same network
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
mod randomstartingtime;
|
||||
|
||||
use lightning_signer::bitcoin::blockdata::constants::ChainHash;
|
||||
use lightning_signer::node::NodeServices;
|
||||
use lightning_signer::persist::Persist;
|
||||
use lightning_signer::policy::filter::PolicyFilter;
|
||||
@@ -16,6 +17,7 @@ use vls_protocol::msgs::{self, read_serial_request_header, write_serial_response
|
||||
use vls_protocol::serde_bolt::WireString;
|
||||
use vls_protocol_signer::handler::{Handler, RootHandler};
|
||||
use vls_protocol_signer::lightning_signer::bitcoin::Network;
|
||||
use vls_protocol_signer::lightning_signer::wallet::Wallet;
|
||||
|
||||
pub use sphinx_key_parser::MsgDriver;
|
||||
pub use sphinx_key_persister::FsPersister;
|
||||
@@ -95,6 +97,15 @@ pub fn handle(
|
||||
_ => {}
|
||||
};
|
||||
|
||||
if let Message::HsmdInit(ref m) = message {
|
||||
if ChainHash::using_genesis_block(root_handler.node.network()).as_bytes()
|
||||
!= &m.chain_params.0
|
||||
{
|
||||
log::error!("The network setting of CLN and VLS don't match!");
|
||||
panic!("The network setting of CLN and VLS don't match!");
|
||||
}
|
||||
}
|
||||
|
||||
if do_log {
|
||||
log::info!("VLS msg: {:?}", message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user