mirror of
https://github.com/stakwork/sphinx-key.git
synced 2026-02-23 16:44:21 +01:00
Add --mainnet argument to the broker to send a fixed random mainnet seed to the signer for initial mainnet testing
This commit is contained in:
@@ -6,8 +6,8 @@ use vls_protocol::model::Secret;
|
||||
use vls_protocol::{msgs, serde_bolt::WireString};
|
||||
use vls_proxy::util::{read_allowlist, read_integration_test_seed};
|
||||
|
||||
pub fn blocking_connect(tx: mpsc::Sender<ChannelRequest>) {
|
||||
let init_msg_2 = crate::init::make_init_msg().expect("could make init msg");
|
||||
pub fn blocking_connect(tx: mpsc::Sender<ChannelRequest>, mainnet: bool) {
|
||||
let init_msg_2 = crate::init::make_init_msg(mainnet).expect("could make init msg");
|
||||
let (reply_tx, reply_rx) = oneshot::channel();
|
||||
// Send a request to the MQTT handler to send to signer
|
||||
let request = ChannelRequest {
|
||||
@@ -20,8 +20,8 @@ pub fn blocking_connect(tx: mpsc::Sender<ChannelRequest>) {
|
||||
println!("REPLY {:?}", reply);
|
||||
}
|
||||
|
||||
pub async fn _connect(tx: mpsc::Sender<ChannelRequest>) {
|
||||
let init_msg_2 = crate::init::make_init_msg().expect("could make init msg");
|
||||
pub async fn _connect(tx: mpsc::Sender<ChannelRequest>, mainnet: bool) {
|
||||
let init_msg_2 = crate::init::make_init_msg(mainnet).expect("could make init msg");
|
||||
let (reply_tx, reply_rx) = oneshot::channel();
|
||||
// Send a request to the MQTT handler to send to signer
|
||||
let request = ChannelRequest {
|
||||
@@ -34,14 +34,18 @@ pub async fn _connect(tx: mpsc::Sender<ChannelRequest>) {
|
||||
println!("REPLY {:?}", reply);
|
||||
}
|
||||
|
||||
pub fn make_init_msg() -> anyhow::Result<Vec<u8>> {
|
||||
pub fn make_init_msg(mainnet: bool) -> anyhow::Result<Vec<u8>> {
|
||||
let allowlist = read_allowlist()
|
||||
.into_iter()
|
||||
.map(|s| WireString(s.as_bytes().to_vec()))
|
||||
.collect::<Vec<_>>();
|
||||
let seed = read_integration_test_seed()
|
||||
.map(|s| Secret(s))
|
||||
.or(Some(Secret([1; 32])));
|
||||
let seed = if mainnet {
|
||||
Some(Secret([0x8c, 0xe8, 0x62, 0xab, 0xd5, 0x6b, 0xb4, 0x6a, 0x61, 0x7f, 0xaf, 0x13, 0x50, 0xc1, 0xca, 0xf5, 0xb1, 0xee, 0x02, 0x97, 0xbf, 0xf3, 0xb8, 0xc9, 0x56, 0x63, 0x58, 0x9f, 0xec, 0x8c, 0x45, 0x79]))
|
||||
} else {
|
||||
read_integration_test_seed()
|
||||
.map(|s| Secret(s))
|
||||
.or(Some(Secret([1; 32])))
|
||||
};
|
||||
// FIXME remove this
|
||||
log::info!("allowlist {:?} seed {:?}", allowlist, seed);
|
||||
let init = msgs::HsmdInit2 {
|
||||
|
||||
@@ -46,7 +46,8 @@ fn main() -> anyhow::Result<()> {
|
||||
)
|
||||
.arg(Arg::from("--log-io ignored dev flag"))
|
||||
.arg(Arg::from("--version show a dummy version"))
|
||||
.arg(Arg::from("--test run a test against the embedded device"));
|
||||
.arg(Arg::from("--test run a test against the embedded device"))
|
||||
.arg(Arg::from("--mainnet send a fixed random mainnet seed to the signer"));
|
||||
let matches = app.get_matches();
|
||||
if matches.is_present("version") {
|
||||
// Pretend to be the right version, given to us by an env var
|
||||
@@ -69,7 +70,7 @@ fn main() -> anyhow::Result<()> {
|
||||
log::info!("=> connection status: {}", status);
|
||||
assert_eq!(status, true, "expected connected = true");
|
||||
// runtime.block_on(async {
|
||||
init::blocking_connect(tx.clone());
|
||||
init::blocking_connect(tx.clone(), matches.is_present("mainnet"));
|
||||
log::info!("=====> sent seed!");
|
||||
|
||||
// listen to reqs from CLN
|
||||
|
||||
Reference in New Issue
Block a user