Skip to content

Commit

Permalink
draft: change utxo_pool size distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
yancyribbens committed Nov 1, 2024
1 parent ab08bb8 commit 01ed2e4
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ mod tests {

use super::*;

const MAX_POOL_SIZE: usize = 20;
//const MAX_POOL_SIZE: usize = 20;

pub fn build_pool() -> Vec<Utxo> {
let amts = [27_336, 238, 9_225, 20_540, 35_590, 49_463, 6_331, 35_548, 50_363, 28_009];
Expand Down Expand Up @@ -144,12 +144,19 @@ mod tests {

impl<'a> Arbitrary<'a> for UtxoPool {
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> {
let len = u.arbitrary_len::<u64>()? % MAX_POOL_SIZE;
let iter = u.arbitrary_iter::<Utxo>()?;

let mut pool: Vec<Utxo> = Vec::with_capacity(len);
for _ in 0..len {
let utxo = Utxo::arbitrary(u)?;
pool.push(utxo);
let mut pool = Vec::new();
let mut count = 0;
for utxo in iter {
count += 1;

if count > 20 {
break;
}

let u = utxo?;
pool.push(u);
}

Ok(UtxoPool { utxos: pool })
Expand Down

0 comments on commit 01ed2e4

Please sign in to comment.