mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
Remove replaced electrum transactions (#2738)
* fix: remove replaced btc transactions * fix: remove replaced btc transactions * remove debug print
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user