mirror of
https://github.com/mimblewimble/grin-wallet.git
synced 2025-01-20 19:11:09 +03:00
default to using a Plain kernel with no lock_height
when constructing txs via the wallet
This commit is contained in:
parent
db015960a9
commit
e3b5e5b1de
3 changed files with 24 additions and 3 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -10,6 +10,5 @@ target
|
|||
grin.log
|
||||
wallet.seed
|
||||
test_output
|
||||
wallet_data
|
||||
wallet/db
|
||||
wallet*
|
||||
.idea/
|
||||
|
|
|
@ -18,6 +18,7 @@ extern crate grin_wallet_controller as wallet;
|
|||
extern crate grin_wallet_impls as impls;
|
||||
extern crate grin_wallet_libwallet as libwallet;
|
||||
|
||||
use self::core::core::transaction;
|
||||
use self::core::global;
|
||||
use self::core::global::ChainTypes;
|
||||
use self::keychain::ExtKeychain;
|
||||
|
@ -106,9 +107,26 @@ fn basic_transaction_api(test_dir: &str) -> Result<(), libwallet::Error> {
|
|||
true, // select all outputs
|
||||
None, None,
|
||||
)?;
|
||||
|
||||
// Check we are creating a tx with the expected lock_height of 0.
|
||||
// We will check this produces a Plain kernel later.
|
||||
assert_eq!(0, slate.lock_height);
|
||||
|
||||
slate = client1.send_tx_slate_direct("wallet2", &slate_i)?;
|
||||
sender_api.tx_lock_outputs(&slate)?;
|
||||
sender_api.finalize_tx(&mut slate)?;
|
||||
|
||||
// Check we have a single kernel and that it is a Plain kernel (no lock_height).
|
||||
assert_eq!(slate.tx.kernels().len(), 1);
|
||||
assert_eq!(
|
||||
slate.tx.kernels().first().map(|k| k.lock_height).unwrap(),
|
||||
0
|
||||
);
|
||||
assert_eq!(
|
||||
slate.tx.kernels().first().map(|k| k.features).unwrap(),
|
||||
transaction::KernelFeatures::Plain
|
||||
);
|
||||
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
|
|
|
@ -38,7 +38,11 @@ where
|
|||
let mut slate = Slate::blank(num_participants);
|
||||
slate.amount = amount;
|
||||
slate.height = current_height;
|
||||
slate.lock_height = current_height;
|
||||
|
||||
// Set the lock_height explicitly to 0 here.
|
||||
// This will generate a Plain kernel (rather than a HeightLocked kernel).
|
||||
slate.lock_height = 0;
|
||||
|
||||
Ok(slate)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue