From 55f5771a2ac91d6c0f6f84f0b5e3350c2f32bfe9 Mon Sep 17 00:00:00 2001 From: Ignotus Peverell Date: Tue, 29 Nov 2016 20:05:35 -0800 Subject: [PATCH] Avoid unecessary move of the previous block header to build a block. --- core/src/core/block.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/core/block.rs b/core/src/core/block.rs index c2750f467..318eb6c66 100644 --- a/core/src/core/block.rs +++ b/core/src/core/block.rs @@ -80,7 +80,7 @@ impl Writeable for BlockHeader { // avoid complicating PoW try!(writer.write_u64(self.nonce)); // cuckoo cycle of 42 nodes - for n in 0..42 { + for n in 0..PROOFSIZE { try!(writer.write_u32(self.pow.0[n])); } Ok(()) @@ -211,7 +211,7 @@ impl Block { /// Builds a new block from the header of the previous block, a vector of /// transactions and the private key that will receive the reward. Checks /// that all transactions are valid and calculates the Merkle tree. - pub fn new(prev: BlockHeader, + pub fn new(prev: &BlockHeader, txs: Vec<&mut Transaction>, reward_key: SecretKey) -> Result {