Skip to content

Commit 0834800

Browse files
OttoAllmendingerllm-git
andcommitted
feat(utxo-staking): improve error message for invalid params
Make error message generic rather than assuming testnet params. Issue: BTC-2223 Co-authored-by: llm-git <[email protected]>
1 parent 5c64baf commit 0834800

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import jsonMainnetParams from './params.mainnet.json';
1717
import jsonTestnetParams from './params.testnet.json';
1818
import { BabylonNetworkLike, toBabylonNetwork } from './network';
1919

20+
/** @see https://docs.babylonlabs.io/api/babylon-gRPC/params/ */
2021
const BabylonParamsJSON = t.type({
2122
covenant_pks: t.array(t.string),
2223
covenant_quorum: t.number,
@@ -63,7 +64,7 @@ function toVersionedParamsFromJson(jsonParams: unknown[]): VersionedStakingParam
6364
const result = t.type({ params: BabylonParamsJSON }).decode(p);
6465
if (isLeft(result)) {
6566
const msg = PathReporter.report(result).join('\n');
66-
throw new Error(`Invalid testnet params: ${msg}`);
67+
throw new Error(`Invalid params: ${msg}`);
6768
}
6869
return result.right.params;
6970
})

0 commit comments

Comments
 (0)