Skip to content

Commit

Permalink
txscript: Rename removeOpcodeByDataRaw func.
Browse files Browse the repository at this point in the history
This renames the removeOpcodeByDataRaw to removeOpcodeByData now that
the old version has been removed.
  • Loading branch information
davecgh authored and cfromknecht committed Feb 5, 2021
1 parent 79d106e commit afa1d5a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions txscript/opcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -2063,7 +2063,7 @@ func opcodeCheckSig(op *parsedOpcode, vm *Engine) error {
} else {
// Remove the signature since there is no way for a signature
// to sign itself.
subScript = removeOpcodeByDataRaw(subScript, fullSigBytes)
subScript = removeOpcodeByData(subScript, fullSigBytes)

hash = calcSignatureHashRaw(subScript, hashType, &vm.tx, vm.txIdx)
}
Expand Down Expand Up @@ -2236,7 +2236,7 @@ func opcodeCheckMultiSig(op *parsedOpcode, vm *Engine) error {
// no way for a signature to sign itself.
if !vm.isWitnessVersionActive(0) {
for _, sigInfo := range signatures {
script = removeOpcodeByDataRaw(script, sigInfo.signature)
script = removeOpcodeByData(script, sigInfo.signature)
}
}

Expand Down
4 changes: 2 additions & 2 deletions txscript/script.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func isCanonicalPush(opcode byte, data []byte) bool {
return true
}

// removeOpcodeByDataRaw will return the script minus any opcodes that perform a
// removeOpcodeByData will return the script minus any opcodes that perform a
// canonical push of data that contains the passed data to remove. This
// function assumes it is provided a version 0 script as any future version of
// script should avoid this functionality since it is unncessary due to the
Expand All @@ -332,7 +332,7 @@ func isCanonicalPush(opcode byte, data []byte) bool {
// NOTE: This function is only valid for version 0 scripts. Since the function
// does not accept a script version, the results are undefined for other script
// versions.
func removeOpcodeByDataRaw(script []byte, dataToRemove []byte) []byte {
func removeOpcodeByData(script []byte, dataToRemove []byte) []byte {
// Avoid work when possible.
if len(script) == 0 || len(dataToRemove) == 0 {
return script
Expand Down
2 changes: 1 addition & 1 deletion txscript/script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4136,7 +4136,7 @@ func TestRemoveOpcodeByData(t *testing.T) {
return nil, err
}

return removeOpcodeByDataRaw(script, data), nil
return removeOpcodeByData(script, data), nil
}

for _, test := range tests {
Expand Down

0 comments on commit afa1d5a

Please sign in to comment.