Skip to content

Commit

Permalink
Fix bug cloning engine stacks (gcash#506)
Browse files Browse the repository at this point in the history
Set the defaultScriptNum when cloning the script engine. This is used by meep.
  • Loading branch information
cpacia authored May 18, 2022
1 parent 58741b0 commit 5964724
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions txscript/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -857,13 +857,15 @@ func (vm *Engine) Clone() *Engine {
}

newVM.astack.verifyMinimalData = vm.astack.verifyMinimalData
newVM.astack.defaultScriptNumLen = vm.astack.defaultScriptNumLen
newVM.astack.stk = make([][]byte, len(vm.astack.stk))
for i, data := range vm.astack.stk {
newVM.astack.stk[i] = make([]byte, len(data))
copy(newVM.astack.stk[i], data)
}

newVM.dstack.verifyMinimalData = vm.dstack.verifyMinimalData
newVM.dstack.defaultScriptNumLen = vm.dstack.defaultScriptNumLen
newVM.dstack.stk = make([][]byte, len(vm.dstack.stk))
for i, data := range vm.dstack.stk {
newVM.dstack.stk[i] = make([]byte, len(data))
Expand Down

0 comments on commit 5964724

Please sign in to comment.