test contract accounts

This commit is contained in:
wiesche
2026-09-08 11:41:09 +02:00
parent 88e1e3b50a
commit f56d70dd17
2 changed files with 18 additions and 4 deletions
+18 -3
View File
@@ -145,13 +145,28 @@ fn contract_accounts_impl(test_dir: &'static str) -> Result<(), libwallet::Error
// check tx log as well // check tx log as well
let (_, txs) = api.retrieve_txs(m, true, None, None, None)?; let (_, txs) = api.retrieve_txs(m, true, None, None, None)?;
assert_eq!(txs.len(), 0); assert_eq!(txs.len(), 0);
// Do not fall back to another account when the active account has no funds
let progress = common::wallet_progress(api, m)?;
let err = api
.contract_new(
m,
&ContractNewArgsAPI {
setup_args: ContractSetupArgsAPI {
net_change: Some(-(reward as i64)),
selection_args: common::contract_selection_args(),
..Default::default()
},
..Default::default()
},
)
.unwrap_err();
assert!(matches!(err, libwallet::Error::NotEnoughFunds { .. }));
assert_eq!(common::wallet_progress(api, m)?, progress);
Ok(()) Ok(())
}, },
)?; )?;
// TODO: check what send_tx_slate_direct call does in accounts.rs test
// TODO: check that you can't call send on the default account because you have no funds
// Send a tx from wallet1::account1 -> wallet2::listener_account // Send a tx from wallet1::account1 -> wallet2::listener_account
{ {
wallet_inst!(wallet1, w); wallet_inst!(wallet1, w);
-1
View File
@@ -54,7 +54,6 @@ without a user confirmation step.
- Infer `--receive` and `--send` from the slate state. - Infer `--receive` and `--send` from the slate state.
- Revisit `remove_other_sigdata` before allowing more than two participants. - Revisit `remove_other_sigdata` before allowing more than two participants.
- Stop relying on TxLog offsets in contract tests. - Stop relying on TxLog offsets in contract tests.
- Finish the account-switching tests in `contract_accounts.rs`.
### Side-effects ### Side-effects