Bitcoin keys now load into SideNode

This commit is contained in:
Dave Hrycyszyn
2024-06-18 17:03:31 +01:00
parent 706a671902
commit 8e7d24ec7b
3 changed files with 24 additions and 11 deletions

View File

@@ -2,7 +2,9 @@ use bft_json_crdt::{
json_crdt::{BaseCrdt, SignedOp},
keypair::make_keypair,
};
use side_node::{crdt::TransactionList, node::SideNode, utils, websocket::WebSocketClient};
use side_node::{
bitcoin_keys, crdt::TransactionList, node::SideNode, utils, websocket::WebSocketClient,
};
use tokio::sync::mpsc;
#[tokio::test]
@@ -34,9 +36,9 @@ async fn test_distribute_via_websockets() {
/// Wire everything up, ignoring things we are not using in the test
async fn setup(_: &str) -> SideNode {
// First, load up the keys and create a bft-crdt
let keys = make_keypair();
let bitcoin_keys = bitcoin::secp256k1::Keypair::new();
let crdt = BaseCrdt::<TransactionList>::new(&keys);
let bft_crdt_keys = make_keypair();
let bitcoin_keys = bitcoin_keys::make_keypair();
let crdt = BaseCrdt::<TransactionList>::new(&bft_crdt_keys);
// Channels for internal communication, and a tokio task for stdin input
let (incoming_sender, incoming_receiver) = mpsc::channel::<SignedOp>(32);
@@ -44,6 +46,13 @@ async fn setup(_: &str) -> SideNode {
// Finally, create the node and return it
let handle = WebSocketClient::new(incoming_sender).await;
let node = SideNode::new(crdt, keys, incoming_receiver, stdin_receiver, handle);
let node = SideNode::new(
crdt,
bft_crdt_keys,
bitcoin_keys,
incoming_receiver,
stdin_receiver,
handle,
);
node
}