diff --git a/controller/tests/invoice.rs b/controller/tests/invoice.rs index 3713d5e..006d5d4 100644 --- a/controller/tests/invoice.rs +++ b/controller/tests/invoice.rs @@ -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(), diff --git a/libwallet/src/api_impl/owner.rs b/libwallet/src/api_impl/owner.rs index 638c608..44aecae 100644 --- a/libwallet/src/api_impl/owner.rs +++ b/libwallet/src/api_impl/owner.rs @@ -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();