diff --git a/txscript/opcode.go b/txscript/opcode.go index 0d72b663..0a81b45b 100644 --- a/txscript/opcode.go +++ b/txscript/opcode.go @@ -1117,11 +1117,6 @@ func opcodeCheckSequenceVerify(op *parsedOpcode, vm *Engine) error { return nil } - if vm.tx.Version < 2 { - return fmt.Errorf("invalid transaction version: %d", - vm.tx.Version) - } - // The current transaction sequence is a uint32 resulting in a maximum // sequence of 2^32-1. However, scriptNums are signed and therefore a // standard 4-byte scriptNum would only support up to a maximum of @@ -1156,6 +1151,13 @@ func opcodeCheckSequenceVerify(op *parsedOpcode, vm *Engine) error { return nil } + // Transaction version numbers not high enough to trigger CSV rules must + // fail. + if vm.tx.Version < 2 { + return fmt.Errorf("invalid transaction version: %d", + vm.tx.Version) + } + // Sequence numbers with their most significant bit set are not // consensus constrained. Testing that the transaction's sequence // number does not have this bit set prevents using this property