Merge branch 'fix-rescan-error' into electrumx

This commit is contained in:
sneurlax 2024-02-06 12:31:31 -06:00
commit 53931eda32
3 changed files with 36 additions and 19 deletions

View file

@ -600,7 +600,6 @@ class ElectrumXClient {
scripthash,
],
);
result = response["result"];
retryCount--;
}
@ -749,15 +748,22 @@ class ElectrumXClient {
return {"rawtx": response["result"] as String};
}
if (response["result"] == null) {
if (response is List) {
Logging.instance.log(
"getTransaction($txHash) returned null response",
level: LogLevel.Error,
);
throw 'getTransaction($txHash) returned null response';
} else {
if (response["result"] == null) {
Logging.instance.log(
"getTransaction($txHash) returned null response",
level: LogLevel.Error,
);
throw 'getTransaction($txHash) returned null response';
}
return Map<String, dynamic>.from(response["result"] as Map);
}
return Map<String, dynamic>.from(response["result"] as Map);
} catch (e) {
Logging.instance.log(
"getTransaction($txHash) response: $response",

View file

@ -174,22 +174,31 @@ class BitcoincashWallet extends Bip39HDWallet
coin: cryptoCurrency.coin,
);
final prevOutJson = Map<String, dynamic>.from(
(inputTx["vout"] as List).firstWhere((e) => e["n"] == vout)
as Map);
try {
final prevOutJson = Map<String, dynamic>.from(
(inputTx["vout"] as List).firstWhere((e) => e["n"] == vout)
as Map);
final prevOut = OutputV2.fromElectrumXJson(
prevOutJson,
decimalPlaces: cryptoCurrency.fractionDigits,
walletOwns: false, // doesn't matter here as this is not saved
);
outpoint = OutpointV2.isarCantDoRequiredInDefaultConstructor(
txid: txid,
vout: vout,
);
valueStringSats = prevOut.valueStringSats;
addresses.addAll(prevOut.addresses);
} catch (e, s) {
Logging.instance.log(
"Error getting prevOutJson"
": $e\n$s",
level: LogLevel.Warning,
);
}
final prevOut = OutputV2.fromElectrumXJson(
prevOutJson,
decimalPlaces: cryptoCurrency.fractionDigits,
walletOwns: false, // doesn't matter here as this is not saved
);
outpoint = OutpointV2.isarCantDoRequiredInDefaultConstructor(
txid: txid,
vout: vout,
);
valueStringSats = prevOut.valueStringSats;
addresses.addAll(prevOut.addresses);
}
InputV2 input = InputV2.isarCantDoRequiredInDefaultConstructor(

View file

@ -1023,7 +1023,9 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
print("123123123");
print(counts);
}
int count = counts["${_id}_$k"]!;
int count = (counts["${_id}_$k"] == null) ? 0 : counts["${_id}_$k"]!;
if (count > 0) {
iterationsAddressArray.add(txCountCallArgs["${_id}_$k"]!);