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:
+10
-3
@@ -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()),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user