Fill BlindingFactor with zeros on Drop (#2847)
* Implement simple zeroing of BlindingFactor in Drop * rustfmt * Make Debug implementation for BlindingFactor empty * Implement BlindingFactor zeroing unit test * mnemonic.rs: fix deprecated warning in test_bip39_random test * Use zeroize crate to clear BlindingFactor * Fix comment and implement dummy Debug trait for BlindingFactor * Fix formatter
This commit is contained in:
@@ -384,7 +384,7 @@ impl BlockHeader {
|
||||
|
||||
/// Total kernel offset for the chain state up to and including this block.
|
||||
pub fn total_kernel_offset(&self) -> BlindingFactor {
|
||||
self.total_kernel_offset
|
||||
self.total_kernel_offset.clone()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -560,8 +560,10 @@ impl Block {
|
||||
.with_kernel(reward_kern);
|
||||
|
||||
// Now add the kernel offset of the previous block for a total
|
||||
let total_kernel_offset =
|
||||
committed::sum_kernel_offsets(vec![agg_tx.offset, prev.total_kernel_offset], vec![])?;
|
||||
let total_kernel_offset = committed::sum_kernel_offsets(
|
||||
vec![agg_tx.offset.clone(), prev.total_kernel_offset.clone()],
|
||||
vec![],
|
||||
)?;
|
||||
|
||||
let now = Utc::now().timestamp();
|
||||
let timestamp = DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp(now, 0), Utc);
|
||||
@@ -698,7 +700,7 @@ impl Block {
|
||||
// verify.body.outputs and kernel sums
|
||||
let (_utxo_sum, kernel_sum) = self.verify_kernel_sums(
|
||||
self.header.overage(),
|
||||
self.block_kernel_offset(*prev_kernel_offset)?,
|
||||
self.block_kernel_offset(prev_kernel_offset.clone())?,
|
||||
)?;
|
||||
|
||||
Ok(kernel_sum)
|
||||
|
||||
@@ -957,7 +957,7 @@ impl Transaction {
|
||||
) -> Result<(), Error> {
|
||||
self.body.validate(weighting, verifier)?;
|
||||
self.body.verify_features()?;
|
||||
self.verify_kernel_sums(self.overage(), self.offset)?;
|
||||
self.verify_kernel_sums(self.overage(), self.offset.clone())?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ where
|
||||
{
|
||||
Box::new(
|
||||
move |_build, (tx, kern, sum)| -> (Transaction, TxKernel, BlindSum) {
|
||||
(tx.with_offset(offset), kern, sum)
|
||||
(tx.with_offset(offset.clone()), kern, sum)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user