From 9ecc968a96fee3a86355ac2f466d34bb6c4b59ae Mon Sep 17 00:00:00 2001 From: Viacheslav Zhygulin Date: Wed, 24 Jul 2024 16:50:43 +0300 Subject: [PATCH] fix bug with bitcoin address prefix check --- src/BitcoinUtils.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BitcoinUtils.sol b/src/BitcoinUtils.sol index 6f42949..1e6e04f 100644 --- a/src/BitcoinUtils.sol +++ b/src/BitcoinUtils.sol @@ -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; }