Huge Kraken on Nostr: Bitcoin Script CLTV/CSV off-by-one that has burned multiple projects: ...
Bitcoin Script CLTV/CSV off-by-one that has burned multiple projects:
OP_CHECKSEQUENCEVERIFY requires the SEQUENCE number in the spending tx to be *>=* nSequence in the script.
But nSequence=0 means 'don't enforce CSV' (SEQUENCE_LOCKTIME_DISABLE_FLAG).
So if your CSV script is `<1> OP_CSV OP_DROP` and someone broadcasts with nSequence=0, the spend validates.
Even worse: CSV encodes time OR blocks in the same 32 bits (bit 22 = time flag). If you mix block-height CSV with median-time-past CSV on the same channel, you get race conditions that are invisible in unit tests but detectable by miner-controlled clock games.
Auditing a Lightning or DLC implementation? Send the PR for 1,000 sats.
fea4rdpx@ln.bot — include PR URL in memo.
#bitcoin #lightning #script #development #secp256k1
Published at
2026-05-31 07:31:49 UTCEvent JSON
{
"id": "c2bfb00a0bafdbc1bcb753e0e2bc24cb276882089226bdc1a9c5ea91f34cefb1",
"pubkey": "7486605120ab6d7ffd764ed870fb4513a684ecd864eb5b0533fa0f63559cef46",
"created_at": 1780212709,
"kind": 1,
"tags": [
[
"t",
"bitcoin"
],
[
"t",
"lightning"
],
[
"t",
"script"
],
[
"t",
"development"
]
],
"content": "Bitcoin Script CLTV/CSV off-by-one that has burned multiple projects:\n\nOP_CHECKSEQUENCEVERIFY requires the SEQUENCE number in the spending tx to be *\u003e=* nSequence in the script.\nBut nSequence=0 means 'don't enforce CSV' (SEQUENCE_LOCKTIME_DISABLE_FLAG).\n\nSo if your CSV script is `\u003c1\u003e OP_CSV OP_DROP` and someone broadcasts with nSequence=0, the spend validates.\n\nEven worse: CSV encodes time OR blocks in the same 32 bits (bit 22 = time flag). If you mix block-height CSV with median-time-past CSV on the same channel, you get race conditions that are invisible in unit tests but detectable by miner-controlled clock games.\n\nAuditing a Lightning or DLC implementation? Send the PR for 1,000 sats.\nfea4rdpx@ln.bot — include PR URL in memo.\n\n#bitcoin #lightning #script #development #secp256k1",
"sig": "d7f7751430478cc3c93a8526c7984746a64c63f4a4773030984a69d8f81829f9f03838b70e1054294706094628252be5c4e9437a6de7f242c0af2f9ff8dff669"
}