mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-23 07:38:49 +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,
|
scripthash,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
result = response["result"];
|
result = response["result"];
|
||||||
retryCount--;
|
retryCount--;
|
||||||
}
|
}
|
||||||
|
@ -749,6 +748,13 @@ class ElectrumXClient {
|
||||||
return {"rawtx": response["result"] as String};
|
return {"rawtx": response["result"] as String};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
if (response["result"] == null) {
|
||||||
Logging.instance.log(
|
Logging.instance.log(
|
||||||
"getTransaction($txHash) returned null response",
|
"getTransaction($txHash) returned null response",
|
||||||
|
@ -756,8 +762,8 @@ class ElectrumXClient {
|
||||||
);
|
);
|
||||||
throw 'getTransaction($txHash) returned null response';
|
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) {
|
} catch (e) {
|
||||||
Logging.instance.log(
|
Logging.instance.log(
|
||||||
"getTransaction($txHash) response: $response",
|
"getTransaction($txHash) response: $response",
|
||||||
|
|
|
@ -174,10 +174,10 @@ class BitcoincashWallet extends Bip39HDWallet
|
||||||
coin: cryptoCurrency.coin,
|
coin: cryptoCurrency.coin,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
final prevOutJson = Map<String, dynamic>.from(
|
final prevOutJson = Map<String, dynamic>.from(
|
||||||
(inputTx["vout"] as List).firstWhere((e) => e["n"] == vout)
|
(inputTx["vout"] as List).firstWhere((e) => e["n"] == vout)
|
||||||
as Map);
|
as Map);
|
||||||
|
|
||||||
final prevOut = OutputV2.fromElectrumXJson(
|
final prevOut = OutputV2.fromElectrumXJson(
|
||||||
prevOutJson,
|
prevOutJson,
|
||||||
decimalPlaces: cryptoCurrency.fractionDigits,
|
decimalPlaces: cryptoCurrency.fractionDigits,
|
||||||
|
@ -190,6 +190,15 @@ class BitcoincashWallet extends Bip39HDWallet
|
||||||
);
|
);
|
||||||
valueStringSats = prevOut.valueStringSats;
|
valueStringSats = prevOut.valueStringSats;
|
||||||
addresses.addAll(prevOut.addresses);
|
addresses.addAll(prevOut.addresses);
|
||||||
|
} catch (e, s) {
|
||||||
|
Logging.instance.log(
|
||||||
|
"Error getting prevOutJson"
|
||||||
|
": $e\n$s",
|
||||||
|
level: LogLevel.Warning,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InputV2 input = InputV2.isarCantDoRequiredInDefaultConstructor(
|
InputV2 input = InputV2.isarCantDoRequiredInDefaultConstructor(
|
||||||
|
|
|
@ -1023,7 +1023,9 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
|
||||||
print("123123123");
|
print("123123123");
|
||||||
print(counts);
|
print(counts);
|
||||||
}
|
}
|
||||||
int count = counts["${_id}_$k"]!;
|
|
||||||
|
int count = (counts["${_id}_$k"] == null) ? 0 : counts["${_id}_$k"]!;
|
||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
iterationsAddressArray.add(txCountCallArgs["${_id}_$k"]!);
|
iterationsAddressArray.add(txCountCallArgs["${_id}_$k"]!);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue