Skip to content

Commit

Permalink
Update no_deadlock_in_multisig test to set the initial key in the DB
Browse files Browse the repository at this point in the history
  • Loading branch information
kayabaNerve committed May 10, 2024
1 parent 79a79db commit 02c4417
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions processor/src/tests/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
assert!(current_keys.is_empty());

let mut txn = db.txn();
// Register keys to cause Block events at CONFIRMATIONS (dropped since first keys),
// CONFIRMATIONS + 1, and CONFIRMATIONS + 2
for i in 0 .. 3 {
let key = {
let mut keys = key_gen(&mut OsRng);
for keys in keys.values_mut() {
N::tweak_keys(keys);
}
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,
{
let mut keys = key_gen(&mut OsRng);
for keys in keys.values_mut() {
N::tweak_keys(keys);
}
keys[&Participant::new(1).unwrap()].group_key()
},
key,
)
.await;
txn.commit();
}
txn.commit();

for _ in 0 .. (3 * N::CONFIRMATIONS) {
network.mine_block().await;
Expand Down

0 comments on commit 02c4417

Please sign in to comment.