joinmarket-webui / joinmarket-webui/jam

fix(validation): blockHeightField uses || instead of ?? causing silent max-height fallback when currentBlockHeight is 0

Open
#1,410 0 comments 0 reactions 1 assignee Claimed by @Amanyadav0556 View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.