mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 11:59:30 +00:00
Resolve error when rescanning a wallet
This commit is contained in:
parent
c3ed83f77d
commit
b56925d0d2
3 changed files with 36 additions and 19 deletions
|
@ -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",
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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"]!);
|
||||
|
||||
|
|
Loading…
Reference in a new issue