BIP 379 (Miniscript) allows relative height and time locks that have no consensus meaning in BIP 68 (relative timelocks) / BIP 112 (CHECKSEQUENCEVERIFY
). This is (ab)used by some protocols, e.g. by Lightning to encode extra data, but is unsafe when used unintentionally: older(65536)
is equivalent to older(1)
.
This PR prevents accidental import of such descriptors. They will be rejected unless marked unsafe
in importdescriptors
.
In preparation the first commit moves FindNextChar
from miniscript.{h,cpp}
to parsing.{h,cpp}
which already contains similar functions. It also documents it.
The second commit makes SEQUENCE_LOCKTIME
flags reusable by other tests.
The main commit takes advantage of the fact that the descriptor has already been parsed for validity, so the CHECK_NONFATAL
conditions should never happen.