Skip to content

Commit 6c9df95

Browse files
OttoAllmendingerllm-git
andcommitted
fix(utxo-staking): validate babylon address in proof of possession
Adds validation to ensure babylon address starts with 'bbn1' prefix before attempting to create proof of possession. Issue: BTC-2402 Co-authored-by: llm-git <[email protected]>
1 parent 55f1c66 commit 6c9df95

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/utxo-staking/src/babylon/stakingManager.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ class BitGoStakingManager extends vendor.BabylonBtcStakingManager {
3939
stakerBtcAddress: string,
4040
sigType: BTCSigType
4141
): Promise<ProofOfPossessionBTC> {
42+
if (!bech32Address.startsWith('bbn1')) {
43+
throw new Error('invalid bech32 babylon address, must start with bbn1');
44+
}
4245
const signedBabylonAddress = await this.btcProvider.signMessage(
4346
bech32Address,
4447
sigType === BTCSigType.BIP322 ? 'bip322-simple' : 'ecdsa'

0 commit comments

Comments
 (0)