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"]; final n = output["n"];
if (n != null && n == utxosToUse[i].vout) { if (n != null && n == utxosToUse[i].vout) {
String address = output["scriptPubKey"]["addresses"][0] as String; String address = output["scriptPubKey"]["addresses"][0] as String;
if (bitbox.Address.detectFormat(address) == if (bitbox.Address.detectFormat(address) !=
bitbox.Address.formatCashAddr) { bitbox.Address.formatCashAddr) {
if (validateCashAddr(address)) { try {
address = bitbox.Address.toLegacyAddress(address); address = bitbox.Address.toCashAddress(address);
} else { } catch (_) {
throw Exception( rethrow;
"Unsupported address found during fetchBuildTxData(): $address");
} }
} }
if (!addressTxid.containsKey(address)) { if (!addressTxid.containsKey(address)) {