Add check_transaction_alone and scan transactions in mempool
This commit is contained in:
parent
eb470c1294
commit
b82196e286
@ -226,6 +226,13 @@ fn create_new_tx_message(transaction: Vec<u8>) -> Result<NewTxMessage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let partial_tweak = compute_partial_tweak_to_transaction(&tx)?;
|
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(
|
Ok(NewTxMessage::new(
|
||||||
transaction.to_lower_hex_string(),
|
transaction.to_lower_hex_string(),
|
||||||
Some(partial_tweak.to_string()),
|
Some(partial_tweak.to_string()),
|
||||||
|
11
src/scan.rs
11
src/scan.rs
@ -82,6 +82,17 @@ fn get_script_to_secret_map(
|
|||||||
Ok(res)
|
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(
|
fn check_block(
|
||||||
blkfilter: BlockFilter,
|
blkfilter: BlockFilter,
|
||||||
blkhash: BlockHash,
|
blkhash: BlockHash,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user