fix bitcoin cash tests

This commit is contained in:
Marco 2022-10-19 16:16:00 -06:00
parent 2a3997e837
commit 27c2e38311
2 changed files with 10 additions and 18 deletions

View file

@ -265,9 +265,11 @@ class BitcoinCashWallet extends CoinServiceAPI {
DerivePathType addressType({required String address}) { DerivePathType addressType({required String address}) {
Uint8List? decodeBase58; Uint8List? decodeBase58;
Segwit? decodeBech32; Segwit? decodeBech32;
if (Bitbox.Address.detectFormat(address) == 0) { try {
address = Bitbox.Address.toLegacyAddress(address); if (Bitbox.Address.detectFormat(address) == 0) {
} address = Bitbox.Address.toLegacyAddress(address);
}
} catch (e, s) {}
try { try {
decodeBase58 = bs58check.decode(address); decodeBase58 = bs58check.decode(address);
} catch (err) { } catch (err) {

View file

@ -26,7 +26,7 @@ import 'bitcoincash_wallet_test_parameters.dart';
void main() { void main() {
group("bitcoincash constants", () { group("bitcoincash constants", () {
test("bitcoincash minimum confirmations", () async { test("bitcoincash minimum confirmations", () async {
expect(MINIMUM_CONFIRMATIONS, 3); expect(MINIMUM_CONFIRMATIONS, 1);
}); });
test("bitcoincash dust limit", () async { test("bitcoincash dust limit", () async {
expect(DUST_LIMIT, 546); expect(DUST_LIMIT, 546);
@ -831,18 +831,9 @@ void main() {
await bch?.initializeNew(); await bch?.initializeNew();
await bch?.initializeExisting(); await bch?.initializeExisting();
expect( expect(bch?.validateAddress(await bch!.currentReceivingAddress), true);
Address.validateAddress( expect(bch?.validateAddress(await bch!.currentReceivingAddress), true);
await bch!.currentReceivingAddress, bitcoincashtestnet), expect(bch?.validateAddress(await bch!.currentReceivingAddress), true);
true);
expect(
Address.validateAddress(
await bch!.currentReceivingAddress, bitcoincashtestnet),
true);
expect(
Address.validateAddress(
await bch!.currentReceivingAddress, bitcoincashtestnet),
true);
verifyNever(client?.ping()).called(0); verifyNever(client?.ping()).called(0);
verify(client?.getServerFeatures()).called(1); verify(client?.getServerFeatures()).called(1);
@ -884,8 +875,7 @@ void main() {
expect(addresses?.length, 2); expect(addresses?.length, 2);
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
expect( expect(bch?.validateAddress(addresses![i]), true);
Address.validateAddress(addresses![i], bitcoincashtestnet), true);
} }
verifyNever(client?.ping()).called(0); verifyNever(client?.ping()).called(0);