From 12b2eb8137914aa5e02ba52ac72d5a1a932d8ac7 Mon Sep 17 00:00:00 2001
From: antiochp <30642645+antiochp@users.noreply.github.com>
Date: Fri, 28 Feb 2020 15:15:38 +0000
Subject: [PATCH 1/3] simplify when block_sums and spent_index are added to the
db
---
chain/src/chain.rs | 6 ++---
chain/src/pipe.rs | 45 +++++++++++++++-----------------
chain/src/store.rs | 2 +-
chain/src/txhashset/txhashset.rs | 7 ++---
4 files changed, 29 insertions(+), 31 deletions(-)
diff --git a/chain/src/chain.rs b/chain/src/chain.rs
index f3846377e8..a026a6d619 100644
--- a/chain/src/chain.rs
+++ b/chain/src/chain.rs
@@ -957,7 +957,7 @@ impl Chain {
// Save the block_sums (utxo_sum, kernel_sum) to the db for use later.
batch.save_block_sums(
&header.hash(),
- &BlockSums {
+ BlockSums {
utxo_sum,
kernel_sum,
},
@@ -1480,7 +1480,7 @@ fn setup_head(
// Save the block_sums to the db for use later.
batch.save_block_sums(
&header.hash(),
- &BlockSums {
+ BlockSums {
utxo_sum,
kernel_sum,
},
@@ -1542,7 +1542,7 @@ fn setup_head(
})?;
// Save the block_sums to the db for use later.
- batch.save_block_sums(&genesis.hash(), &sums)?;
+ batch.save_block_sums(&genesis.hash(), sums)?;
info!("init: saved genesis: {:?}", genesis.hash());
}
diff --git a/chain/src/pipe.rs b/chain/src/pipe.rs
index 2161dd71c5..1f40c55d82 100644
--- a/chain/src/pipe.rs
+++ b/chain/src/pipe.rs
@@ -23,7 +23,7 @@ use crate::core::pow;
use crate::error::{Error, ErrorKind};
use crate::store;
use crate::txhashset;
-use crate::types::{CommitPos, Options, Tip};
+use crate::types::{Options, Tip};
use crate::util::RwLock;
use grin_store;
use std::sync::Arc;
@@ -121,7 +121,7 @@ pub fn process_block(b: &Block, ctx: &mut BlockContext<'_>) -> Result