Skip to content

Commit

Permalink
hardcode NRD kernel during tx building
Browse files Browse the repository at this point in the history
  • Loading branch information
antiochp committed May 13, 2020
1 parent 1731960 commit 2c99ead
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions libwallet/src/slate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ use crate::error::{Error, ErrorKind};
use crate::grin_core::core::amount_to_hr_string;
use crate::grin_core::core::committed::Committed;
use crate::grin_core::core::transaction::{
Input, KernelFeatures, Output, Transaction, TransactionBody, TxKernel, Weighting,
Input, KernelFeatures, NRDRelativeHeight, Output, Transaction, TransactionBody, TxKernel,
Weighting,
};
use crate::grin_core::core::verifier_cache::LruVerifierCache;
use crate::grin_core::libtx::{aggsig, build, proof::ProofBuild, secp_ser, tx_fee};
Expand Down Expand Up @@ -349,12 +350,18 @@ impl Slate {
// Construct the appropriate kernel features based on our fee and lock_height.
// If lock_height is 0 then its a plain kernel, otherwise its a height locked kernel.
fn kernel_features(&self) -> KernelFeatures {
match self.lock_height {
0 => KernelFeatures::Plain { fee: self.fee },
_ => KernelFeatures::HeightLocked {
fee: self.fee,
lock_height: self.lock_height,
},
// match self.lock_height {
// 0 => KernelFeatures::Plain { fee: self.fee },
// _ => KernelFeatures::HeightLocked {
// fee: self.fee,
// lock_height: self.lock_height,
// },
// }

// ***** TESTING *****
KernelFeatures::NoRecentDuplicate {
fee: self.fee,
relative_height: NRDRelativeHeight::new(60).unwrap(),
}
}

Expand Down Expand Up @@ -1020,7 +1027,11 @@ impl From<&TxKernel> for TxKernelV4 {
KernelFeatures::NoRecentDuplicate {
fee,
relative_height,
} => xxx,
} => (
CompatKernelFeatures::NoRecentDuplicate,
fee,
relative_height.into(),
),
};
TxKernelV4 {
features,
Expand Down Expand Up @@ -1193,6 +1204,11 @@ impl From<&TxKernelV4> for TxKernel {
CompatKernelFeatures::Plain => KernelFeatures::Plain { fee },
CompatKernelFeatures::Coinbase => KernelFeatures::Coinbase,
CompatKernelFeatures::HeightLocked => KernelFeatures::HeightLocked { fee, lock_height },
CompatKernelFeatures::NoRecentDuplicate => KernelFeatures::NoRecentDuplicate {
fee,
relative_height: NRDRelativeHeight::new(lock_height)
.expect("a valid NRD relative height"),
},
};
TxKernel {
features,
Expand All @@ -1207,4 +1223,5 @@ pub enum CompatKernelFeatures {
Plain,
Coinbase,
HeightLocked,
NoRecentDuplicate,
}

0 comments on commit 2c99ead

Please sign in to comment.