fix some typos and make OP_DATA_20 explicit in comment (#2080)

This commit is contained in:
zhiqiangxu 2024-04-10 22:08:30 +08:00 committed by GitHub
parent 5d50f7c83e
commit 2f4ff8447d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 7 additions and 7 deletions

View file

@ -17,7 +17,7 @@ bitcoin transaction scripts.
Bitcoin transaction scripts are written in a stack-base, FORTH-like language. Bitcoin transaction scripts are written in a stack-base, FORTH-like language.
The bitcoin script language consists of a number of opcodes which fall into The bitcoin script language consists of a number of opcodes which fall into
several categories such pushing and popping data to and from the stack, several categories such as pushing and popping data to and from the stack,
performing basic and bitwise arithmetic, conditional branching, comparing performing basic and bitwise arithmetic, conditional branching, comparing
hashes, and checking cryptographic signatures. Scripts are processed from left hashes, and checking cryptographic signatures. Scripts are processed from left
to right and intentionally do not provide loops. to right and intentionally do not provide loops.

View file

@ -605,7 +605,7 @@ func (vm *Engine) verifyWitnessProgram(witness wire.TxWitness) error {
return scriptError(ErrWitnessProgramWrongLength, errStr) return scriptError(ErrWitnessProgramWrongLength, errStr)
} }
// We're attempting to to verify a taproot input, and the witness // We're attempting to verify a taproot input, and the witness
// program data push is of the expected size, so we'll be looking for a // program data push is of the expected size, so we'll be looking for a
// normal key-path spend, or a merkle proof for a tapscript with // normal key-path spend, or a merkle proof for a tapscript with
// execution afterwards. // execution afterwards.

View file

@ -178,7 +178,7 @@ func DisasmString(script []byte) (string, error) {
// removeOpcodeRaw will return the script after removing any opcodes that match // removeOpcodeRaw will return the script after removing any opcodes that match
// `opcode`. If the opcode does not appear in script, the original script will // `opcode`. If the opcode does not appear in script, the original script will
// be returned unmodified. Otherwise, a new script will be allocated to contain // be returned unmodified. Otherwise, a new script will be allocated to contain
// the filtered script. This metehod assumes that the script parses // the filtered script. This method assumes that the script parses
// successfully. // successfully.
// //
// 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

View file

@ -385,7 +385,7 @@ func (t *taprootSigVerifier) Verify() bool {
var _ signatureVerifier = (*taprootSigVerifier)(nil) var _ signatureVerifier = (*taprootSigVerifier)(nil)
// baseTapscriptSigVerifier verifies a signature for an input spending a // baseTapscriptSigVerifier verifies a signature for an input spending a
// tapscript leaf from the prevoous output. // tapscript leaf from the previous output.
type baseTapscriptSigVerifier struct { type baseTapscriptSigVerifier struct {
*taprootSigVerifier *taprootSigVerifier

View file

@ -153,7 +153,7 @@ func isPubKeyScript(script []byte) bool {
// is a standard pay-to-pubkey-hash script. It will return nil otherwise. // is a standard pay-to-pubkey-hash script. It will return nil otherwise.
func extractPubKeyHash(script []byte) []byte { func extractPubKeyHash(script []byte) []byte {
// A pay-to-pubkey-hash script is of the form: // A pay-to-pubkey-hash script is of the form:
// OP_DUP OP_HASH160 <20-byte hash> OP_EQUALVERIFY OP_CHECKSIG // OP_DUP OP_HASH160 OP_DATA_20 <20-byte hash> OP_EQUALVERIFY OP_CHECKSIG
if len(script) == 25 && if len(script) == 25 &&
script[0] == OP_DUP && script[0] == OP_DUP &&
script[1] == OP_HASH160 && script[1] == OP_HASH160 &&
@ -181,7 +181,7 @@ func isPubKeyHashScript(script []byte) bool {
// versions. // versions.
func extractScriptHash(script []byte) []byte { func extractScriptHash(script []byte) []byte {
// A pay-to-script-hash script is of the form: // A pay-to-script-hash script is of the form:
// OP_HASH160 <20-byte scripthash> OP_EQUAL // OP_HASH160 OP_DATA_20 <20-byte scripthash> OP_EQUAL
if len(script) == 23 && if len(script) == 23 &&
script[0] == OP_HASH160 && script[0] == OP_HASH160 &&
script[1] == OP_DATA_20 && script[1] == OP_DATA_20 &&

View file

@ -65,7 +65,7 @@ func VerifyTaprootKeySpend(witnessProgram []byte, rawSig []byte, tx *wire.MsgTx,
// program. // program.
rawKey := witnessProgram rawKey := witnessProgram
// Extract the annex if it exists, so we can compute the proper proper // Extract the annex if it exists, so we can compute the proper
// sighash below. // sighash below.
var annex []byte var annex []byte
witness := tx.TxIn[inputIndex].Witness witness := tx.TxIn[inputIndex].Witness