Remove replaced electrum transactions (#2738)

* fix: remove replaced btc transactions

* fix: remove replaced btc transactions

* remove debug print
This commit is contained in:
malik1004x
2025-12-17 19:18:03 +02:00
committed by GitHub
parent 3579d8c61f
commit d3ba966142
+11
View File
@@ -2311,10 +2311,21 @@ abstract class ElectrumWalletBase
final history = await electrumClient.getHistory(addressRecord.getScriptHash(network));
if (history.isNotEmpty) {
addressRecord.setAsUsed();
walletAddresses.clearLockIfMatches(addressRecord.type, addressRecord.address);
if(this is BitcoinWallet) {
//removes transactions no longer returned by the api, presumed replaced/invalid.
transactionHistory.transactions.removeWhere(
(hash, tx) =>
tx.outputAddresses != null &&
tx.outputAddresses!.contains(addressRecord.address) &&
!history.any((newTransaction) => newTransaction['tx_hash'] == hash),
);
}
await Future.wait(history.map((transaction) async {
txid = transaction['tx_hash'] as String;
final height = transaction['height'] as int;