pub fn generate_entries_removing_bids(
    builder: &mut LmdbWasmTestBuilder,
    validators_diff: &ValidatorsDiff,
    new_snapshot: &SeigniorageRecipientsSnapshot,
) -> BTreeMap<Key, StoredValue> {
    let large_bids = find_large_bids(builder, new_snapshot);
    let to_unbid = validators_diff.removed.union(&large_bids);

    validators_diff
        .added
        .iter()
        .map(|pkey| {
            let amount = *new_snapshot
                .values()
                .next()
                .unwrap()
                .get(pkey)
                .unwrap()
                .stake();
            let account_hash = pkey.to_account_hash();
            let account = builder.get_account(account_hash).unwrap();
            (
                Key::Bid(account_hash),
                Bid::unlocked(
                    pkey.clone(),
                    account.main_purse(),
                    amount,
                    Default::default(),
                )
                .into(),
            )
        })
        .chain(to_unbid.into_iter().map(|pkey| {
            let account_hash = pkey.to_account_hash();
            let account = builder.get_account(account_hash).unwrap();
            (
                Key::Bid(account_hash),
                Bid::empty(pkey.clone(), account.main_purse()).into(),
            )
        }))
        .collect()
}
/// Generates a set of writes necessary to "fix" the bids, ie.:
/// - set the bids of the new validators to their desired stakes,
/// - remove the bids of the old validators that are no longer validators,
/// - remove all the bids that are larger than the smallest bid among the new validators
/// (necessary, because such bidders would outbid the validators decided by the social consensus).
Generates a set of writes necessary to "fix" the bids, ie.:
set the bids of the new validators to their desired stakes,
remove the bids of the old validators that are no longer validators,
remove all the bids that are larger than the smallest bid among the new validators
(necessary, because such bidders would outbid the validators decided by the social consensus).
Generates a set of writes necessary to " fix " the bids ie . : set the bids of the new validators to their desired stakes remove the bids of the old validators that are no longer validators remove all the bids that are larger than the smallest bid among the new validators ( necessary because such bidders would outbid the validators decided by the social consensus ) .
pub fn generate_entries_removing_bids(
    builder: &mut LmdbWasmTestBuilder,
    validators_diff: &ValidatorsDiff,
    new_snapshot: &SeigniorageRecipientsSnapshot,
) -> BTreeMap<Key, StoredValue> {
    let large_bids = find_large_bids(builder, new_snapshot);
    let to_unbid = validators_diff.removed.union(&large_bids);
    validators_diff
        .added
        .iter()
        .map(|pkey| {
            let amount = *new_snapshot
                .values()
                .next()
                .unwrap()
                .get(pkey)
                .unwrap()
                .stake();
            let account_hash = pkey.to_account_hash();
            let account = builder.get_account(account_hash).unwrap();
            (
                Key::Bid(account_hash),
                Bid::unlocked(
                    pkey.clone(),
                    account.main_purse(),
                    amount,
                    Default::default(),
                )
                .into(),
            )
        })
        .chain(to_unbid.into_iter().map(|pkey| {
            let account_hash = pkey.to_account_hash();
            let account = builder.get_account(account_hash).unwrap();
            (
                Key::Bid(account_hash),
                Bid::empty(pkey.clone(), account.main_purse()).into(),
            )
        }))
        .collect()
}
pub fn generate_entries_removing_bids ( builder : & mut LmdbWasmTestBuilder , validators_diff : & ValidatorsDiff , new_snapshot : & SeigniorageRecipientsSnapshot , ) -> BTreeMap < Key , StoredValue > { let large_bids = find_large_bids ( builder , new_snapshot ) ; let to_unbid = validators_diff . removed . union ( & large_bids ) ; validators_diff . added . iter ( ) . map ( | pkey | { let amount = * new_snapshot . values ( ) . next ( ) . unwrap ( ) . get ( pkey ) . unwrap ( ) . stake ( ) ; let account_hash = pkey . to_account_hash ( ) ; let account = builder . get_account ( account_hash ) . unwrap ( ) ; ( Key :: Bid ( account_hash ) , Bid :: unlocked ( pkey . clone ( ) , account . main_purse ( ) , amount , Default :: default ( ) , ) . into ( ) , ) } ) . chain ( to_unbid . into_iter ( ) . map ( | pkey | { let account_hash = pkey . to_account_hash ( ) ; let account = builder . get_account ( account_hash ) . unwrap ( ) ; ( Key :: Bid ( account_hash ) , Bid :: empty ( pkey . clone ( ) , account . main_purse ( ) ) . into ( ) , ) } ) ) . collect ( ) }
Generates a set of writes necessary to "fix" the bids, ie.
Generates a set of writes necessary to " fix " the bids ie .
builder
&mut LmdbWasmTestBuilder
validators_diff
&ValidatorsDiff
new_snapshot
&SeigniorageRecipientsSnapshot
builder
&mut LmdbWasmTestBuilder
validators_diff
&ValidatorsDiff
new_snapshot
&SeigniorageRecipientsSnapshot