Optimize decoy selection

Saves roughly 0.8s when running the tests, which took 16.6s and now take 
15.8 (5%).

Removes the larger sample size, which replaced the closest selected 
decoy with the real spend, per advice of Rucknium.
This commit is contained in:
Luke Parker
2022-05-28 03:17:02 -04:00
parent 469ce9106b
commit ba032cca4a
3 changed files with 78 additions and 68 deletions

View File

@@ -25,10 +25,8 @@ pub async fn rpc() -> Rpc {
PublicKey { point: (&random_scalar(&mut OsRng) * &ED25519_BASEPOINT_TABLE).compress() }
).to_string();
// Mine enough blocks decoy selection doesn't fail
for _ in 0 .. 1 {
mine_block(&rpc, &addr).await.unwrap();
}
// Mine 10 blocks so we have 10 decoys so decoy selection doesn't fail
mine_block(&rpc, &addr).await.unwrap();
rpc
}