From 03678bb7542e231e677dbefe4773167646d6a267 Mon Sep 17 00:00:00 2001 From: Aaron Campbell Date: Fri, 16 Aug 2019 18:37:58 -0400 Subject: [PATCH] multi: Correct typos. Correct typos found by reading code and creative grepping. --- addrmgr/addrmanager.go | 14 ++++----- addrmgr/network.go | 4 +-- bech32/bech32.go | 2 +- bech32/bech32_test.go | 2 +- blockchain/chain.go | 8 ++--- blockchain/chaingen/generator.go | 6 ++-- blockchain/chainio.go | 4 +-- blockchain/chainio_test.go | 2 +- blockchain/chainview_test.go | 2 +- blockchain/common_test.go | 4 +-- blockchain/compress.go | 2 +- blockchain/difficulty.go | 2 +- blockchain/error.go | 6 ++-- blockchain/example_test.go | 2 +- blockchain/fullblocktests/generate.go | 12 ++++---- blockchain/indexers/addrindex.go | 9 +++--- blockchain/mediantime.go | 2 +- blockchain/notifications.go | 2 +- blockchain/process.go | 2 +- blockchain/sequencelock_test.go | 4 +-- blockchain/stake/error.go | 2 +- blockchain/stake/internal/ticketdb/chainio.go | 2 +- .../internal/tickettreap/benchmark_test.go | 2 +- .../stake/internal/tickettreap/immutable.go | 2 +- .../internal/tickettreap/immutable_test.go | 2 +- blockchain/stake/staketx.go | 4 +-- blockchain/standalone/subsidy.go | 2 +- blockchain/thresholdstate.go | 8 ++--- blockchain/timesorter.go | 2 +- blockchain/upgrade.go | 2 +- blockchain/validate.go | 12 ++++---- blockchain/validate_test.go | 2 +- blockmanager.go | 8 ++--- chaincfg/params.go | 6 ++-- cmd/dcrctl/dcrctl.go | 2 +- config.go | 12 ++++---- connmgr/connmanager_test.go | 2 +- cpuminer.go | 2 +- database/driver.go | 6 ++-- database/driver_test.go | 2 +- database/error.go | 6 ++-- database/export_test.go | 2 +- database/ffldb/blockio.go | 6 ++-- database/ffldb/db.go | 6 ++-- database/ffldb/dbcache.go | 6 ++-- database/ffldb/driver.go | 2 +- database/ffldb/export_test.go | 2 +- database/ffldb/interface_test.go | 8 ++--- database/ffldb/whitebox_test.go | 4 +-- database/interface.go | 2 +- database/internal/treap/README.md | 2 +- database/internal/treap/doc.go | 2 +- database/internal/treap/immutable.go | 2 +- database/internal/treap/immutable_test.go | 2 +- database/internal/treap/mutable.go | 2 +- dcrec/edwards/primitives.go | 2 +- dcrec/edwards/primitives_test.go | 2 +- dcrec/edwards/privkey.go | 2 +- dcrec/secp256k1/field.go | 18 +++++------ dcrec/secp256k1/privkey.go | 2 +- dcrec/secp256k1/schnorr/error.go | 2 +- dcrec/secp256k1/signature.go | 4 +-- dcrjson/cmdparse.go | 2 +- dcrjson/doc.go | 2 +- dcrjson/error.go | 4 +-- dcrjson/help_test.go | 4 +-- dcrjson/register.go | 4 +-- dcrutil/wif.go | 2 +- doc.go | 2 +- docs/code_contribution_guidelines.md | 2 +- fees/estimator.go | 2 +- ipc.go | 2 +- log.go | 2 +- lru/README.md | 6 ++-- lru/cache.go | 2 +- lru/cache_test.go | 2 +- lru/doc.go | 2 +- mempool/mempool.go | 2 +- mempool/mempool_test.go | 4 +-- mining.go | 18 +++++------ mining/mining.go | 2 +- networkparams_test.go | 2 +- peer/peer.go | 2 +- rpc/jsonrpc/types/chainsvrcmds_test.go | 2 +- rpc/jsonrpc/types/chainsvrresults_test.go | 4 +-- rpc/jsonrpc/types/doc.go | 4 +-- rpcclient/extensions.go | 4 +-- rpcclient/infrastructure.go | 7 +++-- rpcclient/net.go | 2 +- rpcclient/notify.go | 4 +-- rpcclient/rawtransactions.go | 2 +- rpcclient/wallet.go | 14 ++++----- rpcserver.go | 30 +++++++++---------- rpcserver_test.go | 2 +- rpcserverhelp.go | 4 +-- rpctest/node.go | 2 +- rpctest/rpc_harness.go | 2 +- rpctest/utils.go | 2 +- rpctest/votingwallet.go | 2 +- rpcwebsocket.go | 4 +-- run_tests.sh | 2 +- sampleconfig/sampleconfig.go | 2 +- server.go | 16 +++++----- txscript/data/script_tests.json | 10 +++---- txscript/doc.go | 2 +- txscript/engine.go | 4 +-- txscript/opcode.go | 4 +-- txscript/reference_test.go | 4 +-- txscript/script.go | 4 +-- txscript/scriptnum.go | 2 +- txscript/sighash.go | 2 +- txscript/sign.go | 9 +++--- txscript/stack_test.go | 2 +- txscript/standard.go | 8 ++--- txscript/standard_test.go | 4 +-- txscript/tokenizer_test.go | 2 +- wire/blockheader_test.go | 2 +- wire/msgcftypes.go | 2 +- wire/msgcftypes_test.go | 2 +- wire/msggetheaders.go | 2 +- wire/msgtx.go | 4 +-- wire/msgtx_test.go | 2 +- 122 files changed, 257 insertions(+), 254 deletions(-) diff --git a/addrmgr/addrmanager.go b/addrmgr/addrmanager.go index cf97a905..989fa517 100644 --- a/addrmgr/addrmanager.go +++ b/addrmgr/addrmanager.go @@ -140,7 +140,7 @@ const ( newBucketsPerAddress = 8 // numMissingDays is the number of days before which we assume an - // address has vanished if we have not seen it announced in that long. + // address has vanished if we have not seen it announced in that long. numMissingDays = 30 // numRetries is the number of tried without a single success before @@ -382,7 +382,7 @@ func (a *AddrManager) savePeers() { return } - // First we make a serialisable datastructure so we can encode it to JSON. + // First we make a serialisable data structure so we can encode it to JSON. sam := new(serializedAddrManager) sam.Version = serialisationVersion copy(sam.Key[:], a.key[:]) @@ -753,7 +753,7 @@ func (a *AddrManager) HostToNetAddress(host string, port uint16, services wire.S // the relevant .onion address. func ipString(na *wire.NetAddress) string { if isOnionCatTor(na) { - // We know now that na.IP is long enogh. + // We know now that na.IP is long enough. base32 := base32.StdEncoding.EncodeToString(na.IP[6:]) return strings.ToLower(base32) + ".onion" } @@ -902,7 +902,7 @@ func (a *AddrManager) Good(addr *wire.NetAddress) { ka.lastattempt = now ka.attempts = 0 - // move to tried set, optionally evicting other addresses if neeed. + // move to tried set, optionally evicting other addresses if needed. if ka.tried { return } @@ -974,7 +974,7 @@ func (a *AddrManager) Good(addr *wire.NetAddress) { a.addrNew[newBucket][rmkey] = rmka } -// SetServices sets the services for the giiven address to the provided value. +// SetServices sets the services for the given address to the provided value. func (a *AddrManager) SetServices(addr *wire.NetAddress, services wire.ServiceFlag) { a.mtx.Lock() defer a.mtx.Unlock() @@ -1070,7 +1070,7 @@ const ( // Ipv6Strong represents a connection state between two IPV6 addresses. Ipv6Strong - // Private reprsents a connection state connect between two Tor addresses. + // Private represents a connection state connect between two Tor addresses. Private ) @@ -1181,7 +1181,7 @@ func (a *AddrManager) GetBestLocalAddress(remoteAddr *wire.NetAddress) *wire.Net return bestAddress } -// IsPeerNaValid asserts if the the provided local address is routable +// IsPeerNaValid asserts if the provided local address is routable // and reachable from the peer that suggested it. func (a *AddrManager) IsPeerNaValid(localAddr, remoteAddr *wire.NetAddress) bool { net := getNetwork(localAddr) diff --git a/addrmgr/network.go b/addrmgr/network.go index 624a8e6c..b721e3e9 100644 --- a/addrmgr/network.go +++ b/addrmgr/network.go @@ -21,7 +21,7 @@ var ( ipNet("192.168.0.0", 16, 32), } - // rfc2544Net specifies the the IPv4 block as defined by RFC2544 + // rfc2544Net specifies the IPv4 block as defined by RFC2544 // (198.18.0.0/15) rfc2544Net = ipNet("198.18.0.0", 15, 32) @@ -78,7 +78,7 @@ var ( // byte number. It then stores the first 6 bytes of the address as // 0xfd, 0x87, 0xd8, 0x7e, 0xeb, 0x43. // - // This is the same range used by OnionCat, which is part part of the + // This is the same range used by OnionCat, which is part of the // RFC4193 unique local IPv6 range. // // In summary the format is: diff --git a/bech32/bech32.go b/bech32/bech32.go index 9a0c28f7..2e03dc7e 100644 --- a/bech32/bech32.go +++ b/bech32/bech32.go @@ -163,7 +163,7 @@ func DecodeNoLimit(bech string) (string, []byte, error) { return "", nil, ErrInvalidLength(len(bech)) } - // Only ASCII characters between 33 and 126 are allowed. + // Only ASCII characters between 33 and 126 are allowed. var hasLower, hasUpper bool for i := 0; i < len(bech); i++ { if bech[i] < 33 || bech[i] > 126 { diff --git a/bech32/bech32_test.go b/bech32/bech32_test.go index 46ac7583..e3a23735 100644 --- a/bech32/bech32_test.go +++ b/bech32/bech32_test.go @@ -115,7 +115,7 @@ func TestCanDecodeUnlimtedBech32(t *testing.T) { } // BenchmarkEncodeDecodeCycle performs a benchmark for a full encode/decode -// cycle of a bech32 string. It also reports the allocation count, which we +// cycle of a bech32 string. It also reports the allocation count, which we // expect to be 2 for a fully optimized cycle. func BenchmarkEncodeDecodeCycle(b *testing.B) { diff --git a/blockchain/chain.go b/blockchain/chain.go index 6f54ecd8..9de249f8 100644 --- a/blockchain/chain.go +++ b/blockchain/chain.go @@ -584,7 +584,7 @@ func (b *BlockChain) fetchBlockByNode(node *blockNode) (*dcrutil.Block, error) { // pruneStakeNodes removes references to old stake nodes which should no // longer be held in memory so as to keep the maximum memory usage down. // It proceeds from the bestNode back to the determined minimum height node, -// finds all the relevant children, and then drops the the stake nodes from +// finds all the relevant children, and then drops the stake nodes from // them by assigning nil and allowing the memory to be recovered by GC. // // This function MUST be called with the chain state lock held (for writes). @@ -914,7 +914,7 @@ func (b *BlockChain) disconnectBlock(node *blockNode, block, parent *dcrutil.Blo } // Update the transaction spend journal by removing the record - // that contains all txos spent by the block . + // that contains all txos spent by the block. err = dbRemoveSpendJournalEntry(dbTx, block.Hash()) if err != nil { return err @@ -1118,7 +1118,7 @@ func (b *BlockChain) reorganizeChainInternal(targetTip *blockNode) error { tip = n.parent } - // Load the fork block if there are blocks to attach and its not already + // Load the fork block if there are blocks to attach and it's not already // loaded which will be the case if no nodes were detached. The fork block // is used as the parent to the first node to be attached below. forkBlock := nextBlockToDetach @@ -1437,7 +1437,7 @@ func (b *BlockChain) connectBestChain(node *blockNode, block, parent *dcrutil.Bl // In the fast add case the code to check the block connection // was skipped, so the utxo view needs to load the referenced // utxos, spend them, and add the new utxos being created by - // this block. Also, in the case the the block votes against + // this block. Also, in the case the block votes against // the parent, its regular transaction tree must be // disconnected. if fastAdd { diff --git a/blockchain/chaingen/generator.go b/blockchain/chaingen/generator.go index 2398601e..612c157e 100644 --- a/blockchain/chaingen/generator.go +++ b/blockchain/chaingen/generator.go @@ -1152,7 +1152,7 @@ func (hp *hash256prng) Hash256Rand() uint32 { } // Roll over the entire PRNG by re-hashing the seed when the hash - // iterator index overlows a uint32. + // iterator index overflows a uint32. if hp.idx > math.MaxUint32 { hp.seed = chainhash.HashH(hp.seed[:]) hp.cachedHash = hp.seed @@ -1568,7 +1568,7 @@ func (g *Generator) ReplaceVoteBitsN(voteNum int, voteBits uint16) func(*wire.Ms stx := b.STransactions[voteNum] if !isVoteTx(stx) { panic(fmt.Sprintf("attempt to replace non-vote "+ - "transaction #%d for for block %s", voteNum, + "transaction #%d for block %s", voteNum, b.BlockHash())) } @@ -2458,7 +2458,7 @@ func (g *Generator) AssertTipBlockSigOpsCount(expected int) { } } -// AssertTipBlockSize panics if the if the current tip block associated with the +// AssertTipBlockSize panics if the current tip block associated with the // generator does not have the specified size when serialized. func (g *Generator) AssertTipBlockSize(expected int) { serializeSize := g.tip.SerializeSize() diff --git a/blockchain/chainio.go b/blockchain/chainio.go index 8a650b8d..916941a1 100644 --- a/blockchain/chainio.go +++ b/blockchain/chainio.go @@ -489,7 +489,7 @@ func dbMaybeStoreBlock(dbTx database.Tx, block *dcrutil.Block) error { // NOTE: The transaction version and flags are only encoded when the spent // txout was the final unspent output of the containing transaction. // Otherwise, the header code will be 0 and the version is not serialized at -// all. This is done because that information is only needed when the utxo +// all. This is done because that information is only needed when the utxo // set no longer has it. // // Example: @@ -511,7 +511,7 @@ type spentTxOut struct { amount int64 // The amount of the output. txType stake.TxType // The stake type of the transaction. - height uint32 // Height of the the block containing the tx. + height uint32 // Height of the block containing the tx. index uint32 // Index in the block of the transaction. scriptVersion uint16 // The version of the scripting language. txVersion uint16 // The version of creating tx. diff --git a/blockchain/chainio_test.go b/blockchain/chainio_test.go index 896d98d5..a6559765 100644 --- a/blockchain/chainio_test.go +++ b/blockchain/chainio_test.go @@ -931,7 +931,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/chainview_test.go b/blockchain/chainview_test.go index 4ef9d22d..d79ed3d9 100644 --- a/blockchain/chainview_test.go +++ b/blockchain/chainview_test.go @@ -375,7 +375,7 @@ testLoop: // TestChainViewNil ensures that creating and accessing a nil chain view behaves // as expected. func TestChainViewNil(t *testing.T) { - // Ensure two unininitialized views are considered equal. + // Ensure two uninitialized views are considered equal. view := newChainView(nil) if !view.Equals(newChainView(nil)) { t.Fatal("uninitialized nil views unequal") diff --git a/blockchain/common_test.go b/blockchain/common_test.go index 5f287258..f65e6e0d 100644 --- a/blockchain/common_test.go +++ b/blockchain/common_test.go @@ -116,7 +116,7 @@ func chainSetup(dbName string, params *chaincfg.Params) (*BlockChain, func(), er return chain, teardown, nil } -// 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. @@ -651,7 +651,7 @@ func (g *chaingenHarness) AdvanceToStakeValidationHeight() { func (g *chaingenHarness) AdvanceFromSVHToActiveAgenda(voteID string) { g.t.Helper() - // Find the correct deployment for the provided ID along with the the yes + // Find the correct deployment for the provided ID along with the yes // vote choice within it. params := g.Params() deploymentVer, deployment, err := findDeployment(params, voteID) diff --git a/blockchain/compress.go b/blockchain/compress.go index c97081fc..0892511d 100644 --- a/blockchain/compress.go +++ b/blockchain/compress.go @@ -723,7 +723,7 @@ const ( // from the flags byte. txTypeBitmask = 0x0c - // txTypeShift is the number of bits to shift falgs to the right to yield the + // txTypeShift is the number of bits to shift flags to the right to yield the // correct integer value after applying the bitmask with AND. txTypeShift = 2 ) diff --git a/blockchain/difficulty.go b/blockchain/difficulty.go index 48886b6b..0d3b523d 100644 --- a/blockchain/difficulty.go +++ b/blockchain/difficulty.go @@ -640,7 +640,7 @@ func calcNextStakeDiffV2(params *chaincfg.Params, nextHeight, curDiff, prevPoolS // nextDiff = ----------------------------------- // prevPoolSizeAll * targetPoolSizeAll // - // Further, the Sub parameter must calculate the denomitor first using + // Further, the Sub parameter must calculate the denominator first using // integer math. targetPoolSizeAll := votesPerBlock * (ticketPoolSize + ticketMaturity) curPoolSizeAllBig := big.NewInt(curPoolSizeAll) diff --git a/blockchain/error.go b/blockchain/error.go index 53c7f58b..5656eaad 100644 --- a/blockchain/error.go +++ b/blockchain/error.go @@ -110,8 +110,8 @@ 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 - // range. + // value based on difficulty regarding the rules or it is out of the + // valid range. ErrUnexpectedDifficulty // ErrHighHash indicates the block does not hash to a value which is @@ -390,7 +390,7 @@ const ( ErrRegTxCreateStakeOut // ErrInvalidFinalState indicates that the final state of the PRNG included - // in the the block differed from the calculated final state. + // in the block differed from the calculated final state. ErrInvalidFinalState // ErrPoolSize indicates an error in the ticket pool size for this block. diff --git a/blockchain/example_test.go b/blockchain/example_test.go index db76c3d2..f02664f9 100644 --- a/blockchain/example_test.go +++ b/blockchain/example_test.go @@ -18,7 +18,7 @@ import ( ) // This example demonstrates how to create a new chain instance and use -// ProcessBlock to attempt to attempt add a block to the chain. As the package +// ProcessBlock to attempt to add a block to the chain. As the package // overview documentation describes, this includes all of the Decred consensus // rules. This example intentionally attempts to insert a duplicate genesis // block to illustrate how an invalid block is handled. diff --git a/blockchain/fullblocktests/generate.go b/blockchain/fullblocktests/generate.go index 56b02832..b2b7955b 100644 --- a/blockchain/fullblocktests/generate.go +++ b/blockchain/fullblocktests/generate.go @@ -272,7 +272,7 @@ func replaceStakeSigScript(sigScript []byte) func(*wire.MsgBlock) { } // additionalPoWTx returns a function that itself takes a block and modifies it -// by adding the the provided transaction to the regular transaction tree. +// by adding the provided transaction to the regular transaction tree. func additionalPoWTx(tx *wire.MsgTx) func(*wire.MsgBlock) { return func(b *wire.MsgBlock) { b.AddTransaction(tx) @@ -307,8 +307,8 @@ func encodeNonCanonicalBlock(b *wire.MsgBlock) []byte { return buf.Bytes() } -// assertTipsNonCanonicalBlockSize panics if the if the current tip block -// associated with the generator does not have the specified non-canonical size +// assertTipsNonCanonicalBlockSize panics if the current tip block associated +// with the generator does not have the specified non-canonical size // when serialized. func assertTipNonCanonicalBlockSize(g *chaingen.Generator, expected int) { tip := g.Tip() @@ -726,7 +726,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, @@ -1879,8 +1879,8 @@ func Generate(includeLargeReorg bool) (tests [][]TestInstance, err error) { // Create block with duplicate transactions in the regular transaction // tree. // - // This test relies on the shape of the shape of the merkle tree to test - // the intended condition. That is the reason for the assertion. + // This test relies on the shape of the merkle tree to test the + // intended condition. That is the reason for the assertion. // // ... -> brs3(14) // \-> bmf14(15) diff --git a/blockchain/indexers/addrindex.go b/blockchain/indexers/addrindex.go index 05d0f1b3..8298bab4 100644 --- a/blockchain/indexers/addrindex.go +++ b/blockchain/indexers/addrindex.go @@ -42,7 +42,8 @@ const ( // consumes. It consists of the address key + 1 byte for the level. levelKeySize = addrKeySize + 1 - // levelOffset is the offset in the level key which identifes the level. + // levelOffset is the offset in the level key which identifies the + // level. levelOffset = levelKeySize - 1 // addrKeyTypePubKeyHash is the address type in an address key which @@ -159,7 +160,7 @@ func serializeAddrIndexEntry(blockID uint32, txLoc wire.TxLoc, blockIndex uint32 // 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, entry *TxIndexEntry, fetchBlockHash fetchBlockHashFunc) error { // Ensure there are enough bytes to decode. @@ -361,7 +362,7 @@ func maxEntriesForLevel(level uint8) int { return numEntries } -// dbRemoveAddrIndexEntries removes the specified number of entries from from +// dbRemoveAddrIndexEntries removes the specified number of entries from // the address index for the provided key. An assertion error will be returned // if the count exceeds the total number of entries in the index. func dbRemoveAddrIndexEntries(bucket internalBucket, addrKey [addrKeySize]byte, count int) error { @@ -503,7 +504,7 @@ func dbRemoveAddrIndexEntries(bucket internalBucket, addrKey [addrKeySize]byte, // be half full. When that is the case, move it up a level to // simplify the code below which backfills all lower levels that // are still empty. This also means the current level will be - // empty, so the loop will perform another another iteration to + // empty, so the loop will perform another iteration to // potentially backfill this level with data from the next one. curLevelMaxEntries := maxEntriesForLevel(level) if len(levelData)/txEntrySize != curLevelMaxEntries { diff --git a/blockchain/mediantime.go b/blockchain/mediantime.go index 1970e6d3..632acdd6 100644 --- a/blockchain/mediantime.go +++ b/blockchain/mediantime.go @@ -19,7 +19,7 @@ const ( maxAllowedOffsetSecs = 70 * 60 // 1 hour 10 minutes // similarTimeSecs is the number of seconds in either direction from the - // local clock that is used to determine that it is likley wrong and + // local clock that is used to determine that it is likely wrong and // hence to show a warning. similarTimeSecs = 5 * 60 // 5 minutes ) diff --git a/blockchain/notifications.go b/blockchain/notifications.go index 0c259d56..4d258c04 100644 --- a/blockchain/notifications.go +++ b/blockchain/notifications.go @@ -32,7 +32,7 @@ const ( // of work was expended to create a block which satisifies the proof of // work requirement. // - // Finally, this notification is only sent if the the chain is believed + // Finally, this notification is only sent if the chain is believed // to be current and the chain lock is NOT released, so consumers must // take care to avoid calling blockchain functions to avoid potential // deadlock. diff --git a/blockchain/process.go b/blockchain/process.go index a7dd7648..4c74f9fe 100644 --- a/blockchain/process.go +++ b/blockchain/process.go @@ -98,7 +98,7 @@ func (b *BlockChain) processOrphans(hash *chainhash.Hash, flags BehaviorFlags) e // the block chain along with best chain selection and reorganization. // // When no errors occurred during processing, the first return value indicates -// the length of the fork the block extended. In the case it either exteneded +// the length of the fork the block extended. In the case it either extended // the best chain or is now the tip of the best chain due to causing a // reorganize, the fork length will be 0. The second return value indicates // whether or not the block is an orphan, in which case the fork length will diff --git a/blockchain/sequencelock_test.go b/blockchain/sequencelock_test.go index 49cf72fc..d405d89d 100644 --- a/blockchain/sequencelock_test.go +++ b/blockchain/sequencelock_test.go @@ -223,7 +223,7 @@ func TestCalcSequenceLock(t *testing.T) { { // A transaction with a single input. The input's // sequence number encodes a relative locktime in blocks - // (3 blocks). The sequence lock should have a value + // (3 blocks). The sequence lock should have a value // of -1 for seconds, but a height of 2 meaning it can // be included at height 3. name: "3 blocks", @@ -381,7 +381,7 @@ func TestCalcSequenceLock(t *testing.T) { // Ensure both the returned sequence lock seconds and block // height match the expected values. if seqLock.MinTime != test.want.MinTime { - t.Errorf("%s: mistmached seconds - got %v, want %v", + t.Errorf("%s: mismatched seconds - got %v, want %v", test.name, seqLock.MinTime, test.want.MinTime) continue } diff --git a/blockchain/stake/error.go b/blockchain/stake/error.go index 831ad0f6..28f26d18 100644 --- a/blockchain/stake/error.go +++ b/blockchain/stake/error.go @@ -38,7 +38,7 @@ const ( // OP_RETURNs were missing or contained invalid addresses. ErrSStxInvalidOutputs - // ErrSStxInOutProportions indicates the the number of inputs in an SStx + // ErrSStxInOutProportions indicates the number of inputs in an SStx // was not equal to the number of output minus one. ErrSStxInOutProportions diff --git a/blockchain/stake/internal/ticketdb/chainio.go b/blockchain/stake/internal/ticketdb/chainio.go index a01502aa..4ab3ac2a 100644 --- a/blockchain/stake/internal/ticketdb/chainio.go +++ b/blockchain/stake/internal/ticketdb/chainio.go @@ -59,7 +59,7 @@ const ( // v: height // // 4. BlockUndo -// Block removal data, for reverting the the first 3 database buckets to +// Block removal data, for reverting the first 3 database buckets to // a previous state. // // k: height diff --git a/blockchain/stake/internal/tickettreap/benchmark_test.go b/blockchain/stake/internal/tickettreap/benchmark_test.go index 7599af40..5e5d26a5 100644 --- a/blockchain/stake/internal/tickettreap/benchmark_test.go +++ b/blockchain/stake/internal/tickettreap/benchmark_test.go @@ -15,7 +15,7 @@ const numTicketKeys = 42500 var ( // generatedTicketKeys is used to store ticket keys generated for use - // in the benchmarks so that they only need to be generatd once for all + // in the benchmarks so that they only need to be generated once for all // benchmarks that use them. genTicketKeysLock sync.Mutex generatedTicketKeys []Key diff --git a/blockchain/stake/internal/tickettreap/immutable.go b/blockchain/stake/internal/tickettreap/immutable.go index 5b3213b9..14eb54c2 100644 --- a/blockchain/stake/internal/tickettreap/immutable.go +++ b/blockchain/stake/internal/tickettreap/immutable.go @@ -57,7 +57,7 @@ type Immutable struct { root *treapNode count int - // totalSize is the best estimate of the total size of of all data in + // totalSize is the best estimate of the total size of all data in // the treap including the keys, values, and node sizes. totalSize uint64 } diff --git a/blockchain/stake/internal/tickettreap/immutable_test.go b/blockchain/stake/internal/tickettreap/immutable_test.go index 4c136451..7bb0d245 100644 --- a/blockchain/stake/internal/tickettreap/immutable_test.go +++ b/blockchain/stake/internal/tickettreap/immutable_test.go @@ -463,7 +463,7 @@ func TestImmutableDuplicatePut(t *testing.T) { testTreap = testTreap.Put(key, value) expectedSize += nodeFieldsSize + uint64(len(key)) + nodeValueSize - // Put a duplicate key with the the expected final value. + // Put a duplicate key with the expected final value. testTreap = testTreap.Put(key, expectedVal) // Ensure the key still exists and is the new value. diff --git a/blockchain/stake/staketx.go b/blockchain/stake/staketx.go index 52f35b88..ec786cc3 100644 --- a/blockchain/stake/staketx.go +++ b/blockchain/stake/staketx.go @@ -65,12 +65,12 @@ const ( // hash of the block in which voting was missed. MaxOutputsPerSSRtx = MaxInputsPerSStx - // SStxPKHMinOutSize is the minimum size of of an OP_RETURN commitment output + // SStxPKHMinOutSize is the minimum size of an OP_RETURN commitment output // for an SStx tx. // 20 bytes P2SH/P2PKH + 8 byte amount + 4 byte fee range limits SStxPKHMinOutSize = 32 - // SStxPKHMaxOutSize is the maximum size of of an OP_RETURN commitment output + // SStxPKHMaxOutSize is the maximum size of an OP_RETURN commitment output // for an SStx tx. SStxPKHMaxOutSize = 77 diff --git a/blockchain/standalone/subsidy.go b/blockchain/standalone/subsidy.go index 10fca517..b9f71042 100644 --- a/blockchain/standalone/subsidy.go +++ b/blockchain/standalone/subsidy.go @@ -190,7 +190,7 @@ func (c *SubsidyCache) CalcBlockSubsidy(height int64) int64 { // subsidy for the requested interval. if reqInterval > lastCachedInterval { // Return zero for all intervals after the subsidy reaches zero. This - // enforces an upper bound on the the number of entries in the cache. + // enforces an upper bound on the number of entries in the cache. if lastCachedSubsidy == 0 { return 0 } diff --git a/blockchain/thresholdstate.go b/blockchain/thresholdstate.go index 3f965ea8..0fc5d4d4 100644 --- a/blockchain/thresholdstate.go +++ b/blockchain/thresholdstate.go @@ -188,7 +188,7 @@ func (c *thresholdStateCache) Update(hash chainhash.Hash, state ThresholdStateTu c.entries[hash] = state } -// MarkFlushed marks all of the current udpates as flushed to the database. +// MarkFlushed marks all of the current updates as flushed to the database. // This is useful so the caller can ensure the needed database updates are not // lost until they have successfully been written to the database. func (c *thresholdStateCache) MarkFlushed() { @@ -666,9 +666,9 @@ func (b *BlockChain) isFixSeqLocksAgendaActive(prevNode *blockNode) (bool, error return state.State == ThresholdActive, nil } -// IsFixSeqLocksAgendaActive returns whether or not whether or not the fix -// sequence locks agenda vote, as defined in DCP0004 has passed and is now -// active for the block AFTER the current best chain block. +// IsFixSeqLocksAgendaActive returns whether or not the fix sequence locks +// agenda vote, as defined in DCP0004 has passed and is now active for the +// block AFTER the current best chain block. // // This function is safe for concurrent access. func (b *BlockChain) IsFixSeqLocksAgendaActive() (bool, error) { diff --git a/blockchain/timesorter.go b/blockchain/timesorter.go index 572762c3..76277d19 100644 --- a/blockchain/timesorter.go +++ b/blockchain/timesorter.go @@ -21,7 +21,7 @@ func (s timeSorter) Swap(i, j int) { s[i], s[j] = s[j], s[i] } -// Less returns whether the timstamp with index i should sort before the +// Less returns whether the timestamp with index i should sort before the // timestamp with index j. It is part of the sort.Interface implementation. func (s timeSorter) Less(i, j int) bool { return s[i] < s[j] diff --git a/blockchain/upgrade.go b/blockchain/upgrade.go index 61a84e38..f2afaaf9 100644 --- a/blockchain/upgrade.go +++ b/blockchain/upgrade.go @@ -242,7 +242,7 @@ func upgradeToVersion2(db database.DB, chainParams *chaincfg.Params, dbInfo *dat } // migrateBlockIndex migrates all block entries from the v1 block index bucket -// manged by ffldb to the v2 bucket managed by this package. The v1 bucket +// managed by ffldb to the v2 bucket managed by this package. The v1 bucket // stored all block entries keyed by block hash, whereas the v2 bucket stores // them keyed by block height + hash. Also, the old block index only stored the // header, while the new one stores all info needed to recreate block nodes. diff --git a/blockchain/validate.go b/blockchain/validate.go index 6d8ff031..e4993ff4 100644 --- a/blockchain/validate.go +++ b/blockchain/validate.go @@ -725,7 +725,7 @@ func checkBlockSanity(block *dcrutil.Block, timeSource MedianTimeSource, flags B return ruleError(ErrTooManyRevocations, errStr) } - // A block must only contain stake transactions of the the allowed + // A block must only contain stake transactions of the allowed // types. // // NOTE: This is not possible to hit at the time this comment was @@ -752,7 +752,7 @@ func checkBlockSanity(block *dcrutil.Block, timeSource MedianTimeSource, flags B return ruleError(ErrFreshStakeMismatch, errStr) } - // A block header must commit to the the actual number of votes that are + // A block header must commit to the actual number of votes that are // in the block. if int64(header.Voters) != totalVotes { errStr := fmt.Sprintf("block header commitment to %d votes "+ @@ -1027,7 +1027,7 @@ func (b *BlockChain) checkBlockHeaderPositional(header *wire.BlockHeader, prevNo // // The flags modify the behavior of this function as follows: // - BFFastAdd: The transactions are not checked to see if they are expired and -// the coinbae height check is not performed. +// the coinbase height check is not performed. // // The flags are also passed to checkBlockHeaderPositional. See its // documentation for how the flags modify its behavior. @@ -1794,7 +1794,7 @@ func checkTicketRedeemerCommitments(ticketHash *chainhash.Hash, ticketOuts []*st // revocations). // // It should be noted that, due to the scaling, the sum of the generated - // amounts for mult-participant votes might be a few atoms less than + // amounts for multi-participant votes might be a few atoms less than // the full amount and the difference is treated as a standard // transaction fee. commitmentAmt := extractTicketCommitAmount(commitmentScript) @@ -1803,7 +1803,7 @@ func checkTicketRedeemerCommitments(ticketHash *chainhash.Hash, ticketOuts []*st // Ensure the amount paid adheres to the commitment while taking into // account any fee limits that might be imposed. The output amount must - // exactly match the calculated amount when when not encumbered with a + // exactly match the calculated amount when not encumbered with a // fee limit. On the other hand, when it is encumbered, it must be // between the minimum amount imposed by the fee limit and the // calculated amount. @@ -2096,7 +2096,7 @@ func CheckTransactionInputs(subsidyCache *standalone.SubsidyCache, tx *dcrutil.T } } - // Perform additional checks on vote transactions such as verying that the + // Perform additional checks on vote transactions such as verifying that the // referenced ticket exists, the stakebase input commits to correct subsidy, // the output amounts adhere to the commitments of the referenced ticket, // and the ticket maturity requirements are met. diff --git a/blockchain/validate_test.go b/blockchain/validate_test.go index 3375a608..afdc19eb 100644 --- a/blockchain/validate_test.go +++ b/blockchain/validate_test.go @@ -215,7 +215,7 @@ func TestSequenceLocksActive(t *testing.T) { got := SequenceLockActive(&seqLock, test.blockHeight, time.Unix(test.medianTime, 0)) if got != test.want { - t.Errorf("%s: mismatched seqence lock status - got %v, "+ + t.Errorf("%s: mismatched sequence lock status - got %v, "+ "want %v", test.name, got, test.want) continue } diff --git a/blockmanager.go b/blockmanager.go index e0ed58c8..bd480358 100644 --- a/blockmanager.go +++ b/blockmanager.go @@ -301,7 +301,7 @@ type PeerNotifier interface { // the passed transactions. AnnounceNewTransactions(txns []*dcrutil.Tx) - // UpdatePeerHeights updates the heights of all peers who have have + // UpdatePeerHeights updates the heights of all peers who have // announced the latest connected main chain block, or a recognized orphan. UpdatePeerHeights(latestBlkHash *chainhash.Hash, latestHeight int64, updateSource *serverPeer) @@ -1322,7 +1322,7 @@ func (b *blockManager) haveInventory(invVect *wire.InvVect) (bool, error) { return entry != nil && !entry.IsFullySpent(), nil } - // The requested inventory is is an unsupported type, so just claim + // The requested inventory is an unsupported type, so just claim // it is known to avoid requesting it. return true, nil } @@ -1754,7 +1754,7 @@ func (b *blockManager) handleBlockchainNotification(notification *blockchain.Not // which could result in a deadlock. block, ok := notification.Data.(*dcrutil.Block) if !ok { - bmgrLog.Warnf("New tip block checkedd notification is not a block.") + bmgrLog.Warnf("New tip block checked notification is not a block.") break } @@ -1806,7 +1806,7 @@ func (b *blockManager) handleBlockchainNotification(notification *blockchain.Not // other words, it is extending the shorter side chain. The reorg depth // would be 106 - (103 - 3) = 6. This should intuitively make sense, // because if the side chain were to be extended enough to become the - // best chain, it would result in a a reorg that would remove 6 blocks, + // best chain, it would result in a reorg that would remove 6 blocks, // namely blocks 101, 102, 103, 104, 105, and 106. blockHash := block.Hash() bestHeight := band.BestHeight diff --git a/chaincfg/params.go b/chaincfg/params.go index 51b7af9b..4447934d 100644 --- a/chaincfg/params.go +++ b/chaincfg/params.go @@ -95,7 +95,7 @@ type Choice struct { // (abstain) and exist only once in the Vote.Choices array. IsAbstain bool - // This coince indicates a hard No Vote. By convention this must exist + // This choice indicates a hard No Vote. By convention this must exist // only once in the Vote.Choices array. IsNo bool } @@ -114,7 +114,7 @@ func (v *Vote) VoteIndex(vote uint16) int { } const ( - // VoteIDMaxBlockSize is the vote ID for the the maximum block size + // VoteIDMaxBlockSize is the vote ID for the maximum block size // increase agenda used for the hard fork demo. VoteIDMaxBlockSize = "maxblocksize" @@ -364,7 +364,7 @@ type Params struct { // SLIP-0044 registered coin type used for BIP44, used in the hierarchical // deterministic path for address generation. - // All SLIP-0044 registered coin types are are defined here: + // All SLIP-0044 registered coin types are defined here: // https://github.com/satoshilabs/slips/blob/master/slip-0044.md SLIP0044CoinType uint32 diff --git a/cmd/dcrctl/dcrctl.go b/cmd/dcrctl/dcrctl.go index d426fb69..94640b38 100644 --- a/cmd/dcrctl/dcrctl.go +++ b/cmd/dcrctl/dcrctl.go @@ -120,7 +120,7 @@ func main() { cmd, err := dcrjson.NewCmd(method, params...) if err != nil { // Show the error along with its error code when it's a - // dcrjson.Error as it reallistcally will always be since the + // dcrjson.Error as it realistically will always be since the // NewCmd function is only supposed to return errors of that // type. if jerr, ok := err.(dcrjson.Error); ok { diff --git a/config.go b/config.go index 967272ef..893e68cb 100644 --- a/config.go +++ b/config.go @@ -149,7 +149,7 @@ type config struct { MaxOrphanTxs int `long:"maxorphantx" description:"Max number of orphan transactions to keep in memory"` Generate bool `long:"generate" description:"Generate (mine) coins using the CPU"` MiningAddrs []string `long:"miningaddr" description:"Add the specified payment address to the list of addresses to use for generated blocks -- At least one address is required if the generate option is set"` - BlockMinSize uint32 `long:"blockminsize" description:"Mininum block size in bytes to be used when creating a block"` + BlockMinSize uint32 `long:"blockminsize" description:"Minimum block size in bytes to be used when creating a block"` BlockMaxSize uint32 `long:"blockmaxsize" description:"Maximum block size in bytes to be used when creating a block"` BlockPrioritySize uint32 `long:"blockprioritysize" description:"Size in bytes for high-priority/low-fee transactions when creating a block"` SigCacheMaxSize uint `long:"sigcachemaxsize" description:"The maximum number of entries in the signature verification cache"` @@ -267,7 +267,7 @@ func supportedSubsystems() []string { // the levels accordingly. An appropriate error is returned if anything is // invalid. func parseAndSetDebugLevels(debugLevel string) error { - // When the specified string doesn't have any delimters, treat it as + // When the specified string doesn't have any delimiters, treat it as // the log level for all subsystems. if !strings.Contains(debugLevel, ",") && !strings.Contains(debugLevel, "=") { // Validate debug log level. @@ -298,7 +298,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()) } @@ -899,7 +899,7 @@ func loadConfig() (*config, []string, error) { return nil, nil, err } - // Validate the the minrelaytxfee. + // Validate the minrelaytxfee. cfg.minRelayTxFee, err = dcrutil.NewAmount(cfg.MinRelayTxFee) if err != nil { str := "%s: invalid minrelaytxfee: %v" @@ -924,7 +924,7 @@ func loadConfig() (*config, []string, error) { return nil, nil, err } - // Limit the max orphan count to a sane vlue. + // Limit the max orphan count to a sane value. if cfg.MaxOrphanTxs < 0 { str := "%s: the maxorphantx option may not be less than 0 " + "-- parsed [%d]" @@ -981,7 +981,7 @@ func loadConfig() (*config, []string, error) { // !--nocfilters and --dropcfindex do not mix. if !cfg.NoCFilters && cfg.DropCFIndex { - err := errors.New("dropcfindex cannot be actived without nocfilters") + err := errors.New("dropcfindex cannot be activated without nocfilters") fmt.Fprintln(os.Stderr, err) fmt.Fprintln(os.Stderr, usageMessage) return nil, nil, err diff --git a/connmgr/connmanager_test.go b/connmgr/connmanager_test.go index 4ef3ccc3..5a4ca3f3 100644 --- a/connmgr/connmanager_test.go +++ b/connmgr/connmanager_test.go @@ -459,7 +459,7 @@ func TestNetworkFailure(t *testing.T) { // TestStopFailed tests that failed connections are ignored after connmgr is // stopped. // -// We have a dailer which sets the stop flag on the conn manager and returns an +// We have a dialer which sets the stop flag on the conn manager and returns an // err so that the handler assumes that the conn manager is stopped and ignores // the failure. func TestStopFailed(t *testing.T) { diff --git a/cpuminer.go b/cpuminer.go index 008b3bc9..1e0a21f6 100644 --- a/cpuminer.go +++ b/cpuminer.go @@ -91,7 +91,7 @@ type cpuminerConfig struct { // block chain is current. This is used by the automatic persistent // mining routine to determine whether or it should attempt mining. // This is useful because there is no point in mining if the chain is - // not current since any solved blocks would be on a side chain and and + // not current since any solved blocks would be on a side chain and // up orphaned anyways. IsCurrent func() bool } diff --git a/database/driver.go b/database/driver.go index 4d957b07..1abd0dfb 100644 --- a/database/driver.go +++ b/database/driver.go @@ -36,7 +36,7 @@ type Driver struct { var drivers = make(map[string]*Driver) // RegisterDriver adds a backend database driver to available interfaces. -// ErrDbTypeRegistered will be retruned if the database type for the driver has +// ErrDbTypeRegistered will be returned if the database type for the driver has // already been registered. func RegisterDriver(driver Driver) error { if _, exists := drivers[driver.DbType]; exists { @@ -63,7 +63,7 @@ func SupportedDrivers() []string { // arguments are specific to the database type driver. See the documentation // for the database driver for further details. // -// ErrDbUnknownType will be returned if the the database type is not registered. +// ErrDbUnknownType will be returned if the database type is not registered. func Create(dbType string, args ...interface{}) (DB, error) { drv, exists := drivers[dbType] if !exists { @@ -78,7 +78,7 @@ func Create(dbType string, args ...interface{}) (DB, error) { // specific to the database type driver. See the documentation for the database // driver for further details. // -// ErrDbUnknownType will be returned if the the database type is not registered. +// ErrDbUnknownType will be returned if the database type is not registered. func Open(dbType string, args ...interface{}) (DB, error) { drv, exists := drivers[dbType] if !exists { diff --git a/database/driver_test.go b/database/driver_test.go index 04d6ae5f..7522190e 100644 --- a/database/driver_test.go +++ b/database/driver_test.go @@ -22,7 +22,7 @@ var ( ) // checkDbError ensures the passed error is a database.Error with an error code -// that matches the passed error code. +// that matches the passed error code. func checkDbError(t *testing.T, testName string, gotErr error, wantErrCode database.ErrorCode) bool { dbErr, ok := gotErr.(database.Error) if !ok { diff --git a/database/error.go b/database/error.go index 5d1dbeb6..c76c7fe4 100644 --- a/database/error.go +++ b/database/error.go @@ -82,14 +82,14 @@ const ( // ErrKeyRequired indicates at attempt to insert a zero-length key. ErrKeyRequired - // ErrKeyTooLarge indicates an attmempt to insert a key that is larger + // ErrKeyTooLarge indicates an attempt to insert a key that is larger // than the max allowed key size. The max key size depends on the // specific backend driver being used. As a general rule, key sizes // should be relatively, so this should rarely be an issue. ErrKeyTooLarge - // ErrValueTooLarge indicates an attmpt to insert a value that is larger - // than max allowed value size. The max key size depends on the + // 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/export_test.go b/database/export_test.go index 201c91b0..9a6b8080 100644 --- a/database/export_test.go +++ b/database/export_test.go @@ -4,7 +4,7 @@ // license that can be found in the LICENSE file. /* -This test file is part of the database package rather than than the +This test file is part of the database package rather than the database_test package so it can bridge access to the internals to properly test cases which are either not possible or can't reliably be tested via the public interface. The functions, constants, and variables are only exported while the diff --git a/database/ffldb/blockio.go b/database/ffldb/blockio.go index ce28f812..85d53640 100644 --- a/database/ffldb/blockio.go +++ b/database/ffldb/blockio.go @@ -134,10 +134,10 @@ type blockStore struct { // lruMutex protects concurrent access to the least recently used list // and lookup map. // - // openBlocksLRU tracks how the open files are refenced by pushing the + // openBlocksLRU tracks how the open files are referenced by pushing the // most recently used files to the front of the list thereby trickling // the least recently used files to end of the list. When a file needs - // to be closed due to exceeding the the max number of allowed open + // to be closed due to exceeding the max number of allowed open // files, the one at the end of the list is closed. // // fileNumToLRUElem is a mapping between a specific block file number @@ -744,7 +744,7 @@ func scanBlockFiles(dbPath string) (int, uint32) { // and offset set and all fields initialized. func newBlockStore(basePath string, network wire.CurrencyNet) *blockStore { // Look for the end of the latest block to file to determine what the - // write cursor position is from the viewpoing of the block files on + // write cursor position is from the viewpoint of the block files on // disk. fileNum, fileOff := scanBlockFiles(basePath) if fileNum == -1 { diff --git a/database/ffldb/db.go b/database/ffldb/db.go index eb7d3c11..36764935 100644 --- a/database/ffldb/db.go +++ b/database/ffldb/db.go @@ -132,7 +132,7 @@ func makeDbErr(c database.ErrorCode, desc string, err error) database.Error { } // convertErr converts the passed leveldb error into a database error with an -// equivalent error code and the passed description. It also sets the passed +// equivalent error code and the passed description. It also sets the passed // error as the underlying error. func convertErr(desc string, ldbErr error) database.Error { // Use the driver-specific error code by default. The code below will @@ -1015,7 +1015,7 @@ func (tx *transaction) notifyActiveIters() { tx.activeIterLock.RUnlock() } -// checkClosed returns an error if the the database or transaction is closed. +// checkClosed returns an error if the database or transaction is closed. func (tx *transaction) checkClosed() error { // The transaction is no longer valid if it has been closed. if tx.closed { @@ -1090,7 +1090,7 @@ func (tx *transaction) deleteKey(key []byte, notifyIterators bool) { // transaction commit if needed. tx.pendingKeys.Delete(key) - // Add the key to the list to be deleted on transaction commit. + // Add the key to the list to be deleted on transaction commit. tx.pendingRemove.Put(key, nil) // Notify the active iterators about the change if the flag is set. diff --git a/database/ffldb/dbcache.go b/database/ffldb/dbcache.go index bf212e2c..62715353 100644 --- a/database/ffldb/dbcache.go +++ b/database/ffldb/dbcache.go @@ -468,9 +468,9 @@ func (c *dbCache) commitTreaps(pendingKeys, pendingRemove TreapForEacher) error }) } -// flush flushes the database cache to persistent storage. This involes syncing -// the block store and replaying all transactions that have been applied to the -// cache to the underlying database. +// flush flushes the database cache to persistent storage. This involves +// syncing the block store and replaying all transactions that have been +// applied to the cache to the underlying database. // // This function MUST be called with the database write lock held. func (c *dbCache) flush() error { diff --git a/database/ffldb/driver.go b/database/ffldb/driver.go index 8a15da82..7a941999 100644 --- a/database/ffldb/driver.go +++ b/database/ffldb/driver.go @@ -79,7 +79,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/export_test.go b/database/ffldb/export_test.go index 9c21de2d..14b9018b 100644 --- a/database/ffldb/export_test.go +++ b/database/ffldb/export_test.go @@ -4,7 +4,7 @@ // license that can be found in the LICENSE file. /* -This test file is part of the ffldb package rather than than the ffldb_test +This test file is part of the ffldb package rather than the ffldb_test package so it can bridge access to the internals to properly test cases which are either not possible or can't reliably be tested via the public interface. The functions are only exported while the tests are being run. diff --git a/database/ffldb/interface_test.go b/database/ffldb/interface_test.go index 469c5237..e4c1ed6b 100644 --- a/database/ffldb/interface_test.go +++ b/database/ffldb/interface_test.go @@ -89,7 +89,7 @@ func loadBlocks(t *testing.T, dataFile string, network wire.CurrencyNet) ([]*dcr } // checkDbError ensures the passed error is a database.Error with an error code -// that matches the passed error code. +// that matches the passed error code. func checkDbError(t *testing.T, testName string, gotErr error, wantErrCode database.ErrorCode) bool { dbErr, ok := gotErr.(database.Error) if !ok { @@ -230,7 +230,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. @@ -615,7 +615,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. // @@ -1189,7 +1189,7 @@ func testFetchBlockIOMissing(tc *testContext, tx database.Tx) bool { // testFetchBlockIO ensures all of the block retrieval API functions work as // expected for the provide set of blocks. The blocks must already be stored in -// the database, or at least stored into the the passed transaction. It also +// the database, or at least stored into the passed transaction. It also // tests several error conditions such as ensuring the expected errors are // returned when fetching blocks, headers, and regions that don't exist. func testFetchBlockIO(tc *testContext, tx database.Tx) bool { diff --git a/database/ffldb/whitebox_test.go b/database/ffldb/whitebox_test.go index c625b9b4..8aff99d7 100644 --- a/database/ffldb/whitebox_test.go +++ b/database/ffldb/whitebox_test.go @@ -84,7 +84,7 @@ func loadBlocks(t *testing.T, dataFile string, network wire.CurrencyNet) ([]*dcr } // checkDbError ensures the passed error is a database.Error with an error code -// that matches the passed error code. +// that matches the passed error code. func checkDbError(t *testing.T, testName string, gotErr error, wantErrCode database.ErrorCode) bool { dbErr, ok := gotErr.(database.Error) if !ok { @@ -142,7 +142,7 @@ func TestConvertErr(t *testing.T) { func TestCornerCases(t *testing.T) { t.Parallel() - // Create a file at the datapase path to force the open below to fail. + // Create a file at the database path to force the open below to fail. dbPath := filepath.Join(os.TempDir(), "ffldb-errors-v2") _ = os.RemoveAll(dbPath) fi, err := os.Create(dbPath) diff --git a/database/interface.go b/database/interface.go index dd93b476..20952cc0 100644 --- a/database/interface.go +++ b/database/interface.go @@ -449,7 +449,7 @@ type DB interface { // // NOTE: The transaction must be closed by calling Rollback or Commit on // it when it is no longer needed. Failure to do so can result in - // unclaimed memory and/or inablity to close the database due to locks + // unclaimed memory and/or inability to close the database due to locks // depending on the specific database implementation. Begin(writable bool) (Tx, error) diff --git a/database/internal/treap/README.md b/database/internal/treap/README.md index 03ea2d13..c0fef298 100644 --- a/database/internal/treap/README.md +++ b/database/internal/treap/README.md @@ -8,7 +8,7 @@ treap Package treap implements a treap data structure that is used to hold ordered key/value pairs using a combination of binary search tree and heap semantics. It is a self-organizing and randomized data structure that doesn't require -complex operations to to maintain balance. Search, insert, and delete +complex operations to maintain balance. Search, insert, and delete operations are all O(log n). Both mutable and immutable variants are provided. The mutable variant is typically faster since it is able to simply update the diff --git a/database/internal/treap/doc.go b/database/internal/treap/doc.go index 39a65067..a909db9a 100644 --- a/database/internal/treap/doc.go +++ b/database/internal/treap/doc.go @@ -7,7 +7,7 @@ Package treap implements a treap data structure that is used to hold ordered key/value pairs using a combination of binary search tree and heap semantics. It is a self-organizing and randomized data structure that doesn't require -complex operations to to maintain balance. Search, insert, and delete +complex operations to maintain balance. Search, insert, and delete operations are all O(log n). Both mutable and immutable variants are provided. The mutable variant is typically faster since it is able to simply update the diff --git a/database/internal/treap/immutable.go b/database/internal/treap/immutable.go index 22d7da66..da39e0bc 100644 --- a/database/internal/treap/immutable.go +++ b/database/internal/treap/immutable.go @@ -41,7 +41,7 @@ type Immutable struct { root *treapNode count int - // totalSize is the best estimate of the total size of of all data in + // totalSize is the best estimate of the total size of all data in // the treap including the keys, values, and node sizes. totalSize uint64 } diff --git a/database/internal/treap/immutable_test.go b/database/internal/treap/immutable_test.go index 66bbd3df..5ba96ce1 100644 --- a/database/internal/treap/immutable_test.go +++ b/database/internal/treap/immutable_test.go @@ -345,7 +345,7 @@ func TestImmutableDuplicatePut(t *testing.T) { testTreap = testTreap.Put(key, key) expectedSize += nodeFieldsSize + uint64(len(key)+len(key)) - // Put a duplicate key with the the expected final value. + // Put a duplicate key with the expected final value. testTreap = testTreap.Put(key, expectedVal) // Ensure the key still exists and is the new value. diff --git a/database/internal/treap/mutable.go b/database/internal/treap/mutable.go index 90d866f7..ed143694 100644 --- a/database/internal/treap/mutable.go +++ b/database/internal/treap/mutable.go @@ -19,7 +19,7 @@ type Mutable struct { root *treapNode count int - // totalSize is the best estimate of the total size of of all data in + // totalSize is the best estimate of the total size of all data in // the treap including the keys, values, and node sizes. totalSize uint64 } diff --git a/dcrec/edwards/primitives.go b/dcrec/edwards/primitives.go index a7043ca5..3172a1a3 100644 --- a/dcrec/edwards/primitives.go +++ b/dcrec/edwards/primitives.go @@ -19,7 +19,7 @@ import ( // negative or not. Remember, in affine EC space, the negative // is P - positiveX. The rest of the 255 bits then represent // the Y-value in little endian. -// 2) For high effiency, 40 byte field elements (10x int32s) are +// 2) For high efficiency, 40 byte field elements (10x int32s) are // often used to represent integers. // 3) For further increases in efficiency, the affine (cartesian) // coordinates are converted into projective (extended or non- diff --git a/dcrec/edwards/primitives_test.go b/dcrec/edwards/primitives_test.go index 5fd69969..55adcd13 100644 --- a/dcrec/edwards/primitives_test.go +++ b/dcrec/edwards/primitives_test.go @@ -185,7 +185,7 @@ func TestConversion(t *testing.T) { t.Fatalf("expected %v, got %v", true, cmp) } - // Asert our results. + // Assert our results. encodedNumStr := encodedNumToStrSet[encodedNumToStrIdx] cmp = encodedNumStr == big.String() if !cmp { diff --git a/dcrec/edwards/privkey.go b/dcrec/edwards/privkey.go index 872860e6..0ca67909 100644 --- a/dcrec/edwards/privkey.go +++ b/dcrec/edwards/privkey.go @@ -23,7 +23,7 @@ const ( ) // PrivateKey wraps an ecdsa.PrivateKey as a convenience mainly for signing -// things with the the private key without having to directly import the ecdsa +// things with the private key without having to directly import the ecdsa // package. type PrivateKey struct { ecPk *ecdsa.PrivateKey diff --git a/dcrec/secp256k1/field.go b/dcrec/secp256k1/field.go index 79ada990..4d139a69 100644 --- a/dcrec/secp256k1/field.go +++ b/dcrec/secp256k1/field.go @@ -29,7 +29,7 @@ package secp256k1 // arithmetic between each array element which would lead to expensive carry // propagation. // -// Given the above, this implementation represents the the field elements as +// Given the above, this implementation represents the field elements as // 10 uint32s with each word (array entry) treated as base 2^26. This was // chosen for the following reasons: // 1) Most systems at the current time are 64-bit (or at least have 64-bit @@ -37,7 +37,7 @@ package secp256k1 // intermediate results can typically be done using a native register (and // using uint64s to avoid the need for additional half-word arithmetic) // 2) In order to allow addition of the internal words without having to -// propagate the the carry, the max normalized value for each register must +// propagate the carry, the max normalized value for each register must // be less than the number of bits available in the register // 3) Since we're dealing with 32-bit values, 64-bits of overflow is a // reasonable choice for #2 @@ -478,8 +478,8 @@ func (f *fieldVal) NegateVal(val *fieldVal, magnitude uint32) *fieldVal { // already larger than the modulus and congruent to 7 (mod 12). When a // value is already in the desired range, its magnitude is 1. Since 19 // is an additional "step", its magnitude (mod 12) is 2. Since any - // multiple of the modulus is conguent to zero (mod m), the answer can - // be shortcut by simply mulplying the magnitude by the modulus and + // multiple of the modulus is congruent to zero (mod m), the answer can + // be shortcut by simply multiplying the magnitude by the modulus and // subtracting. Keeping with the example, this would be (2*12)-19 = 5. f.n[0] = (magnitude+1)*fieldPrimeWordZero - val.n[0] f.n[1] = (magnitude+1)*fieldPrimeWordOne - val.n[1] @@ -891,7 +891,7 @@ func (f *fieldVal) Square() *fieldVal { // SquareVal squares the passed value and stores the result in f. Note that // this function can overflow if multiplying any of the individual words // exceeds a max uint32. In practice, this means the magnitude of the field -// being squred must be a max of 8 to prevent overflow. +// being squared must be a max of 8 to prevent overflow. // // The field value is returned to support chaining. This enables syntax like: // f3.SquareVal(f).Mul(f) so that f3 = f^2 * f = f^3. @@ -1117,14 +1117,14 @@ func (f *fieldVal) SquareVal(val *fieldVal) *fieldVal { // f.Inverse().Mul(f2) so that f = f^-1 * f2. func (f *fieldVal) Inverse() *fieldVal { // Fermat's little theorem states that for a nonzero number a and prime - // prime p, a^(p-1) = 1 (mod p). Since the multipliciative inverse is + // prime p, a^(p-1) = 1 (mod p). Since the multiplicative inverse is // a*b = 1 (mod p), it follows that b = a*a^(p-2) = a^(p-1) = 1 (mod p). // Thus, a^(p-2) is the multiplicative inverse. // // In order to efficiently compute a^(p-2), p-2 needs to be split into - // a sequence of squares and multipications that minimizes the number of - // multiplications needed (since they are more costly than squarings). - // Intermediate results are saved and reused as well. + // a sequence of squares and multiplications that minimizes the number + // of multiplications needed (since they are more costly than + // squarings). Intermediate results are saved and reused as well. // // The secp256k1 prime - 2 is 2^256 - 4294968275. // diff --git a/dcrec/secp256k1/privkey.go b/dcrec/secp256k1/privkey.go index bded20d4..7725385b 100644 --- a/dcrec/secp256k1/privkey.go +++ b/dcrec/secp256k1/privkey.go @@ -13,7 +13,7 @@ import ( ) // PrivateKey wraps an ecdsa.PrivateKey as a convenience mainly for signing -// things with the the private key without having to directly import the ecdsa +// things with the private key without having to directly import the ecdsa // package. type PrivateKey ecdsa.PrivateKey diff --git a/dcrec/secp256k1/schnorr/error.go b/dcrec/secp256k1/schnorr/error.go index 7ee3aaec..5c2adb00 100644 --- a/dcrec/secp256k1/schnorr/error.go +++ b/dcrec/secp256k1/schnorr/error.go @@ -55,7 +55,7 @@ const ( // unusable. ErrBadNonce - // ErrZeroSigS indates a zero signature S value, which is invalid. + // ErrZeroSigS indicates a zero signature S value, which is invalid. ErrZeroSigS // ErrNonmatchingR indicates that all signatures to be combined in a diff --git a/dcrec/secp256k1/signature.go b/dcrec/secp256k1/signature.go index e943f9d0..00657f99 100644 --- a/dcrec/secp256k1/signature.go +++ b/dcrec/secp256k1/signature.go @@ -347,12 +347,12 @@ func recoverKeyFromSignature(sig *Signature, msg []byte, } // SignCompact produces a compact signature of the data in hash with the given -// private key on the given koblitz curve. The isCompressed parameter should +// private key on the given koblitz curve. The isCompressed parameter should // be used to detail if the given signature should reference a compressed // public key or not. If successful the bytes of the compact signature will be // returned in the format: // <(byte of 27+public key solution)+4 if compressed >< padded bytes for signature R> -// where the R and S parameters are padde up to the bitlengh of the curve. +// where the R and S parameters are padded up to the bitlengh of the curve. func SignCompact(key *PrivateKey, hash []byte, isCompressedKey bool) ([]byte, error) { sig, err := key.Sign(hash) diff --git a/dcrjson/cmdparse.go b/dcrjson/cmdparse.go index 19c9320e..ba069a49 100644 --- a/dcrjson/cmdparse.go +++ b/dcrjson/cmdparse.go @@ -489,7 +489,7 @@ func assignField(paramNum int, fieldName string, dest reflect.Value, src reflect // by this package are already registered by default. // // The arguments are most efficient when they are the exact same type as the -// underlying field in the command struct associated with the the method, +// underlying field in the command struct associated with the method, // however this function also will perform a variety of conversions to make it // more flexible. This allows, for example, command line args which are strings // to be passed unaltered. In particular, the following conversions are diff --git a/dcrjson/doc.go b/dcrjson/doc.go index 01630fc5..0ca8269e 100644 --- a/dcrjson/doc.go +++ b/dcrjson/doc.go @@ -9,7 +9,7 @@ Package dcrjson provides infrastructure for working with Decred JSON-RPC APIs. Overview When communicating via the JSON-RPC protocol, all requests and responses must be -marshalled to and from the the wire in the appropriate format. This package +marshalled to and from the wire in the appropriate format. This package provides infrastructure and primitives to ease this process. JSON-RPC Protocol Overview diff --git a/dcrjson/error.go b/dcrjson/error.go index 120855b1..9ca46225 100644 --- a/dcrjson/error.go +++ b/dcrjson/error.go @@ -31,7 +31,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 @@ -59,7 +59,7 @@ const ( // help is missing. ErrMissingDescription - // ErrNumParams inidcates the number of params supplied do not + // ErrNumParams indicates the number of params supplied do not // match the requirements of the associated command. ErrNumParams diff --git a/dcrjson/help_test.go b/dcrjson/help_test.go index 7981e64c..7773e618 100644 --- a/dcrjson/help_test.go +++ b/dcrjson/help_test.go @@ -713,8 +713,8 @@ func TestGenerateHelpErrors(t *testing.T) { } // TestGenerateHelp performs a very basic test to ensure GenerateHelp is working -// as expected. The internal are testd much more thoroughly in other tests, so -// there is no need to add more tests here. +// as expected. The internals are tested much more thoroughly in other tests, +// so there is no need to add more tests here. func TestGenerateHelp(t *testing.T) { t.Parallel() diff --git a/dcrjson/register.go b/dcrjson/register.go index ab2e0157..04204cd3 100644 --- a/dcrjson/register.go +++ b/dcrjson/register.go @@ -25,7 +25,7 @@ const ( // UFWebsocketOnly indicates that the command can only be used when // communicating with an RPC server over websockets. This typically // applies to notifications and notification registration functions - // since neiher makes since when using a single-shot HTTP-POST request. + // since neither makes sense when using a single-shot HTTP-POST request. UFWebsocketOnly // UFNotification indicates that the command is actually a notification. @@ -245,7 +245,7 @@ func Register(method interface{}, params interface{}, flags UsageFlag) error { } } - // Ensure the default value can be unsmarshalled into the type + // Ensure the default value can be unmarshalled into the type // and that defaults are only specified for optional fields. if tag := rtf.Tag.Get("jsonrpcdefault"); tag != "" { if !isOptional { diff --git a/dcrutil/wif.go b/dcrutil/wif.go index 52a62a76..1dcba1bf 100644 --- a/dcrutil/wif.go +++ b/dcrutil/wif.go @@ -36,7 +36,7 @@ func (e ErrWrongWIFNetwork) Error() string { // WIF contains the individual components described by the Wallet Import Format // (WIF). A WIF string is typically used to represent a private key and its -// associated address in a way that may be easily copied and imported into or +// associated address in a way that may be easily copied and imported into or // exported from wallet software. WIF strings may be decoded into this // structure by calling DecodeWIF or created with a user-provided private key // by calling NewWIF. diff --git a/doc.go b/doc.go index 7ca1eef1..72a2d161 100644 --- a/doc.go +++ b/doc.go @@ -108,7 +108,7 @@ Application Options: addresses to use for generated blocks -- At least one address is required if the generate option is set - --blockminsize= Mininum block size in bytes to be used when creating + --blockminsize= Minimum block size in bytes to be used when creating a block --blockmaxsize= Maximum block size in bytes to be used when creating a block (375000) diff --git a/docs/code_contribution_guidelines.md b/docs/code_contribution_guidelines.md index 217093d8..aa0279b2 100644 --- a/docs/code_contribution_guidelines.md +++ b/docs/code_contribution_guidelines.md @@ -259,7 +259,7 @@ Here is how the right prefix for a commit is chosen. Here are some of the reasons why wrapping your commit messages to 72 columns is a good thing. -- git log doesn’t do any special special wrapping of the commit messages. With +- git log doesn’t do any special wrapping of the commit messages. With the default pager of less -S, this means your paragraphs flow far off the edge of the screen, making them difficult to read. On an 80 column terminal, if we subtract 4 columns for the indent on the left and 4 more for symmetry on the diff --git a/fees/estimator.go b/fees/estimator.go index 4463e4b6..5c362c63 100644 --- a/fees/estimator.go +++ b/fees/estimator.go @@ -641,7 +641,7 @@ func (stats *Estimator) removeFromMemPool(blocksInMemPool int32, rate feeRate) { // all higher fee buckets have >= successPct transactions confirmed in at most // `targetConfs` confirmations. // Note that sometimes the requested combination of targetConfs and successPct is -// not achieveable (hypothetical example: 99% of txs confirmed within 1 block) +// not achievable (hypothetical example: 99% of txs confirmed within 1 block) // or there are not enough recorded statistics to derive a successful estimate // (eg: confirmation tracking has only started or there was a period of very few // transactions). In those situations, the appropriate error is returned. diff --git a/ipc.go b/ipc.go index 7098a5a2..f495c3dc 100644 --- a/ipc.go +++ b/ipc.go @@ -29,7 +29,7 @@ var outgoingPipeMessages = make(chan pipeMessage) // serviceControlPipeRx reads from the file descriptor fd of a read end pipe. // This is intended to be used as a simple control mechanism for parent -// processes to communicate with and and manage the lifetime of a dcrd child +// processes to communicate with and manage the lifetime of a dcrd child // process using a unidirectional pipe (on Windows, this is an anonymous pipe, // not a named pipe). // diff --git a/log.go b/log.go index e9f362f5..f3f506a5 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/lru/README.md b/lru/README.md index a5b5681b..676c0455 100644 --- a/lru/README.md +++ b/lru/README.md @@ -12,15 +12,15 @@ Package lru implements a generic least-recently-used cache with near O(1) perf. A least-recently-used (LRU) cache is a cache that holds a limited number of items with an eviction policy such that when the capacity of the cache is exceeded, the least-recently-used item is automatically removed when inserting a -new item. The meaining of used in this implementation is either accessing the +new item. The meaning of used in this implementation is either accessing the item via a lookup or adding the item into the cache, including when the item already exists. ## External Use This package has intentionally been designed so it can be used as a standalone -package for any projects needing to make use of a well-test and conccurrent safe -least-recently-used cache with near O(1) performance characteristics for +package for any projects needing to make use of a well-tested and concurrent +safe least-recently-used cache with near O(1) performance characteristics for lookups, inserts, and deletions. ## Installation and Updating diff --git a/lru/cache.go b/lru/cache.go index e8863864..92692690 100644 --- a/lru/cache.go +++ b/lru/cache.go @@ -58,7 +58,7 @@ func (m *Cache) Add(item interface{}) { return } - // Evict the least recently used entry (back of the list) if the the new + // Evict the least recently used entry (back of the list) if the new // entry would exceed the size limit for the cache. Also reuse the list // node so a new one doesn't have to be allocated. if uint(len(m.cache))+1 > m.limit { diff --git a/lru/cache_test.go b/lru/cache_test.go index c350e81a..6f56cd7b 100644 --- a/lru/cache_test.go +++ b/lru/cache_test.go @@ -34,7 +34,7 @@ func TestCache(t *testing.T) { testLoop: for i, test := range tests { // Create a new lru cache limited by the specified test limit and add - // all of the test vectors. This will cause evicition since there are + // all of the test vectors. This will cause eviction since there are // more test items than the limits. cache := NewCache(uint(test.limit)) for j := 0; j < numNonces; j++ { diff --git a/lru/doc.go b/lru/doc.go index 0c8f37c8..a24307a8 100644 --- a/lru/doc.go +++ b/lru/doc.go @@ -10,7 +10,7 @@ LRU Cache A least-recently-used (LRU) cache is a cache that holds a limited number of items with an eviction policy such that when the capacity of the cache is exceeded, the least-recently-used item is automatically removed when inserting a -new item. The meaining of used in this implementation is either accessing the +new item. The meaning of used in this implementation is either accessing the item via a lookup or adding the item into the cache, including when the item already exists. diff --git a/mempool/mempool.go b/mempool/mempool.go index e7b59670..e3044517 100644 --- a/mempool/mempool.go +++ b/mempool/mempool.go @@ -1209,7 +1209,7 @@ func (mp *TxPool) maybeAcceptTransaction(tx *dcrutil.Tx, isNew, rateLimit, allow // calculated below on its own would encourage several small // transactions to avoid fees rather than one single larger transaction // which is more desirable. Therefore, as long as the size of the - // transaction does not exceeed 1000 less than the reserved space for + // transaction does not exceed 1000 less than the reserved space for // high-priority transactions, don't require a fee for it. // This applies to non-stake transactions only. serializedSize := int64(msgTx.SerializeSize()) diff --git a/mempool/mempool_test.go b/mempool/mempool_test.go index fd0480e7..b1f87021 100644 --- a/mempool/mempool_test.go +++ b/mempool/mempool_test.go @@ -263,7 +263,7 @@ func (s *fakeChain) SetStandardVerifyFlags(flags txscript.ScriptFlags) { } // FakeUxtoMedianTime returns the median time associated with the requested utxo -// from the cake chain instance. +// from the fake chain instance. func (s *fakeChain) FakeUxtoMedianTime(prevOut *wire.OutPoint) int64 { s.RLock() medianTime := s.utxoTimes[*prevOut] @@ -1273,7 +1273,7 @@ func TestExpirationPruning(t *testing.T) { } // TestBasicOrphanRemoval ensure that orphan removal works as expected when an -// orphan that doesn't exist is removed both when there is another orphan that +// orphan that doesn't exist is removed both when there is another orphan that // redeems it and when there is not. func TestBasicOrphanRemoval(t *testing.T) { t.Parallel() diff --git a/mining.go b/mining.go index 4c77f56b..f8e5ae4a 100644 --- a/mining.go +++ b/mining.go @@ -2139,7 +2139,7 @@ type BgBlkTmplGenerator struct { prng *rand.Rand // These fields are provided by the caller when the generator is created and - // are either indepedently safe for concurrent access or do not change after + // are either independently safe for concurrent access or do not change after // initialization. // // chain is the blockchain instance that is used to build the block and @@ -2472,9 +2472,9 @@ type regenHandlerState struct { // been received in order to give the minimum number of required votes // needed to build a block template on it an opportunity to propagate before // attempting to find any other variants that extend the same parent as the - // current tip with enough votes to force a reorganation. This ensures the + // current tip with enough votes to force a reorganization. This ensures the // first block that is seen is chosen to build templates on so long as it - // receives the mininum required votes in order to prevent PoW miners from + // receives the minimum required votes in order to prevent PoW miners from // being able to gain an advantage through vote withholding. It is disabled // if the minimum number of votes is received prior to the timeout. awaitingSideChainMinVotes map[chainhash.Hash]struct{} @@ -2699,7 +2699,7 @@ func (g *BgBlkTmplGenerator) handleBlockConnected(ctx context.Context, state *re // them an opportunity to propagate before attempting to find any other // variants that extend the same parent with enough votes to force a // reorganization. This ensures the first block that is seen is chosen to - // build templates on so long as it receives the mininum required votes in + // build templates on so long as it receives the minimum required votes in // order to prevent PoW miners from being able to gain an advantage through // vote withholding. // @@ -2776,7 +2776,7 @@ func (g *BgBlkTmplGenerator) handleBlockAccepted(ctx context.Context, state *reg // Ignore side chain blocks when the current tip already has enough votes // for a template to be built on it. This ensures the first block that is - // seen is chosen to build templates on so long as it receives the mininum + // seen is chosen to build templates on so long as it receives the minimum // required votes in order to prevent PoW miners from being able to gain an // advantage through vote withholding. if state.awaitingMinVotesHash == nil { @@ -2840,7 +2840,7 @@ func (g *BgBlkTmplGenerator) handleVote(ctx context.Context, state *regenHandler voteTx.Hash(), minVotesHash, numVotes) if numVotes >= g.minVotesRequired { // Ensure the next template generated builds on the tip and clear - // all vote tracking to lock the current current tip in now that it + // all vote tracking to lock the current tip in now that it // has the minimum required votes. state.stopRegenTimer() state.failedGenRetryTimeout = nil @@ -3078,7 +3078,7 @@ func (g *BgBlkTmplGenerator) tipSiblingsSortedByVotes(state *regenHandlerState) } // handleTrackSideChainsTimeout handles potentially reorganizing the chain to a -// side chain block with the most votes in the case the the minimum number of +// side chain block with the most votes in the case the minimum number of // votes needed to build a block template on the current tip have not been // received within a certain timeout. // @@ -3185,7 +3185,7 @@ func (g *BgBlkTmplGenerator) regenHandler(ctx context.Context) { // find any other variants that extend the same parent as the current // tip with enough votes to force a reorganization. This ensures the // first block that is seen is chosen to build templates on so long as - // it receives the mininum required votes in order to prevent PoW miners + // it receives the minimum required votes in order to prevent PoW miners // from being able to gain an advantage through vote withholding. It is // disabled if the minimum number of votes is received prior to the // timeout. @@ -3270,7 +3270,7 @@ func (g *BgBlkTmplGenerator) BlockDisconnected(block *dcrutil.Block) { } // VoteReceived informs the background block template generator that a new vote -// has been received. It is the caller's reponsibility to ensure this is only +// has been received. It is the caller's responsibility to ensure this is only // invoked with valid votes. // // This function is safe for concurrent access. diff --git a/mining/mining.go b/mining/mining.go index d6fdb7f4..7b64ed0d 100644 --- a/mining/mining.go +++ b/mining/mining.go @@ -31,7 +31,7 @@ type TxDesc struct { // Added is the time when the entry was added to the source pool. Added time.Time - // Height is the block height when the entry was added to the the source + // Height is the block height when the entry was added to the source // pool. Height int64 diff --git a/networkparams_test.go b/networkparams_test.go index 6ce92b6e..d22ec5ec 100644 --- a/networkparams_test.go +++ b/networkparams_test.go @@ -46,7 +46,7 @@ func checkPowLimitsAreConsistent(t *testing.T, params *chaincfg.Params) { // Header bits of each block define target difficulty of the subsequent block. // // The first few solved blocks of the network will inherit the genesis block -// bits value before the difficulty reajustment takes place. +// bits value before the difficulty readjustment takes place. // // Solved block shouldn't be rejected due to the PoW limit check. // diff --git a/peer/peer.go b/peer/peer.go index 6de52244..6a31deca 100644 --- a/peer/peer.go +++ b/peer/peer.go @@ -703,7 +703,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 p.Connected() { diff --git a/rpc/jsonrpc/types/chainsvrcmds_test.go b/rpc/jsonrpc/types/chainsvrcmds_test.go index 725f25b7..ca61911d 100644 --- a/rpc/jsonrpc/types/chainsvrcmds_test.go +++ b/rpc/jsonrpc/types/chainsvrcmds_test.go @@ -1252,7 +1252,7 @@ func TestChainSvrCmds(t *testing.T) { } // TestChainSvrCmdErrors ensures any errors that occur in the command during -// custom mashal and unmarshal are as expected. +// custom marshal and unmarshal are as expected. func TestChainSvrCmdErrors(t *testing.T) { t.Parallel() diff --git a/rpc/jsonrpc/types/chainsvrresults_test.go b/rpc/jsonrpc/types/chainsvrresults_test.go index 53ae522a..0ccc6911 100644 --- a/rpc/jsonrpc/types/chainsvrresults_test.go +++ b/rpc/jsonrpc/types/chainsvrresults_test.go @@ -11,7 +11,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() @@ -79,7 +79,7 @@ func TestChainSvrCustomResults(t *testing.T) { continue } if string(marshalled) != test.expected { - t.Errorf("Test #%d (%s) unexpected marhsalled data - "+ + t.Errorf("Test #%d (%s) unexpected marshalled data - "+ "got %s, want %s", i, test.name, marshalled, test.expected) continue diff --git a/rpc/jsonrpc/types/doc.go b/rpc/jsonrpc/types/doc.go index 42ece2cd..d3fd6801 100644 --- a/rpc/jsonrpc/types/doc.go +++ b/rpc/jsonrpc/types/doc.go @@ -9,7 +9,7 @@ JSON-RPC commands, return values, and notifications. Overview When communicating via the JSON-RPC protocol, all requests and responses must be -marshalled to and from the the wire in the appropriate format. This package +marshalled to and from the wire in the appropriate format. This package provides data structures and primitives that are registered with dcrjson to ease this process. An overview specific to this package is provided here, however it is also instructive to read the documentation for the dcrjson package @@ -18,7 +18,7 @@ is also instructive to read the documentation for the dcrjson package Marshalling and Unmarshalling The types in this package map to the required parts of the protocol as discussed -in the dcrjson documention +in the dcrjson documentation - Request Objects (type Request) - Commands (type Cmd) diff --git a/rpcclient/extensions.go b/rpcclient/extensions.go index 8e9b0049..2d227aa3 100644 --- a/rpcclient/extensions.go +++ b/rpcclient/extensions.go @@ -63,14 +63,14 @@ type FutureDebugLevelResult chan *response // Receive waits for the response promised by the future and returns the result // of setting the debug logging level to the passed level specification or the -// list of of the available subsystems for the special keyword 'show'. +// list of the available subsystems for the special keyword 'show'. func (r FutureDebugLevelResult) Receive() (string, error) { res, err := receiveFuture(r) if err != nil { return "", err } - // Unmashal the result as a string. + // Unmarshal the result as a string. var result string err = json.Unmarshal(res, &result) if err != nil { diff --git a/rpcclient/infrastructure.go b/rpcclient/infrastructure.go index a07d0ed7..3be6cb0a 100644 --- a/rpcclient/infrastructure.go +++ b/rpcclient/infrastructure.go @@ -122,7 +122,8 @@ 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 // wsConn is the underlying websocket connection when not in HTTP POST @@ -328,7 +329,7 @@ func futureError(err error) chan *response { // result checks whether the unmarshaled response contains a non-nil error, // returning an unmarshaled dcrjson.RPCError (or an unmarshaling 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. +// returned for further unmarshalling into specific result types. func (r rawResponse) result() (result []byte, err error) { if r.Error != nil { return nil, r.Error @@ -408,7 +409,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/net.go b/rpcclient/net.go index 3ff665a5..b24633f4 100644 --- a/rpcclient/net.go +++ b/rpcclient/net.go @@ -215,7 +215,7 @@ func (c *Client) Ping() error { // GetPeerInfoAsync RPC invocation (or an applicable error). type FutureGetPeerInfoResult chan *response -// Receive waits for the response promised by the future and returns data about +// Receive waits for the response promised by the future and returns data about // each connected network peer. func (r FutureGetPeerInfoResult) Receive() ([]chainjson.GetPeerInfoResult, error) { res, err := receiveFuture(r) diff --git a/rpcclient/notify.go b/rpcclient/notify.go index a08ae868..39bef2af 100644 --- a/rpcclient/notify.go +++ b/rpcclient/notify.go @@ -1200,7 +1200,7 @@ func (r FutureNotifyWinningTicketsResult) Receive() error { } // NotifyWinningTicketsAsync returns an instance of a type that can be used -// to get the result of the RPC at some future time by invoking the Receive +// to get the result of the RPC at some future time by invoking the Receive // function on the returned instance. // // See NotifyWinningTickets for the blocking version and more details. @@ -1250,7 +1250,7 @@ func (r FutureNotifySpentAndMissedTicketsResult) Receive() error { } // NotifySpentAndMissedTicketsAsync returns an instance of a type that can be used -// to get the result of the RPC at some future time by invoking the Receive +// to get the result of the RPC at some future time by invoking the Receive // function on the returned instance. // // See NotifySpentAndMissedTickets for the blocking version and more details. diff --git a/rpcclient/rawtransactions.go b/rpcclient/rawtransactions.go index 2448aeb0..d7279959 100644 --- a/rpcclient/rawtransactions.go +++ b/rpcclient/rawtransactions.go @@ -383,7 +383,7 @@ func (c *Client) CreateRawSSRtxAsync(inputs []chainjson.TransactionInput, fee dc return c.sendCmd(cmd) } -// CreateRawSSRtx returns a new SSR transactionm (revoking an sstx). +// CreateRawSSRtx returns a new SSR transaction (revoking an sstx). func (c *Client) CreateRawSSRtx(inputs []chainjson.TransactionInput, fee dcrutil.Amount) (*wire.MsgTx, error) { return c.CreateRawSSRtxAsync(inputs, fee).Receive() } diff --git a/rpcclient/wallet.go b/rpcclient/wallet.go index 46cc73cc..7ecffa9e 100644 --- a/rpcclient/wallet.go +++ b/rpcclient/wallet.go @@ -224,7 +224,7 @@ func (c *Client) ListUnspent() ([]walletjson.ListUnspentResult, error) { // ListUnspentMin returns all unspent transaction outputs known to a wallet, // using the specified number of minimum conformations and default number of -// maximum confiramtions (9999999) as a filter. +// maximum confirmations (9999999) as a filter. func (c *Client) ListUnspentMin(minConf int) ([]walletjson.ListUnspentResult, error) { return c.ListUnspentMinAsync(minConf).Receive() } @@ -617,7 +617,7 @@ func (r FutureSendManyResult) Receive() (*chainhash.Hash, error) { return nil, err } - // Unmashal result as a string. + // Unmarshal result as a string. var txHash string err = json.Unmarshal(res, &txHash) if err != nil { @@ -739,7 +739,7 @@ func (r FuturePurchaseTicketResult) Receive() ([]*chainhash.Hash, error) { return nil, err } - // Unmashal result as a string slice. + // Unmarshal result as a string slice. var txHashesStr []string err = json.Unmarshal(res, &txHashesStr) if err != nil { @@ -814,7 +814,7 @@ func (c *Client) PurchaseTicketAsync(fromAccount string, } // PurchaseTicket takes an account and a spending limit and calls the async -// puchasetickets command. +// purchasetickets command. func (c *Client) PurchaseTicket(fromAccount string, spendLimit dcrutil.Amount, minConf *int, ticketAddress dcrutil.Address, numTickets *int, poolAddress dcrutil.Address, poolFees *dcrutil.Amount, @@ -1138,7 +1138,7 @@ func (r FutureGetAddressesByAccountResult) Receive(net dcrutil.AddressParams) ([ return nil, err } - // Unmashal result as an array of string. + // Unmarshal result as an array of string. var addrStrings []string err = json.Unmarshal(res, &addrStrings) if err != nil { @@ -1313,7 +1313,7 @@ func (c *Client) KeyPoolRefillSize(newSize uint) error { // applicable error). type FutureListAccountsResult chan *response -// Receive waits for the response promised by the future and returns returns a +// Receive waits for the response promised by the future and returns a // map of account names and their associated balances. func (r FutureListAccountsResult) Receive() (map[string]dcrutil.Amount, error) { res, err := receiveFuture(r) @@ -1553,7 +1553,7 @@ func (c *Client) GetReceivedByAccountMinConf(account string, minConfirms int) (d // of a GetUnconfirmedBalanceAsync RPC invocation (or an applicable error). type FutureGetUnconfirmedBalanceResult chan *response -// Receive waits for the response promised by the future and returns returns the +// Receive waits for the response promised by the future and returns the // unconfirmed balance from the server for the specified account. func (r FutureGetUnconfirmedBalanceResult) Receive() (dcrutil.Amount, error) { res, err := receiveFuture(r) diff --git a/rpcserver.go b/rpcserver.go index 9e53efba..cff03855 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -391,7 +391,7 @@ func rpcRuleError(fmtStr string, args ...interface{}) *dcrjson.RPCError { } // rpcDuplicateTxError is a convenience function to convert a -// rejected duplicate tx error to an RPC error with the appropriate code set. +// rejected duplicate tx error to an RPC error with the appropriate code set. func rpcDuplicateTxError(fmtStr string, args ...interface{}) *dcrjson.RPCError { return dcrjson.NewRPCError(dcrjson.ErrRPCDuplicateTx, fmt.Sprintf(fmtStr, args...)) @@ -1314,7 +1314,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( scriptVersion, script, s.server.chainParams) addresses := make([]string, len(addrs)) @@ -1342,7 +1342,7 @@ func handleDecodeScript(s *rpcServer, cmd interface{}, closeChan <-chan struct{} return reply, nil } -// handleEstimateFee implenents the estimatefee command. +// handleEstimateFee implements the estimatefee command. // TODO this is a very basic implementation. It should be // modified to match the bitcoin-core one. func handleEstimateFee(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) { @@ -1935,7 +1935,7 @@ func handleGetBlock(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (i func handleGetBlockchainInfo(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) { best := s.chain.BestSnapshot() - // Fetch the current chain work using the the best block hash. + // Fetch the current chain work using the best block hash. chainWork, err := s.chain.ChainWork(&best.Hash) if err != nil { return nil, rpcInternalError(err.Error(), "Could not fetch chain work.") @@ -2522,7 +2522,7 @@ func (state *gbtWorkState) blockTemplateResult(bm *blockManager, useCoinbaseValu // depends on. This is necessary since the created block must // ensure proper ordering of the dependencies. A map is used // before creating the final array to prevent duplicate entries - // when mutiple inputs reference the same transaction. + // when multiple inputs reference the same transaction. dependsMap := make(map[int64]struct{}) for _, txIn := range stx.TxIn { if idx, ok := stxIndex[txIn.PreviousOutPoint.Hash]; ok { @@ -2572,7 +2572,7 @@ func (state *gbtWorkState) blockTemplateResult(bm *blockManager, useCoinbaseValu return nil, rpcInternalError(err.Error(), context) } - // Choose the correct maximum block size as defined by the network + // Choose the correct maximum block size as defined by the network // parameters and the current status of any hard fork votes to change // it when serialized. maxBlockSize, err := bm.chain.MaxBlockSize() @@ -2716,7 +2716,7 @@ func handleGetBlockTemplateLongPoll(s *rpcServer, longPollID string, useCoinbase // Fallthrough } - // Get the lastest block template + // Get the latest block template state.Lock() defer state.Unlock() @@ -3150,7 +3150,7 @@ func handleGetHeaders(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) // Until wire.MsgGetHeaders uses []Hash instead of the []*Hash, this // conversion is necessary. The wire protocol getheaders is (probably) // called much more often than this RPC, so chain.LocateHeaders is - // optimized for that and this is given the performance penality. + // optimized for that and this is given the performance penalty. locators := make(blockchain.BlockLocator, len(blockLocators)) for i := range blockLocators { locators[i] = &blockLocators[i] @@ -4214,8 +4214,8 @@ func handleGetWorkRequest(s *rpcServer) (interface{}, error) { // also in big endian, but it is treated as a uint256 and byte swapped // to little endian accordingly. // - // The fact the fields are reversed in this way is rather odd and likey - // an artifact of some legacy internal state in the reference + // The fact the fields are reversed in this way is rather odd and + // likely an artifact of some legacy internal state in the reference // implementation, but it is required for compatibility. target := bigToLEUint256(standalone.CompactToBig(msgBlock.Header.Bits)) reply := &types.GetWorkResult{ @@ -4547,7 +4547,7 @@ func fetchInputTxos(s *rpcServer, tx *wire.MsgTx) (map[wire.OutPoint]wire.TxOut, voteTx := stake.IsSSGen(tx) for txInIndex, txIn := range tx.TxIn { // vote tx have null input for vin[0], - // skip since it resolvces to an invalid transaction + // skip since it resolves to an invalid transaction if voteTx && txInIndex == 0 { continue } @@ -4908,8 +4908,8 @@ 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 - // is left nil. + // so the block header field in the retrieved transaction + // struct is left nil. mpTxns, mpSkipped := fetchMempoolTxnsForAddress(s, addr, uint32(numToSkip)-numSkipped, uint32(numRequested- len(addressTxns))) @@ -5446,7 +5446,7 @@ func handleTicketFeeInfo(s *rpcServer, cmd interface{}, closeChan <-chan struct{ // We need data on windows from before this. Start from // the last adjustment and move backwards through window - // lengths, calulating the fees data and appending it + // lengths, calculating the fees data and appending it // each time. if windows > 1 { // Go down to the last height requested, except @@ -6145,7 +6145,7 @@ func (s *rpcServer) jsonRPCRead(w http.ResponseWriter, r *http.Request, isAdmin // 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 { diff --git a/rpcserver_test.go b/rpcserver_test.go index 5224dba8..b87e3db1 100644 --- a/rpcserver_test.go +++ b/rpcserver_test.go @@ -81,7 +81,7 @@ func testGetBlockHash(r *rpctest.Harness, t *testing.T) { info, err := r.Node.GetInfo() if err != nil { - t.Fatalf("call to getinfo cailed: %v", err) + t.Fatalf("call to getinfo failed: %v", err) } blockHash, err := r.Node.GetBlockHash(int64(info.Blocks)) diff --git a/rpcserverhelp.go b/rpcserverhelp.go index 4a155a96..e6e7305d 100644 --- a/rpcserverhelp.go +++ b/rpcserverhelp.go @@ -226,7 +226,7 @@ var helpDescsEnUS = map[string]string{ "getbestblock--result0": "Get block height and hash of best block in the main chain.", // GetBestBlockHashCmd help. - "getbestblockhash--synopsis": "Returns the hash of the of the best (most recent) block in the longest block chain.", + "getbestblockhash--synopsis": "Returns the hash of the best (most recent) block in the longest block chain.", "getbestblockhash--result0": "The hex-encoded block hash", // GetBlockCmd help. @@ -526,7 +526,7 @@ var helpDescsEnUS = map[string]string{ "agenda-choices": "All choices in this agenda.", "choice-id": "Unique identifier of this choice.", "choice-description": "Description of this choice.", - "choice-bits": "Bits that dentify this choice.", + "choice-bits": "Bits that identify this choice.", "choice-isabstain": "This choice is to abstain from change.", "choice-isno": "Hard no choice (1 and only 1 per agenda).", "choice-count": "How many votes received.", diff --git a/rpctest/node.go b/rpctest/node.go index ade4e2d7..e91836ad 100644 --- a/rpctest/node.go +++ b/rpctest/node.go @@ -197,7 +197,7 @@ func (n *node) start() error { return pid.Close() } -// stop interrupts the running dcrd process process, and waits until it exits +// stop interrupts the running dcrd process, and waits until it exits // properly. On windows, interrupt is not supported, so a kill signal is used // instead func (n *node) stop() error { diff --git a/rpctest/rpc_harness.go b/rpctest/rpc_harness.go index 974e3975..6f3642cc 100644 --- a/rpctest/rpc_harness.go +++ b/rpctest/rpc_harness.go @@ -354,7 +354,7 @@ func (h *Harness) CreateTransaction(targetOutputs []*wire.TxOut, feeRate dcrutil } // UnlockOutputs unlocks any outputs which were previously marked as -// unspendabe due to being selected to fund a transaction via the +// unspendable due to being selected to fund a transaction via the // CreateTransaction method. // // This function is safe for concurrent access. diff --git a/rpctest/utils.go b/rpctest/utils.go index aae06509..1b1008f2 100644 --- a/rpctest/utils.go +++ b/rpctest/utils.go @@ -31,7 +31,7 @@ const ( // JoinNodes is a synchronization tool used to block until all passed nodes are // fully synced with respect to an attribute. This function will block for a // period of time, finally returning once all nodes are synced according to the -// passed JoinType. This function be used to to ensure all active test +// passed JoinType. This function be used to ensure all active test // harnesses are at a consistent state before proceeding to an assertion or // check within rpc tests. func JoinNodes(nodes []*Harness, joinType JoinType) error { diff --git a/rpctest/votingwallet.go b/rpctest/votingwallet.go index 92a3117e..5e0f67e0 100644 --- a/rpctest/votingwallet.go +++ b/rpctest/votingwallet.go @@ -51,7 +51,7 @@ var ( // commitAmountMultiplier is a multiplier for the minimum stake difficulty, // used to fund inputs used in purchasing tickets. This needs to be high // enough that (minimumStakeDifficulty*commitAmountMultiplier) - - // minimumStakeDifficulty is grater than the dust limit and will allow the + // minimumStakeDifficulty is greater than the dust limit and will allow the // ticket to be relayed on the network. commitAmountMultiplier = int64(4) ) diff --git a/rpcwebsocket.go b/rpcwebsocket.go index bca0c4d2..b3076083 100644 --- a/rpcwebsocket.go +++ b/rpcwebsocket.go @@ -296,7 +296,7 @@ func (m *wsNotificationManager) NotifyStakeDifficulty( // NotifyMempoolTx passes a transaction accepted by mempool to the // notification manager for transaction notification processing. If -// isNew is true, the tx is is a new transaction, rather than one +// isNew is true, the tx is a new transaction, rather than one // added to the mempool during a reorg. func (m *wsNotificationManager) NotifyMempoolTx(tx *dcrutil.Tx, isNew bool) { n := ¬ificationTxAcceptedByMempool{ @@ -1903,7 +1903,7 @@ func (c *wsClient) WaitForShutdown() { // has already been authenticated (via HTTP Basic access authentication). The // returned client is ready to start. Once started, the client will process // incoming and outgoing messages in separate goroutines complete with queuing -// and asynchrous handling for long-running operations. +// and asynchronous handling for long-running operations. func newWebsocketClient(server *rpcServer, conn *websocket.Conn, remoteAddr string, authenticated bool, isAdmin bool) (*wsClient, error) { diff --git a/run_tests.sh b/run_tests.sh index 14ed1c3c..4b55ea26 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -11,7 +11,7 @@ set -ex # 5. go vet (https://golang.org/cmd/vet) # 6. misspell (https://github.com/client9/misspell) -# golangci-lint (github.com/golangci/golangci-lint) is used to run each each +# golangci-lint (github.com/golangci/golangci-lint) is used to run each # static checker. REPO=dcrd diff --git a/sampleconfig/sampleconfig.go b/sampleconfig/sampleconfig.go index 4c6be571..5618ec2d 100644 --- a/sampleconfig/sampleconfig.go +++ b/sampleconfig/sampleconfig.go @@ -60,7 +60,7 @@ const FileContents = `[Application Options] ; Use Universal Plug and Play (UPnP) to automatically open the listen port ; and obtain the external IP address from supported devices. NOTE: This option -; will have no effect if exernal IP addresses are specified. +; will have no effect if external IP addresses are specified. ; upnp=1 ; Specify the external IP addresses your node is listening on. One address per diff --git a/server.go b/server.go index 22c5e9cc..454aa03e 100644 --- a/server.go +++ b/server.go @@ -444,7 +444,7 @@ func (sp *serverPeer) OnVersion(p *peer.Peer, msg *wire.MsgVersion) *wire.MsgRej addrManager.SetServices(remoteAddr, msg.Services) } - // Ignore peers that have a protcol version that is too old. The peer + // Ignore peers that have a protocol version that is too old. The peer // negotiation logic will disconnect it after this callback returns. if msg.ProtocolVersion < int32(wire.InitialProcotolVersion) { return nil @@ -612,9 +612,9 @@ func (sp *serverPeer) OnGetMiningState(p *peer.Peer, msg *wire.MsgGetMiningState return } - // Get the list of blocks of blocks that are eligible to built on and - // limit the list to the maximum number of allowed eligible block hashes - // per mining state message. There is nothing to send when there are no + // Get the list of blocks that are eligible to build on and limit the + // list to the maximum number of allowed eligible block hashes per + // mining state message. There is nothing to send when there are no // eligible blocks. blockHashes := SortParentsByVotes(mp, best.Hash, children, bm.cfg.ChainParams) @@ -1755,7 +1755,7 @@ func (s *server) handleQuery(state *peerState, querymsg interface{}) { } } -// disconnectPeer attempts to drop the connection of a tageted peer in the +// disconnectPeer attempts to drop the connection of a targeted peer in the // passed peer list. Targets are identified via usage of the passed // `compareFunc`, which should return `true` if the passed peer is the target // peer. This function returns true on success and false if the peer is unable @@ -1872,7 +1872,7 @@ func (s *server) peerDoneHandler(sp *serverPeer) { func (s *server) peerHandler() { // Start the address manager and block manager, both of which are needed // by peers. This is done here since their lifecycle is closely tied - // to this handler and rather than adding more channels to sychronize + // to this handler and rather than adding more channels to synchronize // things, it's easier and slightly faster to simply start and stop them // in this handler. s.addrManager.Start() @@ -2119,7 +2119,7 @@ func (s *server) NetTotals() (uint64, uint64) { atomic.LoadUint64(&s.bytesSent) } -// UpdatePeerHeights updates the heights of all peers who have have announced +// UpdatePeerHeights updates the heights of all peers who have announced // the latest connected main chain block, or a recognized orphan. These height // updates allow us to dynamically refresh peer heights, ensuring sync peer // selection has access to the latest block heights for each peer. @@ -2386,7 +2386,7 @@ out: for { select { case <-timer.C: - // TODO: pick external port more cleverly + // TODO: pick external port more cleverly // TODO: know which ports we are listening to on an external net. // TODO: if specific listen port doesn't work then ask for wildcard // listen port? diff --git a/txscript/data/script_tests.json b/txscript/data/script_tests.json index b4221ce7..83ec6e51 100644 --- a/txscript/data/script_tests.json +++ b/txscript/data/script_tests.json @@ -35,7 +35,7 @@ ["'12'", "12 EQUAL", "NONE", "ERR_EVAL_FALSE", "Single quoted numeric strings are pushed as data"], ["'abc'{3}", "'abcabcabc' EQUAL", "NONE", "OK", "Single quoted strings with brace suffix are repeated"], ["0x02aabb{2}", "DATA_2 0xaabb EQUALVERIFY DATA_2 0xaabb EQUAL", "NONE", "OK", "Raw bytes in hex notation with brace suffix are repeated"], -["{2}", "DATA_3 0xaabbcc EQUALVERIFY DATA_3 0xaabbcc EQUAL", "NONE", "OK", "Multiple tokens in angular brackets with with brace suffix are repeated"], +["{2}", "DATA_3 0xaabbcc EQUALVERIFY DATA_3 0xaabbcc EQUAL", "NONE", "OK", "Multiple tokens in angular brackets with brace suffix are repeated"], ["<'abc'{3}>{2}", "<'abcabcabc'>{2} EQUALVERIFY EQUAL", "NONE", "OK", "'abc'{3} results in a single push of 9 bytes while <'abcabcabc'>{2} is 2 pushes of 9 bytes each"], ["0x00", "SIZE 0 EQUAL", "NONE", "OK", "Basic OP_0 execution"], @@ -824,7 +824,7 @@ ["", "2SWAP 1", "NONE", "ERR_INVALID_STACK_OPERATION", "2SWAP requires four items on the stack, the stack has no items"], ["NOP", "2SWAP 1", "NONE", "ERR_INVALID_STACK_OPERATION", "2SWAP requires four items on the stack and NOP must not be treated as one"], ["1", "2 3 2SWAP 1", "NONE", "ERR_INVALID_STACK_OPERATION", "2SWAP requires four items on the stack, the stack has one item"], -["0 1", "2SWAP 1", "NONE", "ERR_INVALID_STACK_OPERATION", "2SWAP requires four items on the stack, the stack has has two items"], +["0 1", "2SWAP 1", "NONE", "ERR_INVALID_STACK_OPERATION", "2SWAP requires four items on the stack, the stack has two items"], ["1 1 1", "2SWAP", "NONE", "ERR_INVALID_STACK_OPERATION", "2SWAP requires four items on the stack, the stack has three items"], ["0 1 0 0", "2SWAP <2DROP>{2} 1", "CLEANSTACK", "OK"], ["DATA_8 0 1 0 0 2SWAP <2DROP>{2} 1", " HASH160 DATA_20 0xb3e4f3da89ffc239d6958d5a20a69852ae603f81 EQUAL", "CLEANSTACK", "OK", "2SWAP P2SH"], @@ -1877,7 +1877,7 @@ ["0 0 0x02 0x0000", "WITHIN DROP 1", "NONE", "ERR_MINIMAL_DATA"], ["RIPEMD160 test coverage"], -["NOP", "RIPEMD160", "NONE", "ERR_INVALID_STACK_OPERATION", "RIPEMD160 requires an an item on the stack and NOP must not be treated as one"], +["NOP", "RIPEMD160", "NONE", "ERR_INVALID_STACK_OPERATION", "RIPEMD160 requires an item on the stack and NOP must not be treated as one"], ["", "RIPEMD160", "NONE", "ERR_INVALID_STACK_OPERATION", "RIPEMD160 requires an item on the stack, stack has no items"], ["''", "RIPEMD160 0x14 0x9c1185a5c5e9fc54612808977ee8f548b2258d31 EQUAL", "NONE", "OK"], ["'a'", "RIPEMD160 0x14 0x0bdc9d2d256b3ee9daae347be6f4dc835a467ffe EQUAL", "NONE", "OK"], @@ -1930,7 +1930,7 @@ ["HASH256 test coverage"], ["NOP", "HASH256", "NONE", "ERR_INVALID_STACK_OPERATION", "HASH256 requires an item on the stack and NOP must not be treated as one"], -["", "HASH256", "NONE", "ERR_INVALID_STACK_OPERATION", "HASH256 requires an item on the stack , stack has no items"], +["", "HASH256", "NONE", "ERR_INVALID_STACK_OPERATION", "HASH256 requires an item on the stack, stack has no items"], ["''", "HASH256 0x20 0xd8ee5f957b78a961fb729098b4efb56440a14e05e3c55890f5edbc626380aaa6 EQUAL", "NONE", "OK"], ["'a'", "HASH256 0x20 0x8a298a038c1a85591aa7abda75a8a393b742ee3f6b759ff15a3b5a8edff78532 EQUAL", "NONE", "OK"], ["0", "HASH256", "NONE", "OK"], @@ -2367,7 +2367,7 @@ "0x47 0x304402205550606a87650619f98b261adde6d343aad0c3fdd526c68d5ed718819ee59a7e0220335af6a47a18064681a77f8387c95934439bdf74b61e290a3353528311b8c99301 0x23 0x210279be337ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798ac", "HASH160 0x14 0xe57d091fa806258280dc78a1d8544a47a5b16a19 EQUAL", "NONE", "ERR_EVAL_FALSE", - "P2SH execution must push false on mistmatched hash from corrupted compressed P2PK redeem script (redeem script invalidated via 5th byte ^= 0x55)" + "P2SH execution must push false on mismatched hash from corrupted compressed P2PK redeem script (redeem script invalidated via 5th byte ^= 0x55)" ], [ "0x48 0x3045022100f5353150d31a63f4a0d06d1f5a01ac65f7267a719e49f2a1ac584fd546bef074022030e09575e7a1541aa018876a4003cefe1b061a90556b5140c63e0ef84813524801 NOP", diff --git a/txscript/doc.go b/txscript/doc.go index 07d6387f..0cabb88d 100644 --- a/txscript/doc.go +++ b/txscript/doc.go @@ -22,7 +22,7 @@ to right and intentionally do not provide loops. The vast majority of Decred scripts at the time of this writing are of several standard forms which consist of a spender providing a public key and a signature which proves the spender owns the associated private key. This information -is used to prove the the spender is authorized to perform the transaction. +is used to prove the spender is authorized to perform the transaction. One benefit of using a scripting language is added flexibility in specifying what conditions must be met in order to spend decreds. diff --git a/txscript/engine.go b/txscript/engine.go index f1351373..ef604f40 100644 --- a/txscript/engine.go +++ b/txscript/engine.go @@ -254,7 +254,7 @@ func checkMinimalDataPush(op *opcode, data []byte) error { return nil } -// executeOpcode peforms execution on the passed opcode. It takes into account +// executeOpcode performs execution on the passed opcode. It takes into account // whether or not it is hidden by conditionals, but some rules still must be // tested in this case. func (vm *Engine) executeOpcode(op *opcode, data []byte) error { @@ -378,7 +378,7 @@ func (vm *Engine) DisasmScript(idx int) (string, error) { } // CheckErrorCondition returns nil if the running script has ended and was -// successful, leaving a a true boolean on the stack. An error otherwise, +// successful, leaving a true boolean on the stack. An error otherwise, // including if the script has not finished. func (vm *Engine) CheckErrorCondition(finalScript bool) error { // Check execution is actually done by ensuring the script index is after diff --git a/txscript/opcode.go b/txscript/opcode.go index ca21be23..557fd245 100644 --- a/txscript/opcode.go +++ b/txscript/opcode.go @@ -2432,7 +2432,7 @@ func opcodeCheckSig(op *opcode, data []byte, vm *Engine) error { return err } - // The signature actually needs needs to be longer than this, but at + // The signature actually needs to be longer than this, but at // least 1 byte is needed for the hash type below. The full length is // checked depending on the script flags and upon parsing the signature. if len(fullSigBytes) < 1 { @@ -2793,7 +2793,7 @@ func opcodeCheckSigAlt(op *opcode, data []byte, vm *Engine) error { } // Schnorr signatures are 65 bytes in length (64 bytes for [r,s] and - // 1 byte appened to the end for hashType). + // 1 byte appended to the end for hashType). switch sigType { case dcrec.STEd25519: if len(fullSigBytes) != 65 { diff --git a/txscript/reference_test.go b/txscript/reference_test.go index ec51fc38..77fd7453 100644 --- a/txscript/reference_test.go +++ b/txscript/reference_test.go @@ -77,7 +77,7 @@ func parseHex(tok string) ([]byte, error) { // parsing. It is declared here so it only needs to be created once. var shortFormOps map[string]byte -// parseShortForm parses a string as as used in the reference tests into the +// parseShortForm parses a string as used in the reference tests into the // script it came from. // // The format used for these tests is pretty simple if ad-hoc: @@ -504,7 +504,7 @@ func TestScripts(t *testing.T) { // test data to unsigned 32-bit integers. This is necessary because some of the // test data uses -1 as a shortcut to mean max uint32 and direct conversion of a // negative float to an unsigned int is implementation dependent and therefore -// doesn't result in the expected value on all platforms. This function woks +// doesn't result in the expected value on all platforms. This function works // around that limitation by converting to a 32-bit signed integer first and // then to a 32-bit unsigned integer which results in the expected behavior on // all platforms. diff --git a/txscript/script.go b/txscript/script.go index 950db9e7..3843554b 100644 --- a/txscript/script.go +++ b/txscript/script.go @@ -210,7 +210,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 @@ -306,7 +306,7 @@ func countSigOpsV0(script []byte, precise bool) int { // allowed pubkeys. This was inherited from bitcoin and is, // unfortunately, now part of the consensus rules. This could be // made more correct with a new script version, however, ideally all - // multisignaure operations in new script versions should move to + // multisignature operations in new script versions should move to // aggregated schemes such as Schnorr instead. if precise && prevOp >= OP_1 && prevOp <= OP_16 { numSigOps += asSmallInt(prevOp) diff --git a/txscript/scriptnum.go b/txscript/scriptnum.go index efde1baa..b34ef9d5 100644 --- a/txscript/scriptnum.go +++ b/txscript/scriptnum.go @@ -213,7 +213,7 @@ func (n scriptNum) Int32() int32 { // See the Bytes function documentation for example encodings. func makeScriptNum(v []byte, scriptNumLen int) (scriptNum, error) { // Interpreting data requires that it is not larger than - // the the passed scriptNumLen value. + // the passed scriptNumLen value. if len(v) > scriptNumLen { str := fmt.Sprintf("numeric value encoded as %x is %d bytes "+ "which exceeds the max allowed of %d", v, len(v), diff --git a/txscript/sighash.go b/txscript/sighash.go index 0e743ba0..1766270b 100644 --- a/txscript/sighash.go +++ b/txscript/sighash.go @@ -274,7 +274,7 @@ func calcSignatureHash(signScript []byte, hashType SigHashType, tx *wire.MsgTx, // set, commits to all inputs. // // With the relevant inputs and outputs selected and the aforementioned - // substitions, the prefix hash consists of the hash of the + // substitutions, the prefix hash consists of the hash of the // serialization of the following fields: // // 1) txversion|(SigHashSerializePrefix<<16) (as little-endian uint32) diff --git a/txscript/sign.go b/txscript/sign.go index 7cd0cb11..041deae4 100644 --- a/txscript/sign.go +++ b/txscript/sign.go @@ -160,9 +160,10 @@ func p2pkSignatureScriptAlt(tx *wire.MsgTx, idx int, subScript []byte, } // signMultiSig signs as many of the outputs in the provided multisig script as -// possible. It returns the generated script and a boolean if the script fulfils -// the contract (i.e. nrequired signatures are provided). Since it is arguably -// legal to not be able to sign any of the outputs, no error is returned. +// possible. It returns the generated script and a boolean if the script +// fulfills the contract (i.e. nrequired signatures are provided). Since it is +// arguably legal to not be able to sign any of the outputs, no error is +// returned. func signMultiSig(tx *wire.MsgTx, idx int, subScript []byte, hashType SigHashType, addresses []dcrutil.Address, nRequired int, kdb KeyDB) ([]byte, bool) { // No need to add dummy in Decred. @@ -539,7 +540,7 @@ func mergeScripts(chainParams dcrutil.AddressParams, tx *wire.MsgTx, idx int, return mergeMultiSig(tx, idx, addresses, nRequired, pkScript, sigScript, prevScript) - // It doesn't actually make sense to merge anything other than multiig + // It doesn't actually make sense to merge anything other than multisig // and scripthash (because it could contain multisig). Everything else // has either zero signature, can't be spent, or has a single signature // which is either present or not. The other two cases are handled diff --git a/txscript/stack_test.go b/txscript/stack_test.go index 1936619b..f94264d6 100644 --- a/txscript/stack_test.go +++ b/txscript/stack_test.go @@ -592,7 +592,7 @@ func TestStack(t *testing.T) { }, { "all tucked up", - nil, // too few arguments for tuck + nil, // too few arguments for tuck func(s *stack) error { return s.Tuck() }, diff --git a/txscript/standard.go b/txscript/standard.go index 5ba4cf45..78b920a7 100644 --- a/txscript/standard.go +++ b/txscript/standard.go @@ -283,7 +283,7 @@ func extractPubKeyAltDetails(script []byte) ([]byte, dcrec.SignatureType) { // OP_DATA_32 <32-byte pubkey> <1-byte ed25519 sigtype> OP_CHECKSIGALT // OP_DATA_33 <33-byte pubkey> <1-byte schnorr+secp sigtype> OP_CHECKSIGALT - // The script can't possibly be a a pay-to-alt-pubkey script if it doesn't + // The script can't possibly be a pay-to-alt-pubkey script if it doesn't // end with OP_CHECKSIGALT or have at least two small integer pushes // preceding it (although any reasonable pubkey will certainly be larger). // Fail fast to avoid more work below. @@ -403,7 +403,7 @@ func isNullDataScript(scriptVersion uint16, script []byte) bool { // Thus, it can either be a single OP_RETURN or an OP_RETURN followed by a // data push up to MaxDataCarrierSize bytes. - // The script can't possibly be a a null data script if it doesn't start + // The script can't possibly be a null data script if it doesn't start // with OP_RETURN. Fail fast to avoid more work below. if len(script) < 1 || script[0] != OP_RETURN { return false @@ -624,7 +624,7 @@ func expectedInputs(script []byte, class ScriptClass, subclass ScriptClass) int case MultiSigTy: // Standard multisig has a small number push for the number of sigs and - // number of keys. Check the first push instruction to to see how many + // number of keys. Check the first push instruction to see how many // arguments are expected. typeOfScript already checked this so we know // it'll be a small int. return asSmallInt(script[0]) @@ -1476,7 +1476,7 @@ func ExtractAtomicSwapDataPushes(version uint16, pkScript []byte) (*AtomicSwapDa } // At this point, the script appears to be an atomic swap, so populate and - // return the extacted data. + // return the extracted data. pushes := AtomicSwapDataPushes{ SecretSize: template[2].extractedInt, LockTime: template[11].extractedInt, diff --git a/txscript/standard_test.go b/txscript/standard_test.go index 5171af4a..aa9215a2 100644 --- a/txscript/standard_test.go +++ b/txscript/standard_test.go @@ -260,7 +260,7 @@ func TestExtractPkScriptAddrs(t *testing.T) { // works with standard PkScripts, this should not return any // addresses. { - name: "valid sigscript to reedeem p2pk - no addresses", + name: "valid sigscript to redeem p2pk - no addresses", script: hexToBytes("493046022100ddc69738bf2336318e4e0" + "41a5a77f305da87428ab1606f023260017854350ddc0" + "22100817af09d2eec36862d16009852b7e3a0f6dd765" + @@ -1293,7 +1293,7 @@ func TestExtractAtomicSwapDataPushes(t *testing.T) { continue } - // Ensure the invidual fields of the extracted data is accurate. The + // Ensure the individual fields of the extracted data is accurate. The // two structs could be directly compared, but testing them individually // allows nicer error reporting in the case of failure. if data.RecipientHash160 != test.data.RecipientHash160 { diff --git a/txscript/tokenizer_test.go b/txscript/tokenizer_test.go index 357428f8..6ded41d6 100644 --- a/txscript/tokenizer_test.go +++ b/txscript/tokenizer_test.go @@ -123,7 +123,7 @@ func TestScriptTokenizer(t *testing.T) { }) } - // Add various positive and negative tests for multi-opcode scripts. + // Add various positive and negative tests for multi-opcode scripts. tests = append(tests, []tokenizerTest{{ name: "pay-to-pubkey-hash", script: mustParseShortForm("DUP HASH160 DATA_20 0x01{20} EQUAL CHECKSIG"), diff --git a/wire/blockheader_test.go b/wire/blockheader_test.go index a2bbf96f..1fa898de 100644 --- a/wire/blockheader_test.go +++ b/wire/blockheader_test.go @@ -40,7 +40,7 @@ func TestBlockHeader(t *testing.T) { extraData := [32]byte{} bh := NewBlockHeader( - 1, // verision + 1, // version &hash, &merkleHash, &merkleHash, // stakeRoot diff --git a/wire/msgcftypes.go b/wire/msgcftypes.go index 02aee7dd..31a34156 100644 --- a/wire/msgcftypes.go +++ b/wire/msgcftypes.go @@ -48,7 +48,7 @@ func (msg *MsgCFTypes) BtcDecode(r io.Reader, pver uint32) error { } if count > MaxFilterTypesPerMsg { - str := fmt.Sprintf("too many filter types for for message "+ + str := fmt.Sprintf("too many filter types for message "+ "[count %v, max %v]", count, MaxFilterTypesPerMsg) return messageError("MsgCFTypes.BtcDecode", str) } diff --git a/wire/msgcftypes_test.go b/wire/msgcftypes_test.go index ccc5b8c9..01771e11 100644 --- a/wire/msgcftypes_test.go +++ b/wire/msgcftypes_test.go @@ -19,7 +19,7 @@ func TestCFTypes(t *testing.T) { // MsgCFTypes can use more than one filter, in here we are testing // a combination of more than one filter at wire level, whether - // these filters be compatible whit each other must be checked at + // these filters be compatible with each other must be checked at // higher level. filters := []FilterType{GCSFilterRegular, GCSFilterExtended} diff --git a/wire/msggetheaders.go b/wire/msggetheaders.go index 8822cf3a..0eb2b637 100644 --- a/wire/msggetheaders.go +++ b/wire/msggetheaders.go @@ -24,7 +24,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.go b/wire/msgtx.go index a136b74d..60321f21 100644 --- a/wire/msgtx.go +++ b/wire/msgtx.go @@ -118,8 +118,8 @@ const ( minTxPayload = 4 + 1 + 1 + 1 + 4 + 4 // freeListMaxScriptSize is the size of each buffer in the free list - // that is used for deserializing scripts from the wire before they are - // concatenated into a single contiguous buffers. This value was chosen + // that is used for deserializing scripts from the wire before they are + // concatenated into a single contiguous buffer. This value was chosen // because it is slightly more than twice the size of the vast majority // of all "standard" scripts. Larger scripts are still deserialized // properly as the free list will simply be bypassed for them. diff --git a/wire/msgtx_test.go b/wire/msgtx_test.go index db1b3545..8a6ed753 100644 --- a/wire/msgtx_test.go +++ b/wire/msgtx_test.go @@ -835,7 +835,7 @@ func TestTxSerializeSize(t *testing.T) { in *MsgTx // Tx to encode size int // Expected serialized size }{ - // No inputs or outpus. + // No inputs or outputs. {noTx, 15}, // Transaction with an input and an output.