From 811a0eb66e5f775b412ee504a65eb8281ff82165 Mon Sep 17 00:00:00 2001 From: zhiqiangxu <652732310@qq.com> Date: Wed, 3 Jan 2024 17:25:12 +0800 Subject: [PATCH] fix some typos and make OP_DATA_20 explicit in comment --- mempool/mempool.go | 5 ++--- txscript/doc.go | 2 +- txscript/engine.go | 2 +- txscript/script.go | 2 +- txscript/sigvalidate.go | 2 +- txscript/standard.go | 4 ++-- txscript/taproot.go | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/mempool/mempool.go b/mempool/mempool.go index a80d8ee4f4..a8576a1bf6 100644 --- a/mempool/mempool.go +++ b/mempool/mempool.go @@ -927,9 +927,8 @@ func (mp *TxPool) validateReplacement(tx *btcutil.Tx, func (mp *TxPool) maybeAcceptTransaction(tx *btcutil.Tx, isNew, rateLimit, rejectDupOrphans bool) ([]*chainhash.Hash, *TxDesc, error) { txHash := tx.Hash() - // If a transaction has witness data, and segwit isn't active yet, If - // segwit isn't active yet, then we won't accept it into the mempool as - // it can't be mined yet. + // If a transaction has witness data, and segwit isn't active yet, then + // we won't accept it into the mempool as it can't be mined yet. if tx.MsgTx().HasWitness() { segwitActive, err := mp.cfg.IsDeploymentActive(chaincfg.DeploymentSegwit) if err != nil { diff --git a/txscript/doc.go b/txscript/doc.go index d6eddd5a65..957c91947c 100644 --- a/txscript/doc.go +++ b/txscript/doc.go @@ -17,7 +17,7 @@ bitcoin transaction scripts. 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 -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 hashes, and checking cryptographic signatures. Scripts are processed from left to right and intentionally do not provide loops. diff --git a/txscript/engine.go b/txscript/engine.go index 30206152b8..45173c7645 100644 --- a/txscript/engine.go +++ b/txscript/engine.go @@ -605,7 +605,7 @@ func (vm *Engine) verifyWitnessProgram(witness wire.TxWitness) error { 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 // normal key-path spend, or a merkle proof for a tapscript with // execution afterwards. diff --git a/txscript/script.go b/txscript/script.go index 18723067ee..1a97b54ab1 100644 --- a/txscript/script.go +++ b/txscript/script.go @@ -178,7 +178,7 @@ func DisasmString(script []byte) (string, error) { // removeOpcodeRaw will return the script after removing any opcodes that match // `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 -// the filtered script. This metehod assumes that the script parses +// the filtered script. This method assumes that the script parses // successfully. // // NOTE: This function is only valid for version 0 scripts. Since the function diff --git a/txscript/sigvalidate.go b/txscript/sigvalidate.go index 0bd00c326d..1087e91d35 100644 --- a/txscript/sigvalidate.go +++ b/txscript/sigvalidate.go @@ -385,7 +385,7 @@ func (t *taprootSigVerifier) Verify() bool { var _ signatureVerifier = (*taprootSigVerifier)(nil) // baseTapscriptSigVerifier verifies a signature for an input spending a -// tapscript leaf from the prevoous output. +// tapscript leaf from the previous output. type baseTapscriptSigVerifier struct { *taprootSigVerifier diff --git a/txscript/standard.go b/txscript/standard.go index 5ef2ad167f..a25e32df92 100644 --- a/txscript/standard.go +++ b/txscript/standard.go @@ -153,7 +153,7 @@ func isPubKeyScript(script []byte) bool { // is a standard pay-to-pubkey-hash script. It will return nil otherwise. func extractPubKeyHash(script []byte) []byte { // 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 && script[0] == OP_DUP && script[1] == OP_HASH160 && @@ -181,7 +181,7 @@ func isPubKeyHashScript(script []byte) bool { // versions. func extractScriptHash(script []byte) []byte { // 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 && script[0] == OP_HASH160 && script[1] == OP_DATA_20 && diff --git a/txscript/taproot.go b/txscript/taproot.go index 003eb19ae3..d306674280 100644 --- a/txscript/taproot.go +++ b/txscript/taproot.go @@ -65,7 +65,7 @@ func VerifyTaprootKeySpend(witnessProgram []byte, rawSig []byte, tx *wire.MsgTx, // program. 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. var annex []byte witness := tx.TxIn[inputIndex].Witness