merge from 5.3.0 master release

This commit is contained in:
Yeastplume
2024-04-30 11:11:25 +01:00
12 changed files with 531 additions and 494 deletions
+11 -11
View File
@@ -1,6 +1,6 @@
[package]
name = "grin_wallet_controller"
version = "5.2.0-beta.1"
version = "5.3.0"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
description = "Controllers for grin wallet instantiation"
license = "Apache-2.0"
@@ -30,19 +30,19 @@ lazy_static = "1"
thiserror = "1"
qr_code = "1.1.0"
grin_wallet_util = { path = "../util", version = "5.2.0-beta.1" }
grin_wallet_api = { path = "../api", version = "5.2.0-beta.1" }
grin_wallet_impls = { path = "../impls", version = "5.2.0-beta.1" }
grin_wallet_libwallet = { path = "../libwallet", version = "5.2.0-beta.1" }
grin_wallet_config = { path = "../config", version = "5.2.0-beta.1" }
grin_wallet_util = { path = "../util", version = "5.3.0" }
grin_wallet_api = { path = "../api", version = "5.3.0" }
grin_wallet_impls = { path = "../impls", version = "5.3.0" }
grin_wallet_libwallet = { path = "../libwallet", version = "5.3.0" }
grin_wallet_config = { path = "../config", version = "5.3.0" }
##### Grin Imports
# For Release
#grin_core = "4.0.0"
#grin_keychain = "4.0.0"
#grin_util = "4.0.0"
#grin_api = "4.0.0"
# grin_core = "5.3.0"
# grin_keychain = "5.3.0"
# grin_util = "5.3.0"
# grin_api = "5.3.0"
# For beta release
@@ -72,7 +72,7 @@ remove_dir_all = "0.7"
##### Grin Imports
# For Release
# grin_chain = "4.0.0"
# grin_chain = "5.3.0"
# For beta release
+81
View File
@@ -207,6 +207,87 @@ fn invoice_tx_impl(test_dir: &'static str) -> Result<(), libwallet::Error> {
let _ = test_framework::award_blocks_to_wallet(&chain, wallet1.clone(), mask1, 3, false);
//bh += 3;
// As above, but use owner API to finalize
let mut slate = Slate::blank(2, true);
wallet::controller::owner_single_use(Some(wallet2.clone()), mask2, None, |api, m| {
// Wallet 2 inititates an invoice transaction, requesting payment
let args = IssueInvoiceTxArgs {
amount: reward * 2,
..Default::default()
};
slate = api.issue_invoice_tx(m, args)?;
Ok(())
})?;
assert_eq!(slate.state, SlateState::Invoice1);
wallet::controller::owner_single_use(Some(wallet1.clone()), mask1, None, |api, m| {
// Wallet 1 receives the invoice transaction
let args = InitTxArgs {
src_acct_name: None,
amount: slate.amount,
minimum_confirmations: 2,
max_outputs: 500,
num_change_outputs: 1,
selection_strategy_is_use_all: true,
..Default::default()
};
slate = api.process_invoice_tx(m, &slate, args)?;
api.tx_lock_outputs(m, &slate)?;
Ok(())
})?;
assert_eq!(slate.state, SlateState::Invoice2);
// wallet 2 finalizes via owner API
wallet::controller::owner_single_use(Some(wallet2.clone()), mask2, None, |api, m| {
// Wallet 2 receives the invoice transaction
slate = api.finalize_tx(m, &slate)?;
Ok(())
})?;
assert_eq!(slate.state, SlateState::Invoice3);
// test that payee can only cancel once
let _ = test_framework::award_blocks_to_wallet(&chain, wallet1.clone(), mask1, 3, false);
bh += 3;
wallet::controller::owner_single_use(Some(wallet2.clone()), mask2, None, |api, m| {
// Wallet 2 inititates an invoice transaction, requesting payment
let args = IssueInvoiceTxArgs {
amount: reward * 2,
..Default::default()
};
slate = api.issue_invoice_tx(m, args)?;
Ok(())
})?;
assert_eq!(slate.state, SlateState::Invoice1);
let orig_slate = slate.clone();
wallet::controller::owner_single_use(Some(wallet1.clone()), mask1, None, |api, m| {
// Wallet 1 receives the invoice transaction
let args = InitTxArgs {
src_acct_name: None,
amount: slate.amount,
minimum_confirmations: 2,
max_outputs: 500,
num_change_outputs: 1,
selection_strategy_is_use_all: true,
..Default::default()
};
slate = api.process_invoice_tx(m, &slate, args.clone())?;
api.tx_lock_outputs(m, &slate)?;
// Wallet 1 cancels the invoice transaction
api.cancel_tx(m, None, Some(slate.id))?;
// Wallet 1 attempts to repay again
let res = api.process_invoice_tx(m, &orig_slate, args);
assert!(res.is_err());
Ok(())
})?;
assert_eq!(slate.state, SlateState::Invoice2);
// let logging finish
stopper.store(false, Ordering::Relaxed);
thread::sleep(Duration::from_millis(200));