Reduce visibility of Hash
struct contents
This commit is contained in:
@ -740,7 +740,7 @@ mod tests {
|
|||||||
message.account_keys.push(pubkey1);
|
message.account_keys.push(pubkey1);
|
||||||
message.account_keys.push(pubkey1);
|
message.account_keys.push(pubkey1);
|
||||||
message.header.num_required_signatures = NUM_SIG as u8;
|
message.header.num_required_signatures = NUM_SIG as u8;
|
||||||
message.recent_blockhash = Hash(pubkey1.to_bytes());
|
message.recent_blockhash = Hash::new_from_array(pubkey1.to_bytes());
|
||||||
let mut tx = Transaction::new_unsigned(message);
|
let mut tx = Transaction::new_unsigned(message);
|
||||||
|
|
||||||
info!("message: {:?}", tx.message_data());
|
info!("message: {:?}", tx.message_data());
|
||||||
|
@ -34,7 +34,7 @@ impl ReplicaAccountInfo {
|
|||||||
});
|
});
|
||||||
ReplicaAccountInfo {
|
ReplicaAccountInfo {
|
||||||
account_meta,
|
account_meta,
|
||||||
hash: stored_account_meta.hash.0.to_vec(),
|
hash: stored_account_meta.hash.as_ref().to_vec(),
|
||||||
data,
|
data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ impl ReplicaAccountInfo {
|
|||||||
});
|
});
|
||||||
ReplicaAccountInfo {
|
ReplicaAccountInfo {
|
||||||
account_meta,
|
account_meta,
|
||||||
hash: cached_account.hash().0.to_vec(),
|
hash: cached_account.hash().as_ref().to_vec(),
|
||||||
data,
|
data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4300,7 +4300,9 @@ impl AccountsDb {
|
|||||||
hasher.update(owner.as_ref());
|
hasher.update(owner.as_ref());
|
||||||
hasher.update(pubkey.as_ref());
|
hasher.update(pubkey.as_ref());
|
||||||
|
|
||||||
Hash(<[u8; solana_sdk::hash::HASH_BYTES]>::try_from(hasher.finalize().as_slice()).unwrap())
|
Hash::new_from_array(
|
||||||
|
<[u8; solana_sdk::hash::HASH_BYTES]>::try_from(hasher.finalize().as_slice()).unwrap(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bulk_assign_write_version(&self, count: usize) -> StoredMetaWriteVersion {
|
fn bulk_assign_write_version(&self, count: usize) -> StoredMetaWriteVersion {
|
||||||
|
@ -26,7 +26,7 @@ const MAX_BASE58_LEN: usize = 44;
|
|||||||
AbiExample,
|
AbiExample,
|
||||||
)]
|
)]
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct Hash(pub [u8; HASH_BYTES]);
|
pub struct Hash(pub(crate) [u8; HASH_BYTES]);
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct Hasher {
|
pub struct Hasher {
|
||||||
|
@ -163,7 +163,7 @@ mod test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let lamports = 55;
|
let lamports = 55;
|
||||||
let hash = Hash([1; 32]);
|
let hash = Hash::new_from_array([1; 32]);
|
||||||
let vote = Vote {
|
let vote = Vote {
|
||||||
slots: vec![1, 2, 4],
|
slots: vec![1, 2, 4],
|
||||||
hash,
|
hash,
|
||||||
@ -289,7 +289,7 @@ mod test {
|
|||||||
);
|
);
|
||||||
assert!(parse_vote(&message.instructions[0], &keys[0..1]).is_err());
|
assert!(parse_vote(&message.instructions[0], &keys[0..1]).is_err());
|
||||||
|
|
||||||
let proof_hash = Hash([2; 32]);
|
let proof_hash = Hash::new_from_array([2; 32]);
|
||||||
let instruction = vote_instruction::vote_switch(&keys[1], &keys[0], vote, proof_hash);
|
let instruction = vote_instruction::vote_switch(&keys[1], &keys[0], vote, proof_hash);
|
||||||
let message = Message::new(&[instruction], None);
|
let message = Message::new(&[instruction], None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
Reference in New Issue
Block a user