You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rpc: getchainlockbyheight help doesn't say the best ChainLock and skipped heights can't be returned #7872
getchainlockbyheight only returns ChainLocks that a later block has embedded in its coinbase (CbTx). Its help only says "Read a historical ChainLock from coinbases on disk", so it's easy to expect any ChainLocked height to work, including the current best ChainLock from getbestchainlock. Two cases return Chainlock not found for height and the help mentions neither.
Expected behavior
Either the help explains which heights can be returned, or the RPC returns the requested ChainLock.
Actual behavior
Current best ChainLock:getbestchainlock usually reports a ChainLock that no block has embedded yet, often at the tip height. CoinbaseChainLockReader::Find returns nothing when the requested height is at or above the tip (src/chainlock/clsig.cpp:216), so getchainlockbyheight <best CL height> fails until a later block carries that ChainLock.
Skipped heights: a coinbase stores the best ChainLock known at the time, and ChainLock heights can jump. If the first coinbase that reaches the requested height carries a ChainLock for a higher height, the lookup returns nothing (src/chainlock/clsig.cpp:245). A skipped height always returns "not found".
Both are reasonable for a coinbase-backed lookup, but the help gives no hint. Suggested addition to the help:
Only ChainLocks that have been embedded in a later block's coinbase can be returned; the current best ChainLock and any heights skipped by coinbase ChainLocks return "Chainlock not found for height".
To reproduce
Reproducible every time on a synced testnet node:
dash-cli -testnet getbestchainlock and note height (usually the tip height).
dash-cli -testnet getchainlockbyheight <that height> returns error code: -5 / Chainlock not found for height.
After another block is mined that carries that ChainLock in its CbTx, the same call succeeds, with cbtx_height showing the carrier block.
System information
Dash Core v24.0.0-rc.3 (help text and source at 0364ed626e). Observed on testnet with a self-compiled dash-qt built from v24.0.0-rc.2-118-g2fb1e393. getchainlockbyheight and CoinbaseChainLockReader are unchanged between that build and rc.3.
Opened #7875. The help now explains the later-coinbase requirement, best-ChainLock availability, skipped heights, and the exact not-found error, with a pointer to getbestchainlock. Lookup behavior is unchanged because an in-memory fallback would not have the cbtx_height promised by this RPC. Added the required short release note; whitespace/format-string lint and compilation of the changed RPC translation unit passed.
Activity
thephez commentedon Oct 13, 2026
@thepastaclaw can you take this?
thepastaclaw commentedon Oct 13, 2026
@thephez on it — I have handed this to an agent and will link a PR here.
thepastaclaw commentedon Oct 13, 2026
Opened #7875. The help now explains the later-coinbase requirement, best-ChainLock availability, skipped heights, and the exact not-found error, with a pointer to
getbestchainlock. Lookup behavior is unchanged because an in-memory fallback would not have thecbtx_heightpromised by this RPC. Added the required short release note; whitespace/format-string lint and compilation of the changed RPC translation unit passed.Merge #7875: docs(rpc): clarify getchainlockbyheight availability
docs(rpc): clarify historical ChainLock lookup
Merge #7875: docs(rpc): clarify getchainlockbyheight availability