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(); let enc_ciphertext = encryptor.encrypt_note_plaintext();
// Create a fake CompactBlock containing the note // Create a fake CompactBlock containing the note
let mut cb = CompactBlock::default(); let mut cb = CompactBlock {
cb.hash = { hash: {
let mut hash = vec![0; 32]; let mut hash = vec![0; 32];
rng.fill_bytes(&mut hash); rng.fill_bytes(&mut hash);
hash hash
},
height: height.into(),
..Default::default()
}; };
cb.height = height.into();
// Add a random Sapling tx before ours // Add a random Sapling tx before ours
{ {

View File

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