pub fn check_account_proof(proof: &MerkleProof, acc: &Account) -> Result<BlockSeqNoAndShard> {
    if acc.is_none() {
        fail!(BlockError::InvalidData("Account can't be none".to_string()))
    }

    let ss_virt_root = proof.proof.clone().virtualize(1);
    let ss: ShardStateUnsplit = ShardStateUnsplit::construct_from(&mut ss_virt_root.into())?;

    let accounts = ss.read_accounts()
        .map_err(
            |err| BlockError::WrongMerkleProof(
                format!("Error extracting accounts dict from proof: {}", err)
            )
        )?;

    let shard_acc = accounts.get_serialized(acc.get_addr().unwrap().get_address());
    if let Ok(Some(shard_acc)) = shard_acc {
        let acc_root = shard_acc.account_cell();
        let acc_hash = Cell::hash(&acc_root, (max(acc_root.level(), 1) - 1) as usize);
        if acc.hash()? != acc_hash {
            fail!(BlockError::WrongMerkleProof("Wrong account's hash in proof".to_string()))
        } else {
            return Ok(
                BlockSeqNoAndShard {
                    seq_no: ss.seq_no(),
                    vert_seq_no: ss.vert_seq_no(),
                    shard_id: ss.shard().clone(),
                }
            );
        }
    } else {
        fail!(BlockError::WrongMerkleProof("No account in proof".to_string()))
    }
}
/// checks if account with given address is exist in shard state.
/// Proof must contain account's root cell
/// Returns info about the block corresponds to shard state the account belongs to.
checks if account with given address is exist in shard state.
Proof must contain account's root cell
Returns info about the block corresponds to shard state the account belongs to.
checks if account with given address is exist in shard state . Proof must contain account ' s root cell Returns info about the block corresponds to shard state the account belongs to .
pub fn check_account_proof(proof: &MerkleProof, acc: &Account) -> Result<BlockSeqNoAndShard> {
    if acc.is_none() {
        fail!(BlockError::InvalidData("Account can't be none".to_string()))
    }
    let ss_virt_root = proof.proof.clone().virtualize(1);
    let ss: ShardStateUnsplit = ShardStateUnsplit::construct_from(&mut ss_virt_root.into())?;
    let accounts = ss.read_accounts()
        .map_err(
            |err| BlockError::WrongMerkleProof(
                format!("Error extracting accounts dict from proof: {}", err)
            )
        )?;
    let shard_acc = accounts.get_serialized(acc.get_addr().unwrap().get_address());
    if let Ok(Some(shard_acc)) = shard_acc {
        let acc_root = shard_acc.account_cell();
        let acc_hash = Cell::hash(&acc_root, (max(acc_root.level(), 1) - 1) as usize);
        if acc.hash()? != acc_hash {
            fail!(BlockError::WrongMerkleProof("Wrong account's hash in proof".to_string()))
        } else {
            return Ok(
                BlockSeqNoAndShard {
                    seq_no: ss.seq_no(),
                    vert_seq_no: ss.vert_seq_no(),
                    shard_id: ss.shard().clone(),
                }
            );
        }
    } else {
        fail!(BlockError::WrongMerkleProof("No account in proof".to_string()))
    }
}
pub fn check_account_proof ( proof : & MerkleProof , acc : & Account ) -> Result < BlockSeqNoAndShard > { if acc . is_none ( ) { fail ! ( BlockError InvalidData ( " " to_string ( ) ) ) } let ss_virt_root = proof . proof . clone ( ) . virtualize ( 1 ) ; let ss : ShardStateUnsplit = ShardStateUnsplit :: construct_from ( & mut ss_virt_root . into ( ) ) ? ; let accounts = ss . read_accounts ( ) . map_err ( | err | BlockError :: WrongMerkleProof ( format ! ( " " err ) ) ) ? ; let shard_acc = accounts . get_serialized ( acc . get_addr ( ) . unwrap ( ) . get_address ( ) ) ; if let Ok ( Some ( shard_acc ) ) = shard_acc { let acc_root = shard_acc . account_cell ( ) ; let acc_hash = Cell :: hash ( & acc_root , ( max ( acc_root . level ( ) , 1 ) - 1 ) as usize ) ; if acc . hash ( ) ? != acc_hash { fail ! ( BlockError WrongMerkleProof ( " " to_string ( ) ) ) } else { return Ok ( BlockSeqNoAndShard { seq_no : ss . seq_no ( ) , vert_seq_no : ss . vert_seq_no ( ) , shard_id : ss . shard ( ) . clone ( ) , } ) ; } } else { fail ! ( BlockError WrongMerkleProof ( " " to_string ( ) ) ) } }
checks if account with given address is exist in shard state.
checks if account with given address is exist in shard state .
proof
&MerkleProof
acc
&Account
proof
&MerkleProof
acc
&Account