fee and lock_height maintained in kernel features variants (#2859)

* fee and lock_height now maintained in kernel features enum variants

* sum fees via explicit enum variants

* cleanup semantics around with_fee and with_lock_height for tx builders

* document the kernel feature variants

* serialize kernel features correctly for api json

* cleanup

* commit

* bump to unstick azure
This commit is contained in:
Antioch Peverell
2019-08-19 14:28:02 +01:00
committed by GitHub
parent d220410571
commit 6036b671e8
10 changed files with 218 additions and 142 deletions
+10 -3
View File
@@ -17,6 +17,7 @@ use std::sync::Arc;
use crate::chain;
use crate::core::core::hash::Hashed;
use crate::core::core::merkle_proof::MerkleProof;
use crate::core::core::KernelFeatures;
use crate::core::{core, ser};
use crate::p2p;
use crate::util;
@@ -488,10 +489,16 @@ pub struct TxKernelPrintable {
impl TxKernelPrintable {
pub fn from_txkernel(k: &core::TxKernel) -> TxKernelPrintable {
let features = k.features.as_string();
let (fee, lock_height) = match k.features {
KernelFeatures::Plain { fee } => (fee, 0),
KernelFeatures::Coinbase => (0, 0),
KernelFeatures::HeightLocked { fee, lock_height } => (fee, lock_height),
};
TxKernelPrintable {
features: format!("{:?}", k.features),
fee: k.fee,
lock_height: k.lock_height,
features,
fee,
lock_height,
excess: util::to_hex(k.excess.0.to_vec()),
excess_sig: util::to_hex(k.excess_sig.to_raw_data().to_vec()),
}