Avoid unecessary move of the previous block header to build a block.

This commit is contained in:
Ignotus Peverell
2016-11-29 20:05:35 -08:00
parent 2e52b13c35
commit 55f5771a2a
+2 -2
View File
@@ -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<Block, secp::Error> {