From b9718bedbd5291587309de471be52362a9079370 Mon Sep 17 00:00:00 2001 From: julian Date: Fri, 23 Feb 2024 19:28:14 +0700 Subject: [PATCH 1/2] electrum/fulcrum bch output parse fix --- lib/wallets/wallet/impl/bitcoincash_wallet.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/wallets/wallet/impl/bitcoincash_wallet.dart b/lib/wallets/wallet/impl/bitcoincash_wallet.dart index 1128b6e6c..69476d484 100644 --- a/lib/wallets/wallet/impl/bitcoincash_wallet.dart +++ b/lib/wallets/wallet/impl/bitcoincash_wallet.dart @@ -182,6 +182,7 @@ class BitcoincashWallet extends Bip39HDWallet prevOutJson, decimalPlaces: cryptoCurrency.fractionDigits, walletOwns: false, // doesn't matter here as this is not saved + isFullAmountNotSats: true, ); outpoint = OutpointV2.isarCantDoRequiredInDefaultConstructor( @@ -227,6 +228,7 @@ class BitcoincashWallet extends Bip39HDWallet decimalPlaces: cryptoCurrency.fractionDigits, // don't know yet if wallet owns. Need addresses first walletOwns: false, + isFullAmountNotSats: true, ); // if output was to my wallet, add value to amount received From 0a2166b3fb6740ef22d819a2a0b2268f7dee60b1 Mon Sep 17 00:00:00 2001 From: julian Date: Fri, 23 Feb 2024 19:33:10 +0700 Subject: [PATCH 2/2] force reparse bch txns from cached electrumx responses on refresh to correct any parsing errors fixed by b9718bedbd5291587309de471be52362a9079370 --- .../wallet/impl/bitcoincash_wallet.dart | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/wallets/wallet/impl/bitcoincash_wallet.dart b/lib/wallets/wallet/impl/bitcoincash_wallet.dart index 69476d484..2b9355e2d 100644 --- a/lib/wallets/wallet/impl/bitcoincash_wallet.dart +++ b/lib/wallets/wallet/impl/bitcoincash_wallet.dart @@ -119,28 +119,28 @@ class BitcoincashWallet extends Bip39HDWallet List> allTransactions = []; for (final txHash in allTxHashes) { - final storedTx = await mainDB.isar.transactionV2s - .where() - .txidWalletIdEqualTo(txHash["tx_hash"] as String, walletId) - .findFirst(); + // final storedTx = await mainDB.isar.transactionV2s + // .where() + // .txidWalletIdEqualTo(txHash["tx_hash"] as String, walletId) + // .findFirst(); + // + // if (storedTx == null || + // storedTx.height == null || + // (storedTx.height != null && storedTx.height! <= 0)) { + final tx = await electrumXCachedClient.getTransaction( + txHash: txHash["tx_hash"] as String, + verbose: true, + coin: cryptoCurrency.coin, + ); - if (storedTx == null || - storedTx.height == null || - (storedTx.height != null && storedTx.height! <= 0)) { - final tx = await electrumXCachedClient.getTransaction( - txHash: txHash["tx_hash"] as String, - verbose: true, - coin: cryptoCurrency.coin, - ); - - // check for duplicates before adding to list - if (allTransactions - .indexWhere((e) => e["txid"] == tx["txid"] as String) == - -1) { - tx["height"] = txHash["height"]; - allTransactions.add(tx); - } + // check for duplicates before adding to list + if (allTransactions + .indexWhere((e) => e["txid"] == tx["txid"] as String) == + -1) { + tx["height"] = txHash["height"]; + allTransactions.add(tx); } + // } } final List txns = [];