bch fetch derivation by address fix

This commit is contained in:
julian 2023-02-01 10:38:49 -06:00
parent 266a433aa3
commit 68be62e3ef

View file

@ -2601,13 +2601,12 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB {
final n = output["n"];
if (n != null && n == utxosToUse[i].vout) {
String address = output["scriptPubKey"]["addresses"][0] as String;
if (bitbox.Address.detectFormat(address) ==
if (bitbox.Address.detectFormat(address) !=
bitbox.Address.formatCashAddr) {
if (validateCashAddr(address)) {
address = bitbox.Address.toLegacyAddress(address);
} else {
throw Exception(
"Unsupported address found during fetchBuildTxData(): $address");
try {
address = bitbox.Address.toCashAddress(address);
} catch (_) {
rethrow;
}
}
if (!addressTxid.containsKey(address)) {