[Floonet] add feature for height locked kernels (#2168)

* add feature for height locked kernels

* add function to compute kernel features appropriate for lock height, and use it

* only sign kernel-features relevant fields; refactor Features

* simplify invalid kernel logic

* remove unused height arg to reward::output and run some rustfmt

* replace nested if/else by match
This commit is contained in:
John Tromp
2018-12-18 19:26:34 +01:00
committed by Yeastplume
parent aa9da6838b
commit f43df5f601
26 changed files with 175 additions and 124 deletions
+2 -2
View File
@@ -44,8 +44,8 @@ pub fn get_output(
// For now we can just try both (but this probably needs to be part of the api
// params)
let outputs = [
OutputIdentifier::new(OutputFeatures::DEFAULT_OUTPUT, &commit),
OutputIdentifier::new(OutputFeatures::COINBASE_OUTPUT, &commit),
OutputIdentifier::new(OutputFeatures::PLAIN, &commit),
OutputIdentifier::new(OutputFeatures::COINBASE, &commit),
];
for x in outputs.iter() {
+2 -9
View File
@@ -251,10 +251,7 @@ impl OutputPrintable {
block_header: Option<&core::BlockHeader>,
include_proof: bool,
) -> OutputPrintable {
let output_type = if output
.features
.contains(core::transaction::OutputFeatures::COINBASE_OUTPUT)
{
let output_type = if output.is_coinbase() {
OutputType::Coinbase
} else {
OutputType::Transaction
@@ -278,11 +275,7 @@ impl OutputPrintable {
// We require the rewind() to be stable even after the PMMR is pruned and
// compacted so we can still recreate the necessary proof.
let mut merkle_proof = None;
if output
.features
.contains(core::transaction::OutputFeatures::COINBASE_OUTPUT)
&& !spent && block_header.is_some()
{
if output.is_coinbase() && !spent && block_header.is_some() {
merkle_proof = chain.get_merkle_proof(&out_id, &block_header.unwrap()).ok()
};