Add check_transaction_alone and scan transactions in mempool

This commit is contained in:
NicolasCantu 2025-01-01 11:48:51 +01:00 committed by Nicolas Cantu
parent eb470c1294
commit b82196e286
2 changed files with 18 additions and 0 deletions

View File

@ -226,6 +226,13 @@ fn create_new_tx_message(transaction: Vec<u8>) -> Result<NewTxMessage> {
}
let partial_tweak = compute_partial_tweak_to_transaction(&tx)?;
let found = check_transaction_alone(&tx, &partial_tweak)?;
if found.len() > 0 {
debug!("Found {} modified outputs in {}", found.len(), tx.txid());
}
Ok(NewTxMessage::new(
transaction.to_lower_hex_string(),
Some(partial_tweak.to_string()),

View File

@ -82,6 +82,17 @@ fn get_script_to_secret_map(
Ok(res)
}
pub fn check_transaction_alone(tx: &Transaction, tweak_data: &PublicKey) -> Result<HashMap<OutPoint, OwnedOutput>> {
let sp_wallet = WALLET.get().ok_or(Error::msg("Wallet not initialized"))?;
let updates = sp_wallet.get_wallet()?.update_wallet_with_transaction(tx, 0, *tweak_data)?;
if updates.len() > 0 {
sp_wallet.save()?;
}
Ok(updates)
}
fn check_block(
blkfilter: BlockFilter,
blkhash: BlockHash,