Skip to content

Commit

Permalink
BATM-6287: fixed BNB address validation (#920)
Browse files Browse the repository at this point in the history
  • Loading branch information
drocek authored Jul 30, 2024
1 parent 824b411 commit 50c03b1
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*************************************************************************************
* Copyright (C) 2014-2020 GENERAL BYTES s.r.o. All rights reserved.
* Copyright (C) 2014-2024 GENERAL BYTES s.r.o. All rights reserved.
*
* This software may be distributed and modified under the terms of the GNU
* General Public License version 2 (GPL2) as published by the Free Software
Expand Down Expand Up @@ -29,7 +29,7 @@ public class BinanceCoinAddressValidator implements ICryptoAddressValidator {
@Override
public boolean isAddressValid(String address) {
try {
Bech32.Bech32Data bech32Data = Bech32.decodeUnlimitedLength(address);
Bech32.Bech32Data bech32Data = Bech32.decodeUnlimitedLength(getAddressWithoutTag(address));
if (!bech32Data.hrp.equals("bnb")) {
log.info("Address HRP is not 'bnb'");
return false;
Expand All @@ -50,4 +50,9 @@ public boolean isPaperWalletSupported() {
public boolean mustBeBase58Address() {
return false;
}

private String getAddressWithoutTag(String address) {
return address.split(":")[0];
}

}

0 comments on commit 50c03b1

Please sign in to comment.