Skip to content

Commit

Permalink
fix bug with bitcoin address prefix check
Browse files Browse the repository at this point in the history
  • Loading branch information
Viacheslav Zhygulin authored and Viacheslav Zhygulin committed Jul 24, 2024
1 parent d11eb46 commit 9ecc968
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/BitcoinUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ contract BitcoinUtils {
bytes memory prefix = BitcoinNetworkEncoder.getBtcBech32Prefix(network);

if (equalBytes(bytes(BTCAddress)[: 1], BTC_P2PKH) || equalBytes(bytes(BTCAddress)[: 1], BTC_P2SH) &&
!equalBytes(bytes(BTCAddress)[: 3], prefix)) {
!equalBytes(bytes(BTCAddress)[: prefix.length], prefix)) {
if (bytes(BTCAddress).length < 26 || bytes(BTCAddress).length > 35 || !alphabetCheck(bytes(BTCAddress))) {
return false;
}
Expand Down

0 comments on commit 9ecc968

Please sign in to comment.