nSequence win OP_CSV in child tx must be equal to nSeq parent tx?

0

When I create OP_CSV transaction I need to set nSequence to the same number (in blocks) e.g.

3 OP_CHECKSEQUENCEVERIFY
nSequence = 3

But when I trying to spend this tx (after 3 blocks confirmation) I have to generate transaction with the same nSequence as parent.

Otherwise I'm getting error (when I'm trying to spend with different nSequence)

non-mandatory-script-verify-flag (Locktime requirement not satisfied) (code 64)

But I wont set the nSequence to child transaction, because, in this case, I can't spend immediately child transaction.

Do I need to set some flag or something?

Andrew

Posted 2018-11-19T15:26:40.713

Reputation: 161

Answers

1

I believe your misconception is that the nSequence value must be set on the transaction that creates the CSV output.

This is not required. All that's needed is setting it on the spending transaction's input which spends it. This will indirectly require that output to have a certain age when it is being spent.

Pieter Wuille

Posted 2018-11-19T15:26:40.713

Reputation: 54 032