joinmarket-webui / joinmarket-webui/jam
fix(validation): blockHeightField uses || instead of ?? causing silent max-height fallback when currentBlockHeight is 0
Open
bug
- Dominant language
- TypeScript
- Stars
- 330
- Forks
- 122
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 17
Description
blockHeightField
uses || instead of ??, allowing invalid block heights when current height is 0
The
blockHeightField
validator in
src/lib/formValidation.ts
(lines 123–124) uses the || (OR) operator to determine the max allowed block height. Since 0 is falsy in JavaScript, when currentBlockHeight === 0 (e.g. regtest before any blocks are mined), the max silently becomes Number.MAX_SAFE_INTEGER instead of 0 — meaning any block height passes validation when it should be rejected
const maxBlockheight = Math.max(minBlockHeight, currentBlockHeight || INPUT_BLOCK_HEIGHT_MAX)
Contributor guide
Assessment
This issue has not been assessed yet.