Skip to content

Commit c36564f

Browse files
authored
Merge pull request #47 from bitcoin-sv/fix-op-return
script interpreter update
2 parents 126ae58 + e0f4c18 commit c36564f

File tree

4 files changed

+23
-11
lines changed

4 files changed

+23
-11
lines changed

RELEASE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Steps for creating a new release
22

3-
1. `git tag v1.0.0`
4-
2. `git push origin v1.0.0`
5-
3. `marge tagged branch to master branch`
3+
1. `merge tagged branch to master branch`
4+
2. `git tag v1.0.0`
5+
3. `git push origin v1.0.0`
66
4. `goreleaser release`

script/interpreter/example_test.go

Lines changed: 14 additions & 6 deletions
Large diffs are not rendered by default.

script/interpreter/opcodeparser.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ func (p *DefaultOpcodeParser) Parse(s *script.Script) (ParsedScript, error) {
155155
// If we are not in a conditional block, we end script evaluation.
156156
// This must be the final evaluated opcode, everything after is ignored.
157157
if conditionalBlock == 0 {
158+
if i+1 < len(scr) {
159+
parsedOp.Data = scr[i+1:]
160+
parsedOp.op.length = 1 + len(parsedOp.Data)
161+
}
158162
parsedOps = append(parsedOps, parsedOp)
159163
return parsedOps, nil
160164
}

script/interpreter/opcodeparser_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ func TestParse(t *testing.T) {
6565
op: opcode{
6666
val: script.OpRETURN,
6767
name: "OP_RETURN",
68-
length: 1,
68+
length: 4,
6969
exec: opcodeReturn,
7070
},
71-
Data: nil,
71+
Data: []byte{0x00, 0x24, 0xDC},
7272
},
7373
},
7474
},

0 commit comments

Comments
 (0)