[bug] doesn't fail if checking already scanned transaction

This commit is contained in:
NicolasCantu 2025-01-02 22:36:41 +01:00 committed by Nicolas Cantu
parent a02a1e6625
commit 18da6da177

View File

@ -84,7 +84,13 @@ fn get_script_to_secret_map(
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)?;
let updates = match sp_wallet.get_wallet()?.update_wallet_with_transaction(tx, 0, *tweak_data) {
Ok(updates) => updates,
Err(e) => {
log::debug!("Error while checking transaction: {}", e);
HashMap::new()
}
};
if updates.len() > 0 {
sp_wallet.save()?;