pub fn put_account_state_sets(
        &self,
        account_state_sets: Vec<HashMap<AccountAddress, AccountStateBlob>>,
        first_version: Version,
        cs: &mut ChangeSet,
    ) -> Result<Vec<HashValue>> {
        let blob_sets = account_state_sets
            .into_iter()
            .map(|account_states| {
                account_states
                    .into_iter()
                    .map(|(addr, blob)| (addr.hash(), blob))
                    .collect::<Vec<_>>()
            })
            .collect::<Vec<_>>();

        let (new_root_hash_vec, tree_update_batch) =
            JellyfishMerkleTree::new(self).put_blob_sets(blob_sets, first_version)?;

        cs.counter_bumps.bump(
            LedgerCounter::NewStateNodes,
            tree_update_batch.node_batch.len(),
        );
        cs.counter_bumps.bump(
            LedgerCounter::NewStateLeaves,
            tree_update_batch.num_new_leaves,
        );
        add_node_batch(&mut cs.batch, &tree_update_batch.node_batch)?;

        cs.counter_bumps.bump(
            LedgerCounter::StaleStateNodes,
            tree_update_batch.stale_node_index_batch.len(),
        );
        cs.counter_bumps.bump(
            LedgerCounter::StaleStateLeaves,
            tree_update_batch.num_stale_leaves,
        );
        tree_update_batch
            .stale_node_index_batch
            .iter()
            .map(|row| cs.batch.put::<StaleNodeIndexSchema>(row, &()))
            .collect::<Result<Vec<()>>>()?;

        Ok(new_root_hash_vec)
    }
/// Put the results generated by `account_state_sets` to `batch` and return the result root
/// hashes for each write set.
Put the results generated by `account_state_sets` to `batch` and return the result root
hashes for each write set.
Put the results generated by ` account_state_sets ` to ` batch ` and return the result root hashes for each write set .
pub fn put_account_state_sets(
        &self,
        account_state_sets: Vec<HashMap<AccountAddress, AccountStateBlob>>,
        first_version: Version,
        cs: &mut ChangeSet,
    ) -> Result<Vec<HashValue>> {
        let blob_sets = account_state_sets
            .into_iter()
            .map(|account_states| {
                account_states
                    .into_iter()
                    .map(|(addr, blob)| (addr.hash(), blob))
                    .collect::<Vec<_>>()
            })
            .collect::<Vec<_>>();
        let (new_root_hash_vec, tree_update_batch) =
            JellyfishMerkleTree::new(self).put_blob_sets(blob_sets, first_version)?;
        cs.counter_bumps.bump(
            LedgerCounter::NewStateNodes,
            tree_update_batch.node_batch.len(),
        );
        cs.counter_bumps.bump(
            LedgerCounter::NewStateLeaves,
            tree_update_batch.num_new_leaves,
        );
        add_node_batch(&mut cs.batch, &tree_update_batch.node_batch)?;
        cs.counter_bumps.bump(
            LedgerCounter::StaleStateNodes,
            tree_update_batch.stale_node_index_batch.len(),
        );
        cs.counter_bumps.bump(
            LedgerCounter::StaleStateLeaves,
            tree_update_batch.num_stale_leaves,
        );
        tree_update_batch
            .stale_node_index_batch
            .iter()
            .map(|row| cs.batch.put::<StaleNodeIndexSchema>(row, &()))
            .collect::<Result<Vec<()>>>()?;
        Ok(new_root_hash_vec)
    }
pub fn put_account_state_sets ( & self , account_state_sets : Vec < HashMap < AccountAddress , AccountStateBlob > > , first_version : Version , cs : & mut ChangeSet , ) -> Result < Vec < HashValue > > { let blob_sets = account_state_sets . into_iter ( ) . map ( | account_states | { account_states . into_iter ( ) . map ( | ( addr , blob ) | ( addr . hash ( ) , blob ) ) . collect :: < Vec < _ > > ( ) } ) . collect :: < Vec < _ > > ( ) ; let ( new_root_hash_vec , tree_update_batch ) = JellyfishMerkleTree :: new ( self ) . put_blob_sets ( blob_sets , first_version ) ? ; cs . counter_bumps . bump ( LedgerCounter :: NewStateNodes , tree_update_batch . node_batch . len ( ) , ) ; cs . counter_bumps . bump ( LedgerCounter :: NewStateLeaves , tree_update_batch . num_new_leaves , ) ; add_node_batch ( & mut cs . batch , & tree_update_batch . node_batch ) ? ; cs . counter_bumps . bump ( LedgerCounter :: StaleStateNodes , tree_update_batch . stale_node_index_batch . len ( ) , ) ; cs . counter_bumps . bump ( LedgerCounter :: StaleStateLeaves , tree_update_batch . num_stale_leaves , ) ; tree_update_batch . stale_node_index_batch . iter ( ) . map ( | row | cs . batch . put :: < StaleNodeIndexSchema > ( row , & ( ) ) ) . collect :: < Result < Vec < ( ) > > > ( ) ? ; Ok ( new_root_hash_vec ) }
Put the results generated by `account_state_sets` to `batch` and return the result root
hashes for each write set.
Put the results generated by ` account_state_sets ` to ` batch ` and return the result root hashes for each write set .
&self
account_state_sets
Vec<HashMap<AccountAddress, AccountStateBlob>>
first_version
Version
cs
&mut ChangeSet
&self
account_state_sets
Vec<HashMap<AccountAddress, AccountStateBlob>>
first_version
Version
cs
&mut ChangeSet