Update no_deadlock_in_multisig test to set the initial key in the DB

This commit is contained in:
Luke Parker 2024-05-10 15:57:05 -04:00
parent 79a79db399
commit 02c4417a46
No known key found for this signature in database

View file

@ -126,25 +126,33 @@ pub async fn test_no_deadlock_in_multisig_completed<N: Network>(
let (mut scanner, current_keys) = Scanner::new(network.clone(), db.clone()); let (mut scanner, current_keys) = Scanner::new(network.clone(), db.clone());
assert!(current_keys.is_empty()); assert!(current_keys.is_empty());
let mut txn = db.txn();
// Register keys to cause Block events at CONFIRMATIONS (dropped since first keys), // Register keys to cause Block events at CONFIRMATIONS (dropped since first keys),
// CONFIRMATIONS + 1, and CONFIRMATIONS + 2 // CONFIRMATIONS + 1, and CONFIRMATIONS + 2
for i in 0 .. 3 { for i in 0 .. 3 {
scanner let key = {
.register_key(
&mut txn,
network.get_latest_block_number().await.unwrap() + N::CONFIRMATIONS + i,
{
let mut keys = key_gen(&mut OsRng); let mut keys = key_gen(&mut OsRng);
for keys in keys.values_mut() { for keys in keys.values_mut() {
N::tweak_keys(keys); N::tweak_keys(keys);
} }
keys[&Participant::new(1).unwrap()].group_key() let key = keys[&Participant::new(1).unwrap()].group_key();
}, if i == 0 {
let mut txn = db.txn();
NetworkKeyDb::set(&mut txn, Session(0), &key.to_bytes().as_ref().to_vec());
txn.commit();
}
key
};
let mut txn = db.txn();
scanner
.register_key(
&mut txn,
network.get_latest_block_number().await.unwrap() + N::CONFIRMATIONS + i,
key,
) )
.await; .await;
}
txn.commit(); txn.commit();
}
for _ in 0 .. (3 * N::CONFIRMATIONS) { for _ in 0 .. (3 * N::CONFIRMATIONS) {
network.mine_block().await; network.mine_block().await;