mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-10-19 16:18:46 +02:00
reject invalid invoice locking (#798)
(cherry picked from commit 645363436d)
This commit is contained in:
@@ -184,6 +184,22 @@ fn invoice_tx_impl(test_dir: &'static str) -> Result<(), libwallet::Error> {
|
||||
)?;
|
||||
assert_eq!(slate.state, SlateState::Invoice2);
|
||||
|
||||
wallet::controller::owner_single_use(
|
||||
wallet2.clone(),
|
||||
mask2,
|
||||
PathBuf::from(test_dir),
|
||||
|api, m| {
|
||||
assert_eq!(
|
||||
api.tx_lock_outputs(m, &slate),
|
||||
Err(libwallet::Error::SlateState)
|
||||
);
|
||||
let (_, txs) = api.retrieve_txs(m, false, None, None, None)?;
|
||||
assert_eq!(txs.len(), 1);
|
||||
assert_eq!(txs[0].tx_type, libwallet::TxLogEntryType::TxReceived);
|
||||
Ok(())
|
||||
},
|
||||
)?;
|
||||
|
||||
// wallet 2 finalizes and posts
|
||||
wallet::controller::foreign_single_use(
|
||||
wallet2.clone(),
|
||||
|
||||
@@ -830,6 +830,9 @@ where
|
||||
K: Keychain,
|
||||
{
|
||||
let context = w.get_private_context(keychain_mask, slate.id.as_bytes())?;
|
||||
if slate.state == SlateState::Invoice2 && context.input_ids.is_empty() {
|
||||
return Err(Error::SlateState);
|
||||
}
|
||||
let mut excess_override = None;
|
||||
|
||||
let mut sl = slate.clone();
|
||||
|
||||
Reference in New Issue
Block a user