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 { } else {
// Remove the signature since there is no way for a signature // Remove the signature since there is no way for a signature
// to sign itself. // to sign itself.
subScript = removeOpcodeByDataRaw(subScript, fullSigBytes) subScript = removeOpcodeByData(subScript, fullSigBytes)
hash = calcSignatureHashRaw(subScript, hashType, &vm.tx, vm.txIdx) 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. // no way for a signature to sign itself.
if !vm.isWitnessVersionActive(0) { if !vm.isWitnessVersionActive(0) {
for _, sigInfo := range signatures { 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 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 // 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 // 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 // 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 // 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 // does not accept a script version, the results are undefined for other script
// versions. // versions.
func removeOpcodeByDataRaw(script []byte, dataToRemove []byte) []byte { func removeOpcodeByData(script []byte, dataToRemove []byte) []byte {
// Avoid work when possible. // Avoid work when possible.
if len(script) == 0 || len(dataToRemove) == 0 { if len(script) == 0 || len(dataToRemove) == 0 {
return script return script

View file

@ -4136,7 +4136,7 @@ func TestRemoveOpcodeByData(t *testing.T) {
return nil, err return nil, err
} }
return removeOpcodeByDataRaw(script, data), nil return removeOpcodeByData(script, data), nil
} }
for _, test := range tests { for _, test := range tests {