only use the PaymentData 'data' once and do not generate p2sh data using p2wpkh unless required

This commit is contained in:
julian 2023-01-12 09:52:41 -06:00
parent e271341738
commit e115ff1b41

View file

@ -1430,9 +1430,6 @@ class BitcoinCashWallet extends CoinServiceAPI {
), ),
); );
final data = PaymentData(pubkey: node.publicKey); final data = PaymentData(pubkey: node.publicKey);
final p2shData =
PaymentData(redeem: P2WPKH(data: data, network: _network).data);
String address; String address;
isar_models.AddressType addrType; isar_models.AddressType addrType;
@ -1442,7 +1439,12 @@ class BitcoinCashWallet extends CoinServiceAPI {
addrType = isar_models.AddressType.p2pkh; addrType = isar_models.AddressType.p2pkh;
break; break;
case DerivePathType.bip49: case DerivePathType.bip49:
address = P2SH(data: p2shData, network: _network).data.address!; address = P2SH(
data: PaymentData(
redeem: P2WPKH(data: data, network: _network).data),
network: _network)
.data
.address!;
addrType = isar_models.AddressType.p2sh; addrType = isar_models.AddressType.p2sh;
break; break;
// default: // default: