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 emits a warning when importdescriptors
contains such a descriptor.
The first commit makes SEQUENCE_LOCKTIME
flags reusable by other tests.
The main commit adds the ForEachNode
helper to miniscript.h
which is then used in the MiniscriptDescriptor
constructor to check for Fragment::OLDER
with unsafe values. These are stored in m_warnings
, which the RPC code then collects via Warnings()
.
It adds both a unit and functional test.
A previous version of this PR prevented the import, unless the user opted in with an unsafe
flag. It also used string parsing in the RPC code.