diff --git a/chain/tests/mine_simple_chain.rs b/chain/tests/mine_simple_chain.rs
index 063746164..8fff8b7a6 100644
--- a/chain/tests/mine_simple_chain.rs
+++ b/chain/tests/mine_simple_chain.rs
@@ -263,7 +263,7 @@ fn spend_in_fork() {
let lock_height = 1 + global::coinbase_maturity();
assert_eq!(lock_height, 4);
- let (tx1, _) = build::transaction(
+ let tx1 = build::transaction(
vec![
build::coinbase_input(consensus::REWARD, block_hash, kc.derive_key_id(2).unwrap()),
build::output(consensus::REWARD - 20000, kc.derive_key_id(30).unwrap()),
@@ -276,7 +276,7 @@ fn spend_in_fork() {
let prev_main = next.header.clone();
chain.process_block(next.clone(), chain::Options::SKIP_POW).unwrap();
- let (tx2, _) = build::transaction(
+ let tx2 = build::transaction(
vec![
build::input(consensus::REWARD - 20000, next.hash(), kc.derive_key_id(30).unwrap()),
build::output(consensus::REWARD - 40000, kc.derive_key_id(31).unwrap()),
diff --git a/chain/tests/test_coinbase_maturity.rs b/chain/tests/test_coinbase_maturity.rs
index 99c0c6401..3d6d7d397 100644
--- a/chain/tests/test_coinbase_maturity.rs
+++ b/chain/tests/test_coinbase_maturity.rs
@@ -116,7 +116,7 @@ fn test_coinbase_maturity() {
// here we build a tx that attempts to spend the earlier coinbase output
// this is not a valid tx as the coinbase output cannot be spent yet
- let (coinbase_txn, _) = build::transaction(
+ let coinbase_txn = build::transaction(
vec![
build::coinbase_input(amount, block_hash, key_id1.clone()),
build::output(amount - 2, key_id2.clone()),
@@ -183,7 +183,7 @@ fn test_coinbase_maturity() {
let prev = chain.head_header().unwrap();
- let (coinbase_txn, _) = build::transaction(
+ let coinbase_txn = build::transaction(
vec![
build::coinbase_input(amount, block_hash, key_id1.clone()),
build::output(amount - 2, key_id2.clone()),
diff --git a/core/src/core/block.rs b/core/src/core/block.rs
index ce5ea24ae..47f030cb3 100644
--- a/core/src/core/block.rs
+++ b/core/src/core/block.rs
@@ -43,12 +43,13 @@ use util::kernel_sig_msg;
use util::LOGGER;
use global;
use keychain;
+use keychain::BlindingFactor;
/// Errors thrown by Block validation
#[derive(Debug, Clone, PartialEq)]
pub enum Error {
- /// The sum of output minus input commitments does not match the sum of
- /// kernel commitments
+ /// The sum of output minus input commitments does not
+ /// match the sum of kernel commitments
KernelSumMismatch,
/// Same as above but for the coinbase part of a block, including reward
CoinbaseSumMismatch,
@@ -126,6 +127,8 @@ pub struct BlockHeader {
pub difficulty: Difficulty,
/// Total accumulated difficulty since genesis block
pub total_difficulty: Difficulty,
+ /// The single aggregate "offset" that needs to be applied for all commitments to sum
+ pub kernel_offset: BlindingFactor,
}
impl Default for BlockHeader {
@@ -143,6 +146,7 @@ impl Default for BlockHeader {
kernel_root: ZERO_HASH,
nonce: 0,
pow: Proof::zero(proof_size),
+ kernel_offset: BlindingFactor::zero(),
}
}
}
@@ -164,6 +168,7 @@ impl Writeable for BlockHeader {
try!(writer.write_u64(self.nonce));
try!(self.difficulty.write(writer));
try!(self.total_difficulty.write(writer));
+ try!(self.kernel_offset.write(writer));
if writer.serialization_mode() != ser::SerializationMode::Hash {
try!(self.pow.write(writer));
@@ -184,6 +189,7 @@ impl Readable for BlockHeader {
let nonce = reader.read_u64()?;
let difficulty = Difficulty::read(reader)?;
let total_difficulty = Difficulty::read(reader)?;
+ let kernel_offset = BlindingFactor::read(reader)?;
let pow = Proof::read(reader)?;
Ok(BlockHeader {
@@ -201,6 +207,7 @@ impl Readable for BlockHeader {
nonce: nonce,
difficulty: difficulty,
total_difficulty: total_difficulty,
+ kernel_offset: kernel_offset,
})
}
}
@@ -284,7 +291,7 @@ pub struct Block {
pub inputs: Vec,
/// List of transaction outputs
pub outputs: Vec