From 3cb9f602e825660078fd5d2035cbbf3ea5381f0c Mon Sep 17 00:00:00 2001 From: mattn Date: Mon, 25 Mar 2024 22:44:25 +0900 Subject: [PATCH] fix typos (#2100) --- CHANGES | 2 +- addrmgr/addrmanager_internal_test.go | 2 +- blockchain/chain_test.go | 8 ++++---- blockchain/chainio.go | 2 +- blockchain/chainio_test.go | 2 +- blockchain/common_test.go | 2 +- blockchain/difficulty_test.go | 2 +- blockchain/error.go | 2 +- blockchain/fullblocktests/generate.go | 4 ++-- blockchain/indexers/addrindex.go | 6 +++--- blockchain/merkle.go | 2 +- blockchain/upgrade_test.go | 2 +- blockchain/utxocache_test.go | 2 +- blockchain/utxoviewpoint.go | 4 ++-- blockchain/validate.go | 2 +- btcec/README.md | 2 +- btcec/ecdsa/signature.go | 2 +- btcec/field_test.go | 2 +- btcec/schnorr/musig2/context.go | 2 +- btcec/schnorr/musig2/musig2_test.go | 2 +- btcec/schnorr/musig2/nonces.go | 2 +- btcec/schnorr/musig2/sign_test.go | 4 ++-- btcjson/btcdextcmds.go | 2 +- btcjson/btcdextresults_test.go | 2 +- btcjson/chainsvrresults_test.go | 2 +- btcjson/chainsvrwsresults_test.go | 2 +- btcjson/cmdinfo_test.go | 2 +- btcjson/cmdparse.go | 2 +- btcjson/error.go | 2 +- btcutil/bech32/bech32.go | 2 +- btcutil/bech32/bech32_test.go | 4 ++-- btcutil/bloom/example_test.go | 2 +- btcutil/coinset/coins_test.go | 2 +- btcutil/gcs/builder/builder.go | 4 ++-- btcutil/psbt/finalizer.go | 8 ++++---- config.go | 2 +- connmgr/connmanager.go | 4 ++-- connmgr/seed.go | 2 +- database/error.go | 2 +- database/ffldb/driver.go | 2 +- database/ffldb/interface_test.go | 4 ++-- database/ffldb/whitebox_test.go | 2 +- database/interface.go | 2 +- docs/json_rpc_api.md | 2 +- log.go | 2 +- mining/mining.go | 2 +- mining/policy.go | 2 +- peer/example_test.go | 2 +- peer/peer.go | 2 +- rpcclient/chain_test.go | 6 +++--- rpcclient/infrastructure.go | 6 +++--- rpcclient/notify.go | 8 ++++---- rpcclient/rawtransactions.go | 2 +- rpcclient/wallet.go | 2 +- rpcserver.go | 12 ++++++------ rpcserverhelp.go | 2 +- rpcwebsocket.go | 12 ++++++------ service_windows.go | 2 +- txscript/data/script_tests.json | 2 +- txscript/data/tx_invalid.json | 2 +- txscript/engine.go | 2 +- txscript/engine_debug_test.go | 2 +- txscript/engine_test.go | 4 ++-- txscript/error.go | 2 +- txscript/script.go | 2 +- txscript/sigvalidate.go | 2 +- txscript/standard_test.go | 2 +- txscript/taproot.go | 2 +- txscript/taproot_test.go | 2 +- wire/bench_test.go | 4 ++-- wire/fixedIO_test.go | 4 ++-- wire/msgalert.go | 4 ++-- wire/msgblock.go | 2 +- wire/msgblock_test.go | 2 +- wire/msggetheaders.go | 2 +- wire/msgtx_test.go | 8 ++++---- wire/msgversion.go | 2 +- 77 files changed, 116 insertions(+), 116 deletions(-) diff --git a/CHANGES b/CHANGES index fd59a886..4e359222 100644 --- a/CHANGES +++ b/CHANGES @@ -782,7 +782,7 @@ Changes in 0.8.0-beta (Sun May 25 2014) recent reference client changes (https://github.com/conformal/btcd/issues/100) - Raise the maximum signature script size to support standard 15-of-15 - multi-signature pay-to-sript-hash transactions with compressed pubkeys + multi-signature pay-to-script-hash transactions with compressed pubkeys to remain compatible with the reference client (https://github.com/conformal/btcd/issues/128) - Reduce max bytes allowed for a standard nulldata transaction to 40 for diff --git a/addrmgr/addrmanager_internal_test.go b/addrmgr/addrmanager_internal_test.go index ff19eae1..38218b15 100644 --- a/addrmgr/addrmanager_internal_test.go +++ b/addrmgr/addrmanager_internal_test.go @@ -184,7 +184,7 @@ func TestAddrManagerV1ToV2(t *testing.T) { addrMgr.loadPeers() addrs := addrMgr.getAddresses() if len(addrs) != len(expectedAddrs) { - t.Fatalf("expected to find %d adddresses, found %d", + t.Fatalf("expected to find %d addresses, found %d", len(expectedAddrs), len(addrs)) } for _, addr := range addrs { diff --git a/blockchain/chain_test.go b/blockchain/chain_test.go index 1ac08f9a..cd5c761b 100644 --- a/blockchain/chain_test.go +++ b/blockchain/chain_test.go @@ -782,7 +782,7 @@ func TestLocateInventory(t *testing.T) { &test.hashStop) } if !reflect.DeepEqual(headers, test.headers) { - t.Errorf("%s: unxpected headers -- got %v, want %v", + t.Errorf("%s: unexpected headers -- got %v, want %v", test.name, headers, test.headers) continue } @@ -795,7 +795,7 @@ func TestLocateInventory(t *testing.T) { hashes := chain.LocateBlocks(test.locator, &test.hashStop, maxAllowed) if !reflect.DeepEqual(hashes, test.hashes) { - t.Errorf("%s: unxpected hashes -- got %v, want %v", + t.Errorf("%s: unexpected hashes -- got %v, want %v", test.name, hashes, test.hashes) continue } @@ -888,7 +888,7 @@ func TestHeightToHashRange(t *testing.T) { } if !reflect.DeepEqual(hashes, test.hashes) { - t.Errorf("%s: unxpected hashes -- got %v, want %v", + t.Errorf("%s: unexpected hashes -- got %v, want %v", test.name, hashes, test.hashes) } } @@ -960,7 +960,7 @@ func TestIntervalBlockHashes(t *testing.T) { } if !reflect.DeepEqual(hashes, test.hashes) { - t.Errorf("%s: unxpected hashes -- got %v, want %v", + t.Errorf("%s: unexpected hashes -- got %v, want %v", test.name, hashes, test.hashes) } } diff --git a/blockchain/chainio.go b/blockchain/chainio.go index 75474021..3340dd14 100644 --- a/blockchain/chainio.go +++ b/blockchain/chainio.go @@ -247,7 +247,7 @@ type SpentTxOut struct { // Amount is the amount of the output. Amount int64 - // PkScipt is the public key script for the output. + // PkScript is the public key script for the output. PkScript []byte // Height is the height of the block containing the creating tx. diff --git a/blockchain/chainio_test.go b/blockchain/chainio_test.go index 630af14e..a9e19b6f 100644 --- a/blockchain/chainio_test.go +++ b/blockchain/chainio_test.go @@ -403,7 +403,7 @@ func TestSpendJournalErrors(t *testing.T) { } // TestUtxoSerialization ensures serializing and deserializing unspent -// trasaction output entries works as expected. +// transaction output entries works as expected. func TestUtxoSerialization(t *testing.T) { t.Parallel() diff --git a/blockchain/common_test.go b/blockchain/common_test.go index 1973689e..5037c182 100644 --- a/blockchain/common_test.go +++ b/blockchain/common_test.go @@ -343,7 +343,7 @@ func (b *BlockChain) TstSetCoinbaseMaturity(maturity uint16) { b.chainParams.CoinbaseMaturity = maturity } -// newFakeChain returns a chain that is usable for syntetic tests. It is +// newFakeChain returns a chain that is usable for synthetic tests. It is // important to note that this chain has no database associated with it, so // it is not usable with all functions and the tests must take care when making // use of it. diff --git a/blockchain/difficulty_test.go b/blockchain/difficulty_test.go index 6fed37f1..c4d8fb6e 100644 --- a/blockchain/difficulty_test.go +++ b/blockchain/difficulty_test.go @@ -32,7 +32,7 @@ func TestBigToCompact(t *testing.T) { } // TestCompactToBig ensures CompactToBig converts numbers using the compact -// representation to the expected big intergers. +// representation to the expected big integers. func TestCompactToBig(t *testing.T) { tests := []struct { in uint32 diff --git a/blockchain/error.go b/blockchain/error.go index 1e7c879b..dc402222 100644 --- a/blockchain/error.go +++ b/blockchain/error.go @@ -70,7 +70,7 @@ const ( // ErrUnexpectedDifficulty indicates specified bits do not align with // the expected value either because it doesn't match the calculated - // valued based on difficulty regarted rules or it is out of the valid + // valued based on difficulty regarded rules or it is out of the valid // range. ErrUnexpectedDifficulty diff --git a/blockchain/fullblocktests/generate.go b/blockchain/fullblocktests/generate.go index 15b92540..fe36bfe1 100644 --- a/blockchain/fullblocktests/generate.go +++ b/blockchain/fullblocktests/generate.go @@ -960,7 +960,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) { // --------------------------------------------------------------------- // The comments below identify the structure of the chain being built. // - // The values in parenthesis repesent which outputs are being spent. + // The values in parenthesis represent which outputs are being spent. // // For example, b1(0) indicates the first collected spendable output // which, due to the code above to create the correct number of blocks, @@ -1218,7 +1218,7 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) { accepted() // --------------------------------------------------------------------- - // Multisig[Verify]/ChecksigVerifiy signature operation count tests. + // Multisig[Verify]/ChecksigVerify signature operation count tests. // --------------------------------------------------------------------- // Create block with max signature operations as OP_CHECKMULTISIG. diff --git a/blockchain/indexers/addrindex.go b/blockchain/indexers/addrindex.go index 7eaaab06..271e1665 100644 --- a/blockchain/indexers/addrindex.go +++ b/blockchain/indexers/addrindex.go @@ -64,7 +64,7 @@ const ( addrKeyTypeWitnessScriptHash = 3 // addrKeyTypeTaprootPubKey is the address type in an address key that - // represnts a pay-to-taproot address. We use this to denote addresses + // represents a pay-to-taproot address. We use this to denote addresses // related to the segwit v1 that are encoded in the bech32m format. addrKeyTypeTaprootPubKey = 4 @@ -158,7 +158,7 @@ func serializeAddrIndexEntry(blockID uint32, txLoc wire.TxLoc) []byte { // deserializeAddrIndexEntry decodes the passed serialized byte slice into the // provided region struct according to the format described in detail above and -// uses the passed block hash fetching function in order to conver the block ID +// uses the passed block hash fetching function in order to convert the block ID // to the associated block hash. func deserializeAddrIndexEntry(serialized []byte, region *database.BlockRegion, fetchBlockHash fetchBlockHashFunc) error { @@ -734,7 +734,7 @@ func (idx *AddrIndex) indexBlock(data writeIndexData, block *btcutil.Block, idx.indexPkScript(data, pkScript, txIdx) // With an input indexed, we'll advance the - // stxo coutner. + // stxo counter. stxoIndex++ } } diff --git a/blockchain/merkle.go b/blockchain/merkle.go index b89b5185..086c3643 100644 --- a/blockchain/merkle.go +++ b/blockchain/merkle.go @@ -146,7 +146,7 @@ func BuildMerkleTreeStore(transactions []*btcutil.Tx, witness bool) []*chainhash merkles[offset] = &newHash // The normal case sets the parent node to the double sha256 - // of the concatentation of the left and right children. + // of the concatenation of the left and right children. default: newHash := HashMerkleBranches(merkles[i], merkles[i+1]) merkles[offset] = &newHash diff --git a/blockchain/upgrade_test.go b/blockchain/upgrade_test.go index 97e7f55c..9a060b3e 100644 --- a/blockchain/upgrade_test.go +++ b/blockchain/upgrade_test.go @@ -9,7 +9,7 @@ import ( "testing" ) -// TestDeserializeUtxoEntryV0 ensures deserializing unspent trasaction output +// TestDeserializeUtxoEntryV0 ensures deserializing unspent transaction output // entries from the legacy version 0 format works as expected. func TestDeserializeUtxoEntryV0(t *testing.T) { tests := []struct { diff --git a/blockchain/utxocache_test.go b/blockchain/utxocache_test.go index c19850e4..0f410cc9 100644 --- a/blockchain/utxocache_test.go +++ b/blockchain/utxocache_test.go @@ -445,7 +445,7 @@ func TestUtxoCacheFlush(t *testing.T) { t.Fatalf("Unexpected nil entry found for %v", outpoint) } if !entry.isModified() { - t.Fatal("Entry should be marked mofified") + t.Fatal("Entry should be marked modified") } if !entry.isFresh() { t.Fatal("Entry should be marked fresh") diff --git a/blockchain/utxoviewpoint.go b/blockchain/utxoviewpoint.go index 702f9950..f62f4b91 100644 --- a/blockchain/utxoviewpoint.go +++ b/blockchain/utxoviewpoint.go @@ -163,13 +163,13 @@ type UtxoViewpoint struct { } // BestHash returns the hash of the best block in the chain the view currently -// respresents. +// represents. func (view *UtxoViewpoint) BestHash() *chainhash.Hash { return &view.bestHash } // SetBestHash sets the hash of the best block in the chain the view currently -// respresents. +// represents. func (view *UtxoViewpoint) SetBestHash(hash *chainhash.Hash) { view.bestHash = *hash } diff --git a/blockchain/validate.go b/blockchain/validate.go index 641967fb..6c49bd56 100644 --- a/blockchain/validate.go +++ b/blockchain/validate.go @@ -879,7 +879,7 @@ func (b *BlockChain) checkBlockContext(block *btcutil.Block, prevNode *blockNode // // This function MUST be called with the chain state lock held (for reads). func (b *BlockChain) checkBIP0030(node *blockNode, block *btcutil.Block, view *UtxoViewpoint) error { - // Fetch utxos for all of the transaction ouputs in this block. + // Fetch utxos for all of the transaction outputs in this block. // Typically, there will not be any utxos for any of the outputs. fetch := make([]wire.OutPoint, 0, len(block.Transactions())) for _, tx := range block.Transactions() { diff --git a/btcec/README.md b/btcec/README.md index cbf63dd0..53391773 100644 --- a/btcec/README.md +++ b/btcec/README.md @@ -10,7 +10,7 @@ Bitcoin (secp256k1 only for now). It is designed so that it may be used with the standard crypto/ecdsa packages provided with go. A comprehensive suite of test is provided to ensure proper functionality. Package btcec was originally based on work from ThePiachu which is licensed under the same terms as Go, but it has -signficantly diverged since then. The btcsuite developers original is licensed +significantly diverged since then. The btcsuite developers original is licensed under the liberal ISC license. Although this package was primarily written for btcd, it has intentionally been diff --git a/btcec/ecdsa/signature.go b/btcec/ecdsa/signature.go index 44b84a78..11c6267c 100644 --- a/btcec/ecdsa/signature.go +++ b/btcec/ecdsa/signature.go @@ -212,7 +212,7 @@ func parseSig(sigStr []byte, der bool) (*Signature, error) { } // ParseSignature parses a signature in BER format for the curve type `curve' -// into a Signature type, perfoming some basic sanity checks. If parsing +// into a Signature type, performing some basic sanity checks. If parsing // according to the more strict DER format is needed, use ParseDERSignature. func ParseSignature(sigStr []byte) (*Signature, error) { return parseSig(sigStr, false) diff --git a/btcec/field_test.go b/btcec/field_test.go index 6ade97a1..0844dc1d 100644 --- a/btcec/field_test.go +++ b/btcec/field_test.go @@ -952,7 +952,7 @@ func TestFieldSquareRoot(t *testing.T) { input := setHex(test.in).Normalize() want := setHex(test.want).Normalize() - // Calculate the square root and enusre the validity flag matches the + // Calculate the square root and ensure the validity flag matches the // expected value. var result FieldVal isValid := result.SquareRootVal(input) diff --git a/btcec/schnorr/musig2/context.go b/btcec/schnorr/musig2/context.go index 8f452150..8e6b7154 100644 --- a/btcec/schnorr/musig2/context.go +++ b/btcec/schnorr/musig2/context.go @@ -513,7 +513,7 @@ func (s *Session) PublicNonce() [PubNonceSize]byte { } // NumRegisteredNonces returns the total number of nonces that have been -// regsitered so far. +// registered so far. func (s *Session) NumRegisteredNonces() int { return len(s.pubNonces) } diff --git a/btcec/schnorr/musig2/musig2_test.go b/btcec/schnorr/musig2/musig2_test.go index 91dad90b..dfd48f3e 100644 --- a/btcec/schnorr/musig2/musig2_test.go +++ b/btcec/schnorr/musig2/musig2_test.go @@ -258,7 +258,7 @@ func TestMuSigMultiParty(t *testing.T) { } // TestMuSigEarlyNonce tests that for protocols where nonces need to be -// exchagned before all signers are known, the context API works as expected. +// exchanged before all signers are known, the context API works as expected. func TestMuSigEarlyNonce(t *testing.T) { t.Parallel() diff --git a/btcec/schnorr/musig2/nonces.go b/btcec/schnorr/musig2/nonces.go index 988b1994..dbe39ef3 100644 --- a/btcec/schnorr/musig2/nonces.go +++ b/btcec/schnorr/musig2/nonces.go @@ -144,7 +144,7 @@ func defaultNonceGenOpts() *nonceGenOpts { // WithCustomRand allows a caller to use a custom random number generator in // place for crypto/rand. This should only really be used to generate -// determinstic tests. +// deterministic tests. func WithCustomRand(r io.Reader) NonceGenOption { return func(o *nonceGenOpts) { o.randReader = r diff --git a/btcec/schnorr/musig2/sign_test.go b/btcec/schnorr/musig2/sign_test.go index a7f5d79d..a967cfe4 100644 --- a/btcec/schnorr/musig2/sign_test.go +++ b/btcec/schnorr/musig2/sign_test.go @@ -298,7 +298,7 @@ type sigCombineTestVectors struct { ValidCases []sigCombineValidCase `json:"valid_test_cases"` } -func pSigsFromIndicies(t *testing.T, sigs []string, indices []int) []*PartialSignature { +func pSigsFromIndices(t *testing.T, sigs []string, indices []int) []*PartialSignature { pSigs := make([]*PartialSignature, len(indices)) for i, idx := range indices { var pSig PartialSignature @@ -341,7 +341,7 @@ func TestMusig2SignCombine(t *testing.T) { t, testCase.NonceIndices, testCases.PubNonces, ) - partialSigs := pSigsFromIndicies( + partialSigs := pSigsFromIndices( t, testCases.Psigs, testCase.PSigIndices, ) diff --git a/btcjson/btcdextcmds.go b/btcjson/btcdextcmds.go index a3ca46ba..768dca4d 100644 --- a/btcjson/btcdextcmds.go +++ b/btcjson/btcdextcmds.go @@ -20,7 +20,7 @@ const ( // persistent peer. NRemove NodeSubCmd = "remove" - // NDisconnect indicates the specified peer should be disonnected. + // NDisconnect indicates the specified peer should be disconnected. NDisconnect NodeSubCmd = "disconnect" ) diff --git a/btcjson/btcdextresults_test.go b/btcjson/btcdextresults_test.go index 478f088c..9a8b9eed 100644 --- a/btcjson/btcdextresults_test.go +++ b/btcjson/btcdextresults_test.go @@ -13,7 +13,7 @@ import ( ) // TestBtcdExtCustomResults ensures any results that have custom marshalling -// work as inteded. +// work as intended. // and unmarshal code of results are as expected. func TestBtcdExtCustomResults(t *testing.T) { t.Parallel() diff --git a/btcjson/chainsvrresults_test.go b/btcjson/chainsvrresults_test.go index 8a11197a..2566e65f 100644 --- a/btcjson/chainsvrresults_test.go +++ b/btcjson/chainsvrresults_test.go @@ -17,7 +17,7 @@ import ( ) // TestChainSvrCustomResults ensures any results that have custom marshalling -// work as inteded. +// work as intended. // and unmarshal code of results are as expected. func TestChainSvrCustomResults(t *testing.T) { t.Parallel() diff --git a/btcjson/chainsvrwsresults_test.go b/btcjson/chainsvrwsresults_test.go index b1e17450..9e8c7676 100644 --- a/btcjson/chainsvrwsresults_test.go +++ b/btcjson/chainsvrwsresults_test.go @@ -13,7 +13,7 @@ import ( ) // TestChainSvrWsResults ensures any results that have custom marshalling -// work as inteded. +// work as intended. func TestChainSvrWsResults(t *testing.T) { t.Parallel() diff --git a/btcjson/cmdinfo_test.go b/btcjson/cmdinfo_test.go index 61a693e4..9dc45678 100644 --- a/btcjson/cmdinfo_test.go +++ b/btcjson/cmdinfo_test.go @@ -11,7 +11,7 @@ import ( "github.com/btcsuite/btcd/btcjson" ) -// TestCmdMethod tests the CmdMethod function to ensure it retunrs the expected +// TestCmdMethod tests the CmdMethod function to ensure it returns the expected // methods and errors. func TestCmdMethod(t *testing.T) { t.Parallel() diff --git a/btcjson/cmdparse.go b/btcjson/cmdparse.go index 5cf3215e..3b0473b8 100644 --- a/btcjson/cmdparse.go +++ b/btcjson/cmdparse.go @@ -232,7 +232,7 @@ func baseType(arg reflect.Type) (reflect.Type, int) { // assignField is the main workhorse for the NewCmd function which handles // assigning the provided source value to the destination field. It supports // direct type assignments, indirection, conversion of numeric types, and -// unmarshaling of strings into arrays, slices, structs, and maps via +// unmarshalling of strings into arrays, slices, structs, and maps via // json.Unmarshal. func assignField(paramNum int, fieldName string, dest reflect.Value, src reflect.Value) error { // Just error now when the types have no chance of being compatible. diff --git a/btcjson/error.go b/btcjson/error.go index 3d72329f..66be0214 100644 --- a/btcjson/error.go +++ b/btcjson/error.go @@ -30,7 +30,7 @@ const ( // embedded type which is not not supported. ErrEmbeddedType - // ErrUnexportedField indiciates the provided command struct contains an + // ErrUnexportedField indicates the provided command struct contains an // unexported field which is not supported. ErrUnexportedField diff --git a/btcutil/bech32/bech32.go b/btcutil/bech32/bech32.go index c1e00106..a7b056bd 100644 --- a/btcutil/bech32/bech32.go +++ b/btcutil/bech32/bech32.go @@ -18,7 +18,7 @@ const charset = "qpzry9x8gf2tvdw0s3jn54khce6mua7l" var gen = []int{0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3} // toBytes converts each character in the string 'chars' to the value of the -// index of the correspoding character in 'charset'. +// index of the corresponding character in 'charset'. func toBytes(chars string) ([]byte, error) { decoded := make([]byte, 0, len(chars)) for i := 0; i < len(chars); i++ { diff --git a/btcutil/bech32/bech32_test.go b/btcutil/bech32/bech32_test.go index 1e04905a..354ba7a1 100644 --- a/btcutil/bech32/bech32_test.go +++ b/btcutil/bech32/bech32_test.go @@ -297,9 +297,9 @@ func TestMixedCaseEncode(t *testing.T) { } } -// TestCanDecodeUnlimtedBech32 tests whether decoding a large bech32 string works +// TestCanDecodeUnlimitedBech32 tests whether decoding a large bech32 string works // when using the DecodeNoLimit version -func TestCanDecodeUnlimtedBech32(t *testing.T) { +func TestCanDecodeUnlimitedBech32(t *testing.T) { input := "11qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqsqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq5kx0yd" // Sanity check that an input of this length errors on regular Decode() diff --git a/btcutil/bloom/example_test.go b/btcutil/bloom/example_test.go index e5a148a5..2be2b67a 100644 --- a/btcutil/bloom/example_test.go +++ b/btcutil/bloom/example_test.go @@ -26,7 +26,7 @@ func ExampleNewFilter() { filter := bloom.NewFilter(10, tweak, 0.0001, wire.BloomUpdateNone) // Create a transaction hash and add it to the filter. This particular - // trasaction is the first transaction in block 310,000 of the main + // transaction is the first transaction in block 310,000 of the main // bitcoin block chain. txHashStr := "fd611c56ca0d378cdcd16244b45c2ba9588da3adac367c4ef43e808b280b8a45" txHash, err := chainhash.NewHashFromStr(txHashStr) diff --git a/btcutil/coinset/coins_test.go b/btcutil/coinset/coins_test.go index 035a40cb..c1984623 100644 --- a/btcutil/coinset/coins_test.go +++ b/btcutil/coinset/coins_test.go @@ -252,7 +252,7 @@ func TestSimpleCoin(t *testing.T) { t.Error("Different value of coin pkScript than expected") } if testSimpleCoin.NumConfs() != 1 { - t.Error("Differet value of num confs than expected") + t.Error("Different value of num confs than expected") } if testSimpleCoin.ValueAge() != testSimpleCoinTxValueAge0 { t.Error("Different value of coin value * age than expected") diff --git a/btcutil/gcs/builder/builder.go b/btcutil/gcs/builder/builder.go index 3a85ad05..4e952996 100644 --- a/btcutil/gcs/builder/builder.go +++ b/btcutil/gcs/builder/builder.go @@ -60,7 +60,7 @@ func RandomKey() ([gcs.KeySize]byte, error) { } // DeriveKey is a utility function that derives a key from a chainhash.Hash by -// truncating the bytes of the hash to the appopriate key size. +// truncating the bytes of the hash to the appropriate key size. func DeriveKey(keyHash *chainhash.Hash) [gcs.KeySize]byte { var key [gcs.KeySize]byte copy(key[:], keyHash.CloneBytes()) @@ -207,7 +207,7 @@ func (b *GCSBuilder) Build() (*gcs.Filter, error) { return nil, b.err } - // We'll ensure that all the parmaters we need to actually build the + // We'll ensure that all the paramaters we need to actually build the // filter properly are set. if b.p == 0 { return nil, fmt.Errorf("p value is not set, cannot build") diff --git a/btcutil/psbt/finalizer.go b/btcutil/psbt/finalizer.go index 3c2edd55..b1bf12d1 100644 --- a/btcutil/psbt/finalizer.go +++ b/btcutil/psbt/finalizer.go @@ -404,7 +404,7 @@ func finalizeWitnessInput(p *Packet, inIndex int) error { } containsRedeemScript := pInput.RedeemScript != nil - cointainsWitnessScript := pInput.WitnessScript != nil + containsWitnessScript := pInput.WitnessScript != nil // If there's no redeem script, then we assume that this is native // segwit input. @@ -413,7 +413,7 @@ func finalizeWitnessInput(p *Packet, inIndex int) error { // If we have only a sigley pubkey+sig pair, and no witness // script, then we assume this is a P2WKH input. if len(pubKeys) == 1 && len(sigs) == 1 && - !cointainsWitnessScript { + !containsWitnessScript { serializedWitness, err = writePKHWitness( sigs[0], pubKeys[0], @@ -430,7 +430,7 @@ func finalizeWitnessInput(p *Packet, inIndex int) error { // TODO(roasbeef): need to add custom finalize for // non-multisig P2WSH outputs (HTLCs, delay outputs, // etc). - if !cointainsWitnessScript { + if !containsWitnessScript { return ErrNotFinalizable } @@ -457,7 +457,7 @@ func finalizeWitnessInput(p *Packet, inIndex int) error { // If don't have a witness script, then we assume this is a // nested p2wkh output. - if !cointainsWitnessScript { + if !containsWitnessScript { // Assumed p2sh-p2wkh Here the witness is just (sig, // pub) as for p2pkh case if len(sigs) != 1 || len(pubKeys) != 1 { diff --git a/config.go b/config.go index 18620a00..f8aad70c 100644 --- a/config.go +++ b/config.go @@ -275,7 +275,7 @@ func parseAndSetDebugLevels(debugLevel string) error { // Validate subsystem. if _, exists := subsystemLoggers[subsysID]; !exists { str := "The specified subsystem [%v] is invalid -- " + - "supported subsytems %v" + "supported subsystems %v" return fmt.Errorf(str, subsysID, supportedSubsystems()) } diff --git a/connmgr/connmanager.go b/connmgr/connmanager.go index b487bd1b..e88f8af0 100644 --- a/connmgr/connmanager.go +++ b/connmgr/connmanager.go @@ -525,9 +525,9 @@ func (cm *ConnManager) Start() { // Start all the listeners so long as the caller requested them and // provided a callback to be invoked when connections are accepted. if cm.cfg.OnAccept != nil { - for _, listner := range cm.cfg.Listeners { + for _, listener := range cm.cfg.Listeners { cm.wg.Add(1) - go cm.listenHandler(listner) + go cm.listenHandler(listener) } } diff --git a/connmgr/seed.go b/connmgr/seed.go index 4c26160d..705618f7 100644 --- a/connmgr/seed.go +++ b/connmgr/seed.go @@ -23,7 +23,7 @@ const ( ) // OnSeed is the signature of the callback function which is invoked when DNS -// seeding is succesfull. +// seeding is successful. type OnSeed func(addrs []*wire.NetAddressV2) // LookupFunc is the signature of the DNS lookup function. diff --git a/database/error.go b/database/error.go index 49c250ee..3470c497 100644 --- a/database/error.go +++ b/database/error.go @@ -87,7 +87,7 @@ const ( // should be relatively, so this should rarely be an issue. ErrKeyTooLarge - // ErrValueTooLarge indicates an attmpt to insert a value that is larger + // ErrValueTooLarge indicates an attempt to insert a value that is larger // than max allowed value size. The max key size depends on the // specific backend driver being used. ErrValueTooLarge diff --git a/database/ffldb/driver.go b/database/ffldb/driver.go index 28ab8277..01290bf0 100644 --- a/database/ffldb/driver.go +++ b/database/ffldb/driver.go @@ -78,7 +78,7 @@ func init() { UseLogger: useLogger, } if err := database.RegisterDriver(driver); err != nil { - panic(fmt.Sprintf("Failed to regiser database driver '%s': %v", + panic(fmt.Sprintf("Failed to register database driver '%s': %v", dbType, err)) } } diff --git a/database/ffldb/interface_test.go b/database/ffldb/interface_test.go index b0f275c5..36db769b 100644 --- a/database/ffldb/interface_test.go +++ b/database/ffldb/interface_test.go @@ -255,7 +255,7 @@ func testDeleteValues(tc *testContext, bucket database.Bucket, values []keyPair) return true } -// testCursorInterface ensures the cursor itnerface is working properly by +// testCursorInterface ensures the cursor interface is working properly by // exercising all of its functions on the passed bucket. func testCursorInterface(tc *testContext, bucket database.Bucket) bool { // Ensure a cursor can be obtained for the bucket. @@ -639,7 +639,7 @@ func rollbackOnPanic(t *testing.T, tx database.Tx) { func testMetadataManualTxInterface(tc *testContext) bool { // populateValues tests that populating values works as expected. // - // When the writable flag is false, a read-only tranasction is created, + // When the writable flag is false, a read-only transaction is created, // standard bucket tests for read-only transactions are performed, and // the Commit function is checked to ensure it fails as expected. // diff --git a/database/ffldb/whitebox_test.go b/database/ffldb/whitebox_test.go index cc7c13d4..cac49840 100644 --- a/database/ffldb/whitebox_test.go +++ b/database/ffldb/whitebox_test.go @@ -218,7 +218,7 @@ func TestCornerCases(t *testing.T) { ldb := idb.(*db).cache.ldb ldb.Close() - // Ensure initilization errors in the underlying database work as + // Ensure initialization errors in the underlying database work as // expected. testName = "initDB: reinitialization" wantErrCode = database.ErrDbNotOpen diff --git a/database/interface.go b/database/interface.go index 7efc7c55..7c4dd851 100644 --- a/database/interface.go +++ b/database/interface.go @@ -390,7 +390,7 @@ type Tx interface { FetchBlockRegions(regions []BlockRegion) ([][]byte, error) // PruneBlocks deletes the block files until it reaches the target size - // (specificed in bytes). + // (specified in bytes). // // The interface contract guarantees at least the following errors will // be returned (other implementation-specific errors are possible): diff --git a/docs/json_rpc_api.md b/docs/json_rpc_api.md index fc32040d..1999a6c2 100644 --- a/docs/json_rpc_api.md +++ b/docs/json_rpc_api.md @@ -472,7 +472,7 @@ Example Return|`{`
  `"bytes": 310768,`
  `"size": |---|---| |Method|help| |Parameters|1. command (string, optional) - the command to get help for| -|Description|Returns a list of all commands or help for a specified command.
When no `command` parameter is specified, a list of avaialable commands is returned
When `command` is a valid method, the help text for that method is returned.| +|Description|Returns a list of all commands or help for a specified command.
When no `command` parameter is specified, a list of available commands is returned
When `command` is a valid method, the help text for that method is returned.| |Returns|string| |Example Return|getblockcount
Returns a numeric for the number of blocks in the longest block chain.| [Return to Overview](#MethodOverview)
diff --git a/log.go b/log.go index 71accc7c..5707d7c2 100644 --- a/log.go +++ b/log.go @@ -36,7 +36,7 @@ func (logWriter) Write(p []byte) (n int, err error) { return len(p), nil } -// Loggers per subsystem. A single backend logger is created and all subsytem +// Loggers per subsystem. A single backend logger is created and all subsystem // loggers created from it will write to the backend. When adding new // subsystems, add the subsystem logger variable here and to the // subsystemLoggers map. diff --git a/mining/mining.go b/mining/mining.go index 7905dade..131c1207 100644 --- a/mining/mining.go +++ b/mining/mining.go @@ -861,7 +861,7 @@ mempoolLoop: }, nil } -// AddWitnessCommitment adds the witness commitment as an OP_RETURN outpout +// AddWitnessCommitment adds the witness commitment as an OP_RETURN output // within the coinbase tx. The raw commitment is returned. func AddWitnessCommitment(coinbaseTx *btcutil.Tx, blockTxns []*btcutil.Tx) []byte { diff --git a/mining/policy.go b/mining/policy.go index 6213c2b3..8ddd5754 100644 --- a/mining/policy.go +++ b/mining/policy.go @@ -112,7 +112,7 @@ func CalcPriority(tx *wire.MsgTx, utxoView *blockchain.UtxoViewpoint, nextBlockH // A compressed pubkey pay-to-script-hash redemption with a maximum len // signature is of the form: // [OP_DATA_73 <73-byte sig> + OP_DATA_35 + {OP_DATA_33 - // <33 byte compresed pubkey> + OP_CHECKSIG}] + // <33 byte compressed pubkey> + OP_CHECKSIG}] // // Thus 1 + 73 + 1 + 1 + 33 + 1 = 110 overhead := 0 diff --git a/peer/example_test.go b/peer/example_test.go index d4662a2b..850557b8 100644 --- a/peer/example_test.go +++ b/peer/example_test.go @@ -16,7 +16,7 @@ import ( ) // mockRemotePeer creates a basic inbound peer listening on the simnet port for -// use with Example_peerConnection. It does not return until the listner is +// use with Example_peerConnection. It does not return until the listener is // active. func mockRemotePeer() error { // Configure peer to act as a simnet node that offers no services. diff --git a/peer/peer.go b/peer/peer.go index aa66cea9..195fc0b4 100644 --- a/peer/peer.go +++ b/peer/peer.go @@ -744,7 +744,7 @@ func (p *Peer) LastRecv() time.Time { // LocalAddr returns the local address of the connection. // -// This function is safe fo concurrent access. +// This function is safe for concurrent access. func (p *Peer) LocalAddr() net.Addr { var localAddr net.Addr if atomic.LoadInt32(&p.connected) != 0 { diff --git a/rpcclient/chain_test.go b/rpcclient/chain_test.go index ba76078a..ad1fb7aa 100644 --- a/rpcclient/chain_test.go +++ b/rpcclient/chain_test.go @@ -54,7 +54,7 @@ func TestUnmarshalGetBlockChainInfoResultSoftForks(t *testing.T) { for _, test := range tests { success := t.Run(test.name, func(t *testing.T) { - // We'll start by unmarshaling the JSON into a struct. + // We'll start by unmarshalling the JSON into a struct. // The SoftForks and UnifiedSoftForks field should not // be set yet, as they are unmarshaled within a // different function. @@ -226,7 +226,7 @@ func TestClientConnectedToWSServerRunner(t *testing.T) { response := <-ch if &expectedResponse != response { - t.Fatalf("received unexepcted response") + t.Fatalf("received unexpected response") } // ensure the goroutine created in this test exists, @@ -236,7 +236,7 @@ func TestClientConnectedToWSServerRunner(t *testing.T) { }, } - // since these tests rely on concurrency, ensure there is a resonable timeout + // since these tests rely on concurrency, ensure there is a reasonable timeout // that they should run within for _, testCase := range testTable { done := make(chan bool) diff --git a/rpcclient/infrastructure.go b/rpcclient/infrastructure.go index 39cfa3f4..67f908ef 100644 --- a/rpcclient/infrastructure.go +++ b/rpcclient/infrastructure.go @@ -116,7 +116,7 @@ type jsonRequest struct { type Client struct { id uint64 // atomic, so must stay 64-bit aligned - // config holds the connection configuration assoiated with this client. + // config holds the connection configuration associated with this client. config *ConnConfig // chainParams holds the params for the chain that this client is using, @@ -351,7 +351,7 @@ type Response struct { } // result checks whether the unmarshaled response contains a non-nil error, -// returning an unmarshaled btcjson.RPCError (or an unmarshaling error) if so. +// returning an unmarshaled btcjson.RPCError (or an unmarshalling error) if so. // If the response is not an error, the raw bytes of the request are // returned for further unmashaling into specific result types. func (r rawResponse) result() (result []byte, err error) { @@ -433,7 +433,7 @@ func (c *Client) handleMessage(msg []byte) { // to have come from reading from the websocket connection in wsInHandler, // should be logged. func (c *Client) shouldLogReadError(err error) bool { - // No logging when the connetion is being forcibly disconnected. + // No logging when the connection is being forcibly disconnected. select { case <-c.shutdown: return false diff --git a/rpcclient/notify.go b/rpcclient/notify.go index 1c2814c3..1f5cd480 100644 --- a/rpcclient/notify.go +++ b/rpcclient/notify.go @@ -472,13 +472,13 @@ func (c *Client) handleNotification(ntfn *rawNotification) { } } -// wrongNumParams is an error type describing an unparseable JSON-RPC -// notificiation due to an incorrect number of parameters for the +// wrongNumParams is an error type describing an unparsable JSON-RPC +// notification due to an incorrect number of parameters for the // expected notification type. The value is the number of parameters // of the invalid notification. type wrongNumParams int -// Error satisifies the builtin error interface. +// Error satisfies the builtin error interface. func (e wrongNumParams) Error() string { return fmt.Sprintf("wrong number of parameters (%d)", e) } @@ -599,7 +599,7 @@ func parseFilteredBlockDisconnectedParams(params []json.RawMessage) (int32, return 0, nil, err } - // Unmarshal second parmeter as a slice of bytes. + // Unmarshal second parameter as a slice of bytes. blockHeaderBytes, err := parseHexParam(params[1]) if err != nil { return 0, nil, err diff --git a/rpcclient/rawtransactions.go b/rpcclient/rawtransactions.go index 9c95041f..86073c46 100644 --- a/rpcclient/rawtransactions.go +++ b/rpcclient/rawtransactions.go @@ -719,7 +719,7 @@ func (c *Client) SignRawTransactionWithWallet3Async(tx *wire.MsgTx, // // This function should only used if a non-default signature hash type is // desired. Otherwise, see SignRawTransactionWithWallet if the RPC server already -// knows the input transactions, or SignRawTransactionWihWallet2 if it does not. +// knows the input transactions, or SignRawTransactionWithWallet2 if it does not. func (c *Client) SignRawTransactionWithWallet3(tx *wire.MsgTx, inputs []btcjson.RawTxWitnessInput, hashType SigHashType) (*wire.MsgTx, bool, error) { diff --git a/rpcclient/wallet.go b/rpcclient/wallet.go index 7b7e7212..b8063c13 100644 --- a/rpcclient/wallet.go +++ b/rpcclient/wallet.go @@ -2661,7 +2661,7 @@ func (c *Client) WalletCreateFundedPsbt( type FutureWalletProcessPsbtResult chan *Response // Receive waits for the Response promised by the future and returns an updated -// PSBT with signed inputs from the wallet and a boolen indicating if the +// PSBT with signed inputs from the wallet and a boolean indicating if the // transaction has a complete set of signatures. func (r FutureWalletProcessPsbtResult) Receive() (*btcjson.WalletProcessPsbtResult, error) { res, err := ReceiveFuture(r) diff --git a/rpcserver.go b/rpcserver.go index e5b8aac9..8fbb3e73 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -846,7 +846,7 @@ func handleDecodeScript(s *rpcServer, cmd interface{}, closeChan <-chan struct{} // Get information about the script. // Ignore the error here since an error means the script couldn't parse - // and there is no additinal information about it anyways. + // and there is no additional information about it anyways. scriptClass, addrs, reqSigs, _ := txscript.ExtractPkScriptAddrs(script, s.cfg.ChainParams) addresses := make([]string, len(addrs)) @@ -3220,7 +3220,7 @@ func handleSearchRawTransactions(s *rpcServer, cmd interface{}, closeChan <-chan addressTxns := make([]retrievedTx, 0, numRequested) if reverse { // Transactions in the mempool are not in a block header yet, - // so the block header field in the retieved transaction struct + // so the block header field in the retrieved transaction struct // is left nil. mpTxns, mpSkipped := fetchMempoolTxnsForAddress(s, addr, uint32(numToSkip), uint32(numRequested)) @@ -3274,7 +3274,7 @@ func handleSearchRawTransactions(s *rpcServer, cmd interface{}, closeChan <-chan // order and the number of results is still under the number requested. if !reverse && len(addressTxns) < numRequested { // Transactions in the mempool are not in a block header yet, - // so the block header field in the retieved transaction struct + // so the block header field in the retrieved transaction struct // is left nil. mpTxns, mpSkipped := fetchMempoolTxnsForAddress(s, addr, uint32(numToSkip)-numSkipped, uint32(numRequested- @@ -4336,7 +4336,7 @@ func (s *rpcServer) jsonRPCRead(w http.ResponseWriter, r *http.Request, isAdmin // change the read deadline for the new connection and having one breaks // long polling. However, not having a read deadline on the initial // connection would mean clients can connect and idle forever. Thus, - // hijack the connecton from the HTTP server, clear the read deadline, + // hijack the connection from the HTTP server, clear the read deadline, // and handle writing the response manually. hj, ok := w.(http.Hijacker) if !ok { @@ -4359,7 +4359,7 @@ func (s *rpcServer) jsonRPCRead(w http.ResponseWriter, r *http.Request, isAdmin // Attempt to parse the raw body into a JSON-RPC request. // Setup a close notifier. Since the connection is hijacked, - // the CloseNotifer on the ResponseWriter is not available. + // the CloseNotifier on the ResponseWriter is not available. closeChan := make(chan struct{}, 1) go func() { _, err = conn.Read(make([]byte, 1)) @@ -4409,7 +4409,7 @@ func (s *rpcServer) jsonRPCRead(w http.ResponseWriter, r *http.Request, isAdmin // Btcd does not respond to any request without and "id" or "id":null, // regardless the indicated JSON-RPC protocol version unless RPC quirks // are enabled. With RPC quirks enabled, such requests will be responded - // to if the reqeust does not indicate JSON-RPC version. + // to if the request does not indicate JSON-RPC version. // // RPC quirks can be enabled by the user to avoid compatibility issues // with software relying on Core's behavior. diff --git a/rpcserverhelp.go b/rpcserverhelp.go index 0cc384db..1f8451a5 100644 --- a/rpcserverhelp.go +++ b/rpcserverhelp.go @@ -376,7 +376,7 @@ var helpDescsEnUS = map[string]string{ // GetCurrentNetCmd help. "getcurrentnet--synopsis": "Get bitcoin network the server is running on.", - "getcurrentnet--result0": "The network identifer", + "getcurrentnet--result0": "The network identifier", // GetDifficultyCmd help. "getdifficulty--synopsis": "Returns the proof-of-work difficulty as a multiple of the minimum difficulty.", diff --git a/rpcwebsocket.go b/rpcwebsocket.go index aedbcf90..592ad1f3 100644 --- a/rpcwebsocket.go +++ b/rpcwebsocket.go @@ -132,8 +132,8 @@ type wsNotificationManager struct { queueNotification chan interface{} // notificationMsgs feeds notificationHandler with notifications - // and client (un)registeration requests from a queue as well as - // registeration and unregisteration requests from clients. + // and client (un)registration requests from a queue as well as + // registration and unregistration requests from clients. notificationMsgs chan interface{} // Access channel for current number of connected clients. @@ -1236,7 +1236,7 @@ type wsResponse struct { // requested notifications to all connected websocket clients. Inbound // messages are read via the inHandler goroutine and generally dispatched to // their own handler. However, certain potentially long-running operations such -// as rescans, are sent to the asyncHander goroutine and are limited to one at a +// as rescans, are sent to the asyncHandler goroutine and are limited to one at a // time. There are two outbound message types - one for responding to client // requests and another for async notifications. Responses to client requests // use SendMessage which employs a buffered channel thereby limiting the number @@ -2144,7 +2144,7 @@ func handleNotifySpent(wsc *wsClient, icmd interface{}) (interface{}, error) { return nil, nil } -// handleNotifyNewTransations implements the notifynewtransactions command +// handleNotifyNewTransactions implements the notifynewtransactions command // extension for websocket connections. func handleNotifyNewTransactions(wsc *wsClient, icmd interface{}) (interface{}, error) { cmd, ok := icmd.(*btcjson.NotifyNewTransactionsCmd) @@ -2157,7 +2157,7 @@ func handleNotifyNewTransactions(wsc *wsClient, icmd interface{}) (interface{}, return nil, nil } -// handleStopNotifyNewTransations implements the stopnotifynewtransactions +// handleStopNotifyNewTransactions implements the stopnotifynewtransactions // command extension for websocket connections. func handleStopNotifyNewTransactions(wsc *wsClient, icmd interface{}) (interface{}, error) { wsc.server.ntfnMgr.UnregisterNewMempoolTxsUpdates(wsc) @@ -2724,7 +2724,7 @@ fetchRange: // was any) still exists in the database. If it // doesn't, we error. // - // A goto is used to branch executation back to + // A goto is used to branch execution back to // before the range was evaluated, as it must be // reevaluated for the new hashList. minBlock += int32(i) diff --git a/service_windows.go b/service_windows.go index 378c9204..01edf3db 100644 --- a/service_windows.go +++ b/service_windows.go @@ -153,7 +153,7 @@ func installService() error { // Support events to the event log using the standard "standard" Windows // EventCreate.exe message file. This allows easy logging of custom - // messges instead of needing to create our own message catalog. + // messages instead of needing to create our own message catalog. eventlog.Remove(svcName) eventsSupported := uint32(eventlog.Error | eventlog.Warning | eventlog.Info) return eventlog.InstallAsEventCreate(svcName, eventsSupported) diff --git a/txscript/data/script_tests.json b/txscript/data/script_tests.json index 5c054ed3..bd3b4e31 100644 --- a/txscript/data/script_tests.json +++ b/txscript/data/script_tests.json @@ -666,7 +666,7 @@ ["0 0x02 0x0000 0", "CHECKMULTISIGVERIFY 1", "", "OK"], ["While not really correctly DER encoded, the empty signature is allowed by"], -["STRICTENC to provide a compact way to provide a delibrately invalid signature."], +["STRICTENC to provide a compact way to provide a deliberately invalid signature."], ["0", "0x21 0x02865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac0 CHECKSIG NOT", "STRICTENC", "OK"], ["0 0", "1 0x21 0x02865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac0 1 CHECKMULTISIG NOT", "STRICTENC", "OK"], diff --git a/txscript/data/tx_invalid.json b/txscript/data/tx_invalid.json index db465109..85ceac14 100644 --- a/txscript/data/tx_invalid.json +++ b/txscript/data/tx_invalid.json @@ -199,7 +199,7 @@ [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4259839 CHECKSEQUENCEVERIFY 1"]], "020000000100010000000000000000000000000000000000000000000000000000000000000000000000feff40000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"], -["By-time locks, with argument just beyond txin.nSequence (but within numerical boundries)"], +["By-time locks, with argument just beyond txin.nSequence (but within numerical boundaries)"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4194305 CHECKSEQUENCEVERIFY 1"]], "020000000100010000000000000000000000000000000000000000000000000000000000000000000000000040000100000000000000000000000000", "P2SH,CHECKSEQUENCEVERIFY"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4259839 CHECKSEQUENCEVERIFY 1"]], diff --git a/txscript/engine.go b/txscript/engine.go index 30206152..1458728f 100644 --- a/txscript/engine.go +++ b/txscript/engine.go @@ -1414,7 +1414,7 @@ func (vm *Engine) checkSignatureEncoding(sig []byte) error { func getStack(stack *stack) [][]byte { array := make([][]byte, stack.Depth()) for i := range array { - // PeekByteArry can't fail due to overflow, already checked + // PeekByteArray can't fail due to overflow, already checked array[len(array)-i-1], _ = stack.PeekByteArray(int32(i)) } return array diff --git a/txscript/engine_debug_test.go b/txscript/engine_debug_test.go index 5ebfe3f3..aa7283e2 100644 --- a/txscript/engine_debug_test.go +++ b/txscript/engine_debug_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" ) -// TestDebugEngine checks that the StepCallbck called during debug script +// TestDebugEngine checks that the StepCallback called during debug script // execution contains the expected data. func TestDebugEngine(t *testing.T) { t.Parallel() diff --git a/txscript/engine_test.go b/txscript/engine_test.go index 51a899be..c88d27a6 100644 --- a/txscript/engine_test.go +++ b/txscript/engine_test.go @@ -123,12 +123,12 @@ func TestCheckErrorCondition(t *testing.T) { t.Fatalf("failed to step %dth time: %v", i, err) } if done { - t.Fatalf("finshed early on %dth time", i) + t.Fatalf("finished early on %dth time", i) } err = vm.CheckErrorCondition(false) if !IsErrorCode(err, ErrScriptUnfinished) { - t.Fatalf("got unexepected error %v on %dth iteration", + t.Fatalf("got unexpected error %v on %dth iteration", err, i) } } diff --git a/txscript/error.go b/txscript/error.go index 68bea7e8..a5ad0f2c 100644 --- a/txscript/error.go +++ b/txscript/error.go @@ -267,7 +267,7 @@ const ( ErrPubKeyType // ErrCleanStack is returned when the ScriptVerifyCleanStack flag - // is set, and after evalution, the stack does not contain only a + // is set, and after evaluation, the stack does not contain only a // single element. ErrCleanStack diff --git a/txscript/script.go b/txscript/script.go index 18723067..13d6c427 100644 --- a/txscript/script.go +++ b/txscript/script.go @@ -244,7 +244,7 @@ func isCanonicalPush(opcode byte, data []byte) bool { // 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 +// script should avoid this functionality since it is unnecessary due to the // signature scripts not being part of the witness-free transaction hash. // // WARNING: This will return the passed script unmodified unless a modification diff --git a/txscript/sigvalidate.go b/txscript/sigvalidate.go index 0bd00c32..bda612a4 100644 --- a/txscript/sigvalidate.go +++ b/txscript/sigvalidate.go @@ -331,7 +331,7 @@ func newTaprootSigVerifier(pkBytes []byte, fullSigBytes []byte, // key and signature, and the passed sigHash as the message digest. func (t *taprootSigVerifier) verifySig(sigHash []byte) bool { // At this point, we can check to see if this signature is already - // included in the sigCcahe and is valid or not (if one was passed in). + // included in the sigCache and is valid or not (if one was passed in). cacheKey, _ := chainhash.NewHash(sigHash) if t.sigCache != nil { if t.sigCache.Exists(*cacheKey, t.fullSigBytes, t.pkBytes) { diff --git a/txscript/standard_test.go b/txscript/standard_test.go index 283e2ccb..4993a652 100644 --- a/txscript/standard_test.go +++ b/txscript/standard_test.go @@ -884,7 +884,7 @@ func TestMultiSigScript(t *testing.T) { } } -// TestCalcMultiSigStats ensures the CalcMutliSigStats function returns the +// TestCalcMultiSigStats ensures the CalcMultiSigStats function returns the // expected errors. func TestCalcMultiSigStats(t *testing.T) { t.Parallel() diff --git a/txscript/taproot.go b/txscript/taproot.go index 003eb19a..3776bf37 100644 --- a/txscript/taproot.go +++ b/txscript/taproot.go @@ -255,7 +255,7 @@ func ComputeTaprootOutputKey(pubKey *btcec.PublicKey, scriptRoot, ) - // With the tap tweek computed, we'll need to convert the merkle root + // With the tap tweak computed, we'll need to convert the merkle root // into something in the domain we can manipulate: a scalar value mod // N. var tweakScalar btcec.ModNScalar diff --git a/txscript/taproot_test.go b/txscript/taproot_test.go index 01b3780e..9c5bb573 100644 --- a/txscript/taproot_test.go +++ b/txscript/taproot_test.go @@ -224,7 +224,7 @@ func TestTaprootTweakNoMutation(t *testing.T) { return false } - // We shuold be able to re-derive the private key from raw + // We should be able to re-derive the private key from raw // bytes and have that match up again. privKeyCopy, _ := btcec.PrivKeyFromBytes(privBytes[:]) if *privKey != *privKeyCopy { diff --git a/wire/bench_test.go b/wire/bench_test.go index d19dd775..2f63fa30 100644 --- a/wire/bench_test.go +++ b/wire/bench_test.go @@ -549,7 +549,7 @@ func BenchmarkDeserializeTxSmall(b *testing.B) { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // // Previous output hash - 0xff, 0xff, 0xff, 0xff, // Prevous output index + 0xff, 0xff, 0xff, 0xff, // Previous output index 0x07, // Varint for length of signature script 0x04, 0xff, 0xff, 0x00, 0x1d, 0x01, 0x04, // Signature script 0xff, 0xff, 0xff, 0xff, // Sequence @@ -671,7 +671,7 @@ func BenchmarkSerializeTxSmall(b *testing.B) { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // // Previous output hash - 0xff, 0xff, 0xff, 0xff, // Prevous output index + 0xff, 0xff, 0xff, 0xff, // Previous output index 0x07, // Varint for length of signature script 0x04, 0xff, 0xff, 0x00, 0x1d, 0x01, 0x04, // Signature script 0xff, 0xff, 0xff, 0xff, // Sequence diff --git a/wire/fixedIO_test.go b/wire/fixedIO_test.go index ccd67ae4..0952a9b4 100644 --- a/wire/fixedIO_test.go +++ b/wire/fixedIO_test.go @@ -9,7 +9,7 @@ import ( "io" ) -// fixedWriter implements the io.Writer interface and intentially allows +// fixedWriter implements the io.Writer interface and intentionally allows // testing of error paths by forcing short writes. type fixedWriter struct { b []byte @@ -44,7 +44,7 @@ func newFixedWriter(max int) io.Writer { return &fw } -// fixedReader implements the io.Reader interface and intentially allows +// fixedReader implements the io.Reader interface and intentionally allows // testing of error paths by forcing short reads. type fixedReader struct { buf []byte diff --git a/wire/msgalert.go b/wire/msgalert.go index 71c4e220..b99ac89d 100644 --- a/wire/msgalert.go +++ b/wire/msgalert.go @@ -83,7 +83,7 @@ const maxAlertSize = MaxMessagePayload - maxSignatureSize - MaxVarIntPayload - 1 // fit into a maximum size alert. // // maxAlertSize = fixedAlertSize + max(SetCancel) + max(SetSubVer) + 3*(string) -// for caculating maximum number of cancel IDs, set all other var sizes to 0 +// for calculating maximum number of cancel IDs, set all other var sizes to 0 // maxAlertSize = fixedAlertSize + (MaxVarIntPayload-1) + x*sizeOf(int32) // x = (maxAlertSize - fixedAlertSize - MaxVarIntPayload + 1) / 4 const maxCountSetCancel = (maxAlertSize - fixedAlertSize - MaxVarIntPayload + 1) / 4 @@ -92,7 +92,7 @@ const maxCountSetCancel = (maxAlertSize - fixedAlertSize - MaxVarIntPayload + 1) // fit into a maximum size alert. // // maxAlertSize = fixedAlertSize + max(SetCancel) + max(SetSubVer) + 3*(string) -// for caculating maximum number of subversions, set all other var sizes to 0 +// for calculating maximum number of subversions, set all other var sizes to 0 // maxAlertSize = fixedAlertSize + (MaxVarIntPayload-1) + x*sizeOf(string) // x = (maxAlertSize - fixedAlertSize - MaxVarIntPayload + 1) / sizeOf(string) // subversion would typically be something like "/Satoshi:0.7.2/" (15 bytes) diff --git a/wire/msgblock.go b/wire/msgblock.go index d065e85c..59dbbb1c 100644 --- a/wire/msgblock.go +++ b/wire/msgblock.go @@ -245,7 +245,7 @@ func (msg *MsgBlock) Serialize(w io.Writer) error { // SerializeNoWitness encodes a block to w using an identical format to // Serialize, with all (if any) witness data stripped from all transactions. -// This method is provided in additon to the regular Serialize, in order to +// This method is provided in addition to the regular Serialize, in order to // allow one to selectively encode transaction witness data to non-upgraded // peers which are unaware of the new encoding. func (msg *MsgBlock) SerializeNoWitness(w io.Writer) error { diff --git a/wire/msgblock_test.go b/wire/msgblock_test.go index 2a861b20..f0e93869 100644 --- a/wire/msgblock_test.go +++ b/wire/msgblock_test.go @@ -562,7 +562,7 @@ var blockOneBytes = []byte{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Previous output hash - 0xff, 0xff, 0xff, 0xff, // Prevous output index + 0xff, 0xff, 0xff, 0xff, // Previous output index 0x07, // Varint for length of signature script 0x04, 0xff, 0xff, 0x00, 0x1d, 0x01, 0x04, // Signature script (coinbase) 0xff, 0xff, 0xff, 0xff, // Sequence diff --git a/wire/msggetheaders.go b/wire/msggetheaders.go index f49e4c0d..38e5c6bf 100644 --- a/wire/msggetheaders.go +++ b/wire/msggetheaders.go @@ -23,7 +23,7 @@ import ( // // The algorithm for building the block locator hashes should be to add the // hashes in reverse order until you reach the genesis block. In order to keep -// the list of locator hashes to a resonable number of entries, first add the +// the list of locator hashes to a reasonable number of entries, first add the // most recent 10 block hashes, then double the step each loop iteration to // exponentially decrease the number of hashes the further away from head and // closer to the genesis block you get. diff --git a/wire/msgtx_test.go b/wire/msgtx_test.go index 1b3bfd4e..beba569b 100644 --- a/wire/msgtx_test.go +++ b/wire/msgtx_test.go @@ -672,7 +672,7 @@ func TestTxOverflowErrors(t *testing.T) { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Previous output hash - 0xff, 0xff, 0xff, 0xff, // Prevous output index + 0xff, 0xff, 0xff, 0xff, // Previous output index 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // Varint for length of signature script }, pver, BaseEncoding, txVer, &MessageError{}, @@ -688,7 +688,7 @@ func TestTxOverflowErrors(t *testing.T) { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Previous output hash - 0xff, 0xff, 0xff, 0xff, // Prevous output index + 0xff, 0xff, 0xff, 0xff, // Previous output index 0x00, // Varint for length of signature script 0xff, 0xff, 0xff, 0xff, // Sequence 0x01, // Varint for number of output transactions @@ -733,7 +733,7 @@ func TestTxSerializeSizeStripped(t *testing.T) { in *MsgTx // Tx to encode size int // Expected serialized size }{ - // No inputs or outpus. + // No inputs or outputs. {noTx, 10}, // Transcaction with an input and an output. @@ -938,7 +938,7 @@ var multiTxEncoded = []byte{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Previous output hash - 0xff, 0xff, 0xff, 0xff, // Prevous output index + 0xff, 0xff, 0xff, 0xff, // Previous output index 0x07, // Varint for length of signature script 0x04, 0x31, 0xdc, 0x00, 0x1b, 0x01, 0x62, // Signature script 0xff, 0xff, 0xff, 0xff, // Sequence diff --git a/wire/msgversion.go b/wire/msgversion.go index 3077f127..957bae39 100644 --- a/wire/msgversion.go +++ b/wire/msgversion.go @@ -46,7 +46,7 @@ type MsgVersion struct { // connections. Nonce uint64 - // The user agent that generated messsage. This is a encoded as a varString + // The user agent that generated message. This is a encoded as a varString // on the wire. This has a max length of MaxUserAgentLen. UserAgent string