WIP: next hard fork #5

Draft
BrannonKing wants to merge 178 commits from WIP-HF-2022 into master
3 changed files with 5 additions and 5 deletions
Showing only changes of commit 911db90858 - Show all commits

View file

@ -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)
}
@ -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)
}
}

View file

@ -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
@ -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

View file

@ -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 {