Fix clippy lints related to `prost` API usage

This commit is contained in:
Jack Grigg 2022-11-03 05:02:39 +00:00
parent 379b703e6b
commit 587e1fa60b
2 changed files with 27 additions and 16 deletions

View File

@ -507,13 +507,15 @@ mod tests {
let enc_ciphertext = encryptor.encrypt_note_plaintext();
// Create a fake CompactBlock containing the note
let mut cb = CompactBlock::default();
cb.hash = {
let mut hash = vec![0; 32];
rng.fill_bytes(&mut hash);
hash
let mut cb = CompactBlock {
hash: {
let mut hash = vec![0; 32];
rng.fill_bytes(&mut hash);
hash
},
height: height.into(),
..Default::default()
};
cb.height = height.into();
// Add a random Sapling tx before ours
{

View File

@ -1059,10 +1059,15 @@ mod tests {
rng.fill_bytes(&mut txid);
ctx.hash = txid;
ctx.outputs.push(cout);
let mut cb = CompactBlock::default();
cb.height = u64::from(height);
cb.hash.resize(32, 0);
rng.fill_bytes(&mut cb.hash);
let mut cb = CompactBlock {
hash: {
let mut hash = vec![0; 32];
rng.fill_bytes(&mut hash);
hash
},
height: height.into(),
..Default::default()
};
cb.prev_hash.extend_from_slice(&prev_hash.0);
cb.vtx.push(ctx);
(cb, note.nf(&dfvk.fvk().vk.nk, 0))
@ -1082,8 +1087,7 @@ mod tests {
let rseed = generate_random_rseed(&network(), height, &mut rng);
// Create a fake CompactBlock containing the note
let mut cspend = CompactSaplingSpend::default();
cspend.nf = nf.to_vec();
let cspend = CompactSaplingSpend { nf: nf.to_vec() };
let mut ctx = CompactTx::default();
let mut txid = vec![0; 32];
rng.fill_bytes(&mut txid);
@ -1144,10 +1148,15 @@ mod tests {
}
});
let mut cb = CompactBlock::default();
cb.height = u64::from(height);
cb.hash.resize(32, 0);
rng.fill_bytes(&mut cb.hash);
let mut cb = CompactBlock {
hash: {
let mut hash = vec![0; 32];
rng.fill_bytes(&mut hash);
hash
},
height: height.into(),
..Default::default()
};
cb.prev_hash.extend_from_slice(&prev_hash.0);
cb.vtx.push(ctx);
cb