reject invalid invoice locking (#798)

(cherry picked from commit 645363436d)
This commit is contained in:
wiesche
2026-10-11 00:45:56 +03:00
committed by ardocrat
parent 2daa36f748
commit 78ae279bdf
2 changed files with 19 additions and 0 deletions
+16
View File
@@ -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(),
+3
View File
@@ -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();