From 8be96a87293a19f64dcbb933791531b151b01bd5 Mon Sep 17 00:00:00 2001 From: Aaron Campbell Date: Thu, 22 Aug 2019 10:23:36 -0300 Subject: [PATCH] multi: Correct typos. Correct typos found by reading code, ispell, and creative grepping. --- addrmgr/addrmanager.go | 2 +- bech32/bech32.go | 2 +- bech32/bech32_test.go | 2 +- blockchain/chain.go | 2 +- blockchain/chainio.go | 4 +-- blockchain/chainio_test.go | 2 +- blockchain/chainview.go | 2 +- blockchain/difficulty.go | 2 +- blockchain/error.go | 2 +- blockchain/indexers/addrindex_test.go | 2 +- blockchain/notifications.go | 2 +- blockchain/process.go | 2 +- blockchain/stake/error.go | 2 +- blockchain/stake/internal/ticketdb/error.go | 2 +- .../stake/internal/tickettreap/common.go | 2 +- .../internal/tickettreap/immutable_test.go | 2 +- blockchain/stake/staketx.go | 4 +-- blockchain/stake/tickets_test.go | 2 +- blockchain/thresholdstate.go | 2 +- blockchain/thresholdstate_test.go | 30 +++++++++---------- blockchain/validate.go | 6 ++-- blockchain/votebits_test.go | 2 +- blockmanager.go | 10 +++---- chaincfg/chainec/edwards.go | 2 +- chaincfg/chainec/secp256k1.go | 2 +- chaincfg/chainec/secschnorr.go | 2 +- cmd/addblock/config.go | 2 +- cmd/addblock/import.go | 2 +- cmd/dcrctl/config.go | 2 +- cmd/gencerts/gencerts.go | 2 +- config.go | 2 +- connmgr/dynamicbanscore.go | 2 +- database/ffldb/db.go | 4 +-- database/ffldb/whitebox_test.go | 2 +- database/internal/treap/common.go | 2 +- database/internal/treap/immutable_test.go | 2 +- database/internal/treap/mutable_test.go | 2 +- dcrec/edwards/ecdsa.go | 2 +- dcrec/edwards/signature.go | 2 +- dcrec/edwards/threshold.go | 2 +- dcrec/secp256k1/field.go | 4 +-- dcrec/secp256k1/field_test.go | 2 +- dcrec/secp256k1/schnorr/ecdsa_test.go | 12 ++++---- dcrec/secp256k1/schnorr/signature.go | 2 +- dcrec/secp256k1/schnorr/threshold.go | 4 +-- dcrec/secp256k1/signature.go | 6 ++-- dcrjson/cmdparse_test.go | 2 +- dcrjson/help.go | 6 ++-- dcrjson/jsonrpc.go | 4 +-- dcrutil/amount.go | 2 +- dcrutil/example_test.go | 4 +-- dcrutil/txsort/txsort.go | 2 +- dcrutil/txsort/txsort_test.go | 2 +- dcrutil/wif.go | 2 +- docs/json_rpc_api.mediawiki | 2 +- hdkeychain/example_test.go | 4 +-- log.go | 4 +-- lru/cache_test.go | 2 +- mempool/mempool_test.go | 24 +++++++-------- mining.go | 12 ++++---- mining/policy.go | 2 +- peer/example_test.go | 2 +- peer/peer.go | 6 ++-- rpc/jsonrpc/types/chainsvrcmds.go | 2 +- rpc/jsonrpc/types/chainsvrcmds_test.go | 2 +- rpc/jsonrpc/types/chainsvrwscmds_test.go | 2 +- rpc/jsonrpc/types/chainsvrwsntfns_test.go | 2 +- rpcclient/chain.go | 2 +- rpcclient/doc.go | 2 +- rpcclient/extensions.go | 12 ++++---- rpcclient/infrastructure.go | 4 +-- rpcclient/notify.go | 4 +-- rpcclient/wallet.go | 6 ++-- rpcserver.go | 12 ++++---- rpcserverhelp.go | 4 +-- rpcwebsocket.go | 4 +-- server.go | 6 ++-- service_windows.go | 2 +- txscript/engine_test.go | 2 +- txscript/error.go | 2 +- txscript/opcode.go | 2 +- txscript/script_test.go | 2 +- txscript/sigcache_test.go | 6 ++-- txscript/sign.go | 4 +-- txscript/standard.go | 6 ++-- txscript/standard_test.go | 2 +- upnp.go | 2 +- wire/bench_test.go | 2 +- wire/common.go | 2 +- wire/fixedIO_test.go | 4 +-- wire/msgaddr_test.go | 2 +- wire/msgblock_test.go | 4 +-- wire/msgcftypes_test.go | 2 +- wire/msgheaders_test.go | 4 +-- wire/msgtx.go | 2 +- wire/msgtx_test.go | 2 +- wire/msgversion.go | 2 +- wire/msgversion_test.go | 2 +- wire/protocol.go | 2 +- 99 files changed, 181 insertions(+), 181 deletions(-) diff --git a/addrmgr/addrmanager.go b/addrmgr/addrmanager.go index 989fa517..c443f282 100644 --- a/addrmgr/addrmanager.go +++ b/addrmgr/addrmanager.go @@ -1064,7 +1064,7 @@ const ( // addresses. Ipv6Weak - // Ipv4 represents an IPV4 connection state between two addreses. + // Ipv4 represents an IPV4 connection state between two addresses. Ipv4 // Ipv6Strong represents a connection state between two IPV6 addresses. diff --git a/bech32/bech32.go b/bech32/bech32.go index 2e03dc7e..5815e87b 100644 --- a/bech32/bech32.go +++ b/bech32/bech32.go @@ -18,7 +18,7 @@ const charset = "qpzry9x8gf2tvdw0s3jn54khce6mua7l" var gen = []int{0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3} // toBytes converts each character in the string 'chars' to the value of the -// index of the correspoding character in 'charset'. +// index of the corresponding character in 'charset'. func toBytes(chars string) ([]byte, error) { decoded := make([]byte, 0, len(chars)) for i := 0; i < len(chars); i++ { diff --git a/bech32/bech32_test.go b/bech32/bech32_test.go index e3a23735..f58cbb6c 100644 --- a/bech32/bech32_test.go +++ b/bech32/bech32_test.go @@ -76,7 +76,7 @@ func TestBech32(t *testing.T) { str, encoded) } - // Flip a bit in the string an make sure it is caught. + // Flip a bit in the string and make sure it is caught. pos := strings.LastIndexAny(str, "1") flipped := str[:pos+1] + string((str[pos+1] ^ 1)) + str[pos+2:] _, _, err = Decode(flipped) diff --git a/blockchain/chain.go b/blockchain/chain.go index 9de249f8..7d6a1bd5 100644 --- a/blockchain/chain.go +++ b/blockchain/chain.go @@ -1413,7 +1413,7 @@ func (b *BlockChain) connectBestChain(node *blockNode, block, parent *dcrutil.Bl // and flush the status changes to the database. It is safe to // ignore any errors when flushing here as the changes will be // flushed when a valid block is connected, and the worst case - // scenario if a block a invalid is it would need to be + // scenario if a block is invalid is it would need to be // revalidated after a restart. view := NewUtxoViewpoint() view.SetBestHash(parentHash) diff --git a/blockchain/chainio.go b/blockchain/chainio.go index 916941a1..0eecb7f9 100644 --- a/blockchain/chainio.go +++ b/blockchain/chainio.go @@ -652,7 +652,7 @@ func decodeSpentTxOut(serialized []byte, stxo *spentTxOut, amount int64, height // Since the serialization format is not self describing, as noted in the // format comments, this function also requires the transactions that spend the // txouts and a utxo view that contains any remaining existing utxos in the -// transactions referenced by the inputs to the passed transasctions. +// transactions referenced by the inputs to the passed transactions. func deserializeSpendJournalEntry(serialized []byte, txns []*wire.MsgTx) ([]spentTxOut, error) { // Calculate the total number of stxos. var numStxos int @@ -1659,7 +1659,7 @@ func (b *BlockChain) initChainState() error { // Determine how many blocks will be loaded into the index in order to // allocate the right amount as a single alloc versus a whole bunch of - // littles ones to reduce pressure on the GC. + // little ones to reduce pressure on the GC. blockIndexBucket := meta.Bucket(dbnamespace.BlockIndexBucketName) var blockCount int32 cursor := blockIndexBucket.Cursor() diff --git a/blockchain/chainio_test.go b/blockchain/chainio_test.go index a6559765..f215425b 100644 --- a/blockchain/chainio_test.go +++ b/blockchain/chainio_test.go @@ -81,7 +81,7 @@ func TestErrNotInMainChain(t *testing.T) { // Ensure the stringized output for the error is as expected. if err.Error() != errStr { - t.Fatalf("errNotInMainChain retuned unexpected error string - "+ + t.Fatalf("errNotInMainChain returned unexpected error string - "+ "got %q, want %q", err.Error(), errStr) } diff --git a/blockchain/chainview.go b/blockchain/chainview.go index ce730ba0..7e627b4c 100644 --- a/blockchain/chainview.go +++ b/blockchain/chainview.go @@ -259,7 +259,7 @@ func (c *chainView) next(node *blockNode) *blockNode { } // Next returns the successor to the provided node for the chain view. It will -// return nil if there is no successfor or the provided node is not part of the +// return nil if there is no successor or the provided node is not part of the // view. // // For example, assume a block chain with a side chain as depicted below: diff --git a/blockchain/difficulty.go b/blockchain/difficulty.go index 0d3b523d..2461fbdd 100644 --- a/blockchain/difficulty.go +++ b/blockchain/difficulty.go @@ -614,7 +614,7 @@ func calcNextStakeDiffV2(params *chaincfg.Params, nextHeight, curDiff, prevPoolS // Calculate the difficulty by multiplying the old stake difficulty // with two ratios that represent a force to counteract the relative // change in the pool size (Fc) and a restorative force to push the pool - // size towards the target value (Fr). + // size towards the target value (Fr). // // Per DCP0001, the generalized equation is: // diff --git a/blockchain/error.go b/blockchain/error.go index 5656eaad..c72a375c 100644 --- a/blockchain/error.go +++ b/blockchain/error.go @@ -615,7 +615,7 @@ func (e RuleError) Error() string { return e.Description } -// ruleError creates an RuleError given a set of arguments. +// ruleError creates a RuleError given a set of arguments. func ruleError(c ErrorCode, desc string) RuleError { return RuleError{ErrorCode: c, Description: desc} } diff --git a/blockchain/indexers/addrindex_test.go b/blockchain/indexers/addrindex_test.go index 3a190912..7a37dd8d 100644 --- a/blockchain/indexers/addrindex_test.go +++ b/blockchain/indexers/addrindex_test.go @@ -118,7 +118,7 @@ func (b *addrIndexBucket) sanityCheck(addrKey [addrKeySize]byte, expectedTotal i var totalEntries int maxEntries := level0MaxEntries for level := uint8(0); level <= highestLevel; level++ { - // Level 0 can'have more entries than the max allowed if the + // Level 0 can't have more entries than the max allowed if the // levels after it have data and it can't be empty. All other // levels must either be half full or full. data := b.levels[keyForLevel(addrKey, level)] diff --git a/blockchain/notifications.go b/blockchain/notifications.go index 4d258c04..6208ba30 100644 --- a/blockchain/notifications.go +++ b/blockchain/notifications.go @@ -29,7 +29,7 @@ const ( // It should be noted that the block might still ultimately fail to // become the new main chain tip if it contains invalid scripts, double // spends, etc. However, this is quite rare in practice because a lot - // of work was expended to create a block which satisifies the proof of + // of work was expended to create a block which satisfies the proof of // work requirement. // // Finally, this notification is only sent if the chain is believed diff --git a/blockchain/process.go b/blockchain/process.go index 4c74f9fe..d7c5aa42 100644 --- a/blockchain/process.go +++ b/blockchain/process.go @@ -102,7 +102,7 @@ func (b *BlockChain) processOrphans(hash *chainhash.Hash, flags BehaviorFlags) e // 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 -// also be zero as expected, because it, by definition, does not connect ot the +// also be zero as expected, because it, by definition, does not connect to the // best chain. // // This function is safe for concurrent access. diff --git a/blockchain/stake/error.go b/blockchain/stake/error.go index 28f26d18..2b6a904b 100644 --- a/blockchain/stake/error.go +++ b/blockchain/stake/error.go @@ -249,7 +249,7 @@ func (e RuleError) GetCode() ErrorCode { return e.ErrorCode } -// stakeRuleError creates an RuleError given a set of arguments. +// stakeRuleError creates a RuleError given a set of arguments. func stakeRuleError(c ErrorCode, desc string) RuleError { return RuleError{ErrorCode: c, Description: desc} } diff --git a/blockchain/stake/internal/ticketdb/error.go b/blockchain/stake/internal/ticketdb/error.go index 998529f6..eb3844b5 100644 --- a/blockchain/stake/internal/ticketdb/error.go +++ b/blockchain/stake/internal/ticketdb/error.go @@ -70,7 +70,7 @@ func (e ErrorCode) String() string { return fmt.Sprintf("Unknown ErrorCode (%d)", int(e)) } -// DBError identifies a an error in the stake database for tickets. +// DBError identifies an error in the stake database for tickets. // The caller can use type assertions to determine if a failure was // specifically due to a rule violation and access the ErrorCode field to // ascertain the specific reason for the rule violation. diff --git a/blockchain/stake/internal/tickettreap/common.go b/blockchain/stake/internal/tickettreap/common.go index 851e76fc..27988a9e 100644 --- a/blockchain/stake/internal/tickettreap/common.go +++ b/blockchain/stake/internal/tickettreap/common.go @@ -179,7 +179,7 @@ func (s *parentStack) Push(node *treapNode) { // This approach is used over append because reslicing the slice to pop // the item causes the compiler to make unneeded allocations. Also, // since the max number of items is related to the tree depth which - // requires expontentially more items to increase, only increase the cap + // requires exponentially more items to increase, only increase the cap // one item at a time. This is more intelligent than the generic append // expansion algorithm which often doubles the cap. index := s.index - staticDepth diff --git a/blockchain/stake/internal/tickettreap/immutable_test.go b/blockchain/stake/internal/tickettreap/immutable_test.go index 7bb0d245..c0cc2685 100644 --- a/blockchain/stake/internal/tickettreap/immutable_test.go +++ b/blockchain/stake/internal/tickettreap/immutable_test.go @@ -373,7 +373,7 @@ func TestImmutableReverseSequential(t *testing.T) { } // TestImmutableUnordered ensures that putting keys into an immutable treap in -// no paritcular order works as expected. +// no particular order works as expected. func TestImmutableUnordered(t *testing.T) { t.Parallel() diff --git a/blockchain/stake/staketx.go b/blockchain/stake/staketx.go index ec786cc3..43a96209 100644 --- a/blockchain/stake/staketx.go +++ b/blockchain/stake/staketx.go @@ -842,7 +842,7 @@ func CheckSSGen(tx *wire.MsgTx) error { } // IsSSGen returns whether or not a transaction is a stake submission generation -// transaction. There are also known as votes. +// transaction. These are also known as votes. func IsSSGen(tx *wire.MsgTx) bool { return CheckSSGen(tx) == nil } @@ -937,7 +937,7 @@ func CheckSSRtx(tx *wire.MsgTx) error { } // IsSSRtx returns whether or not a transaction is a stake submission revocation -// transaction. There are also known as revocations. +// transaction. These are also known as revocations. func IsSSRtx(tx *wire.MsgTx) bool { return CheckSSRtx(tx) == nil } diff --git a/blockchain/stake/tickets_test.go b/blockchain/stake/tickets_test.go index 8258d4d0..657df698 100644 --- a/blockchain/stake/tickets_test.go +++ b/blockchain/stake/tickets_test.go @@ -256,7 +256,7 @@ func TestTicketDBLongChain(t *testing.T) { filename := filepath.Join("testdata", "testexpiry.bz2") fi, err := os.Open(filename) if err != nil { - t.Fatalf("failed ot open test data: %v", err) + t.Fatalf("failed to open test data: %v", err) } bcStream := bzip2.NewReader(fi) defer fi.Close() diff --git a/blockchain/thresholdstate.go b/blockchain/thresholdstate.go index 0fc5d4d4..13c17955 100644 --- a/blockchain/thresholdstate.go +++ b/blockchain/thresholdstate.go @@ -531,7 +531,7 @@ func (b *BlockChain) StateLastChangedHeight(hash *chainhash.Hash, version uint32 return 0, HashError(hash.String()) } - // Fetch the treshold state cache for the provided deployment id as well as + // Fetch the threshold state cache for the provided deployment id as well as // the condition checker. var cache *thresholdStateCache var checker thresholdConditionChecker diff --git a/blockchain/thresholdstate_test.go b/blockchain/thresholdstate_test.go index 963777b7..5ab43c45 100644 --- a/blockchain/thresholdstate_test.go +++ b/blockchain/thresholdstate_test.go @@ -250,7 +250,7 @@ func TestThresholdState(t *testing.T) { // version 3. // // This will result in triggering enforcement of the stake version and - // that the stake version is 3. The treshold state for the test dummy + // that the stake version is 3. The threshold state for the test dummy // deployments must still be defined since a v4 majority proof-of-work // and proof-of-stake upgrade are required before moving to started. // --------------------------------------------------------------------- @@ -308,7 +308,7 @@ func TestThresholdState(t *testing.T) { // // This will result in achieving stake version 4 enforcement. // - // The treshold state for the dummy deployments must still be defined + // The threshold state for the dummy deployments must still be defined // since it can only change on a rule change boundary and it still // requires a v4 majority proof-of-work upgrade before moving to // started. @@ -338,7 +338,7 @@ func TestThresholdState(t *testing.T) { // the final two blocks to block version 4 so that majority version 4 // is not achieved, but the final block in the interval is version 4. // - // The treshold state for the dummy deployments must still be defined + // The threshold state for the dummy deployments must still be defined // since it still requires a v4 majority proof-of-work upgrade before // moving to started. // --------------------------------------------------------------------- @@ -375,7 +375,7 @@ func TestThresholdState(t *testing.T) { // achieved and this will achieve v4 majority proof-of-work upgrade, // voting can begin at the next rule change interval. // - // The treshold state for the dummy deployments must still be defined + // The threshold state for the dummy deployments must still be defined // since even though all required upgrade conditions are met, the state // change must not happen until the start of the next rule change // interval. @@ -405,7 +405,7 @@ func TestThresholdState(t *testing.T) { // vote bits to include yes votes for the first test dummy agenda and // no for the second test dummy agenda to ensure they aren't counted. // - // The treshold state for the dummy deployments must move to started. + // The threshold state for the dummy deployments must move to started. // Even though the majority of the votes have already been voting yes // for the first test dummy agenda, and no for the second one, they must // not count, otherwise it would move straight to lockedin or failed, @@ -437,7 +437,7 @@ func TestThresholdState(t *testing.T) { // vote bits to include yes votes for the first test dummy agenda and // no for the second test dummy agenda to ensure they aren't counted. // - // The treshold state for the dummy deployments must remain in started + // The threshold state for the dummy deployments must remain in started // because the votes are an old version and thus have a different // definition and don't apply to version 4. // --------------------------------------------------------------------- @@ -468,7 +468,7 @@ func TestThresholdState(t *testing.T) { // votes for the first test dummy agenda and a majority no for the // second test dummy agenda. // - // The treshold state for the dummy deployments must remain in started + // The threshold state for the dummy deployments must remain in started // because quorum was not reached. // --------------------------------------------------------------------- @@ -504,7 +504,7 @@ func TestThresholdState(t *testing.T) { // majority yes for the first test dummy agenda and a few votes shy of a // majority no for the second test dummy agenda. // - // The treshold state for the dummy deployments must remain in started + // The threshold state for the dummy deployments must remain in started // because even though quorum was reached, a required majority was not. // --------------------------------------------------------------------- @@ -547,7 +547,7 @@ func TestThresholdState(t *testing.T) { // vote bits to yes for the first test dummy agenda and no to the second // one. // - // The treshold state for the first dummy deployment must move to + // The threshold state for the first dummy deployment must move to // lockedin since a majority yes vote was achieved while the second // dummy deployment must move to failed since a majority no vote was // achieved. @@ -578,12 +578,12 @@ func TestThresholdState(t *testing.T) { // vote bits to include no votes for the first test dummy agenda and // yes votes for the second one. // - // The treshold state for the first dummy deployment must move to active - // since even though the interval had a majority no votes, lockedin - // status has already been achieved and can't be undone without a new - // agenda. Similarly, the second one must remain in failed even though - // the interval had a majority yes votes since a failed state can't be - // undone. + // The threshold state for the first dummy deployment must move to + // active since even though the interval had a majority no votes, + // lockedin status has already been achieved and can't be undone without + // a new agenda. Similarly, the second one must remain in failed even + // though the interval had a majority yes votes since a failed state + // can't be undone. // --------------------------------------------------------------------- blocksNeeded = stakeValidationHeight + ruleChangeInterval*8 - 1 - diff --git a/blockchain/validate.go b/blockchain/validate.go index e4993ff4..bdcb0356 100644 --- a/blockchain/validate.go +++ b/blockchain/validate.go @@ -1496,7 +1496,7 @@ func isStakeScriptHash(script []byte, stakeOpcode byte) bool { } // isAllowedTicketInputScriptForm returns whether or not the passed public key -// script is a one of the allowed forms for a ticket input. +// script is one of the allowed forms for a ticket input. func isAllowedTicketInputScriptForm(script []byte) bool { return isPubKeyHash(script) || isScriptHash(script) || isStakePubKeyHash(script, txscript.OP_SSGEN) || @@ -1726,7 +1726,7 @@ func checkTicketRedeemerCommitments(ticketHash *chainhash.Hash, ticketOuts []*st } contributionSumBig := big.NewInt(contributionSum) - // The outputs that satisify the commitments of the ticket start at offset + // The outputs that satisfy the commitments of the ticket start at offset // 2 for votes while they start at 0 for revocations. Also, the payments // must be tagged with the appropriate stake opcode depending on whether it // is a vote or a revocation. Finally, the fee limits in the original @@ -1908,7 +1908,7 @@ func checkVoteInputs(subsidyCache *standalone.SubsidyCache, tx *dcrutil.Tx, txHe ticketHash := &ticketIn.PreviousOutPoint.Hash ticketUtxo := view.LookupEntry(ticketHash) if ticketUtxo == nil || ticketUtxo.IsFullySpent() { - str := fmt.Sprintf("ticket output %v referenced by vote %s:%d either "+ + str := fmt.Sprintf("ticket output %v referenced by vote %s:%d either "+ "does not exist or has already been spent", ticketIn.PreviousOutPoint, voteHash, ticketInIdx) return ruleError(ErrMissingTxOut, str) diff --git a/blockchain/votebits_test.go b/blockchain/votebits_test.go index 02de34d8..b442ddf7 100644 --- a/blockchain/votebits_test.go +++ b/blockchain/votebits_test.go @@ -66,7 +66,7 @@ var ( }, { Id: "Vote against", - Description: "Vote against all multiple ", + Description: "Vote against all multiple", Bits: 0x20, // 0b0010 0000 IsAbstain: false, IsNo: true, diff --git a/blockmanager.go b/blockmanager.go index bd480358..8a5e098b 100644 --- a/blockmanager.go +++ b/blockmanager.go @@ -330,7 +330,7 @@ type blockManagerConfig struct { TxMemPool *mempool.TxPool BgBlkTmplGenerator *BgBlkTmplGenerator - // The following fields are blockManger callbacks. + // The following fields are blockManager callbacks. NotifyWinningTickets func(*WinningTicketsNtfnData) PruneRebroadcastInventory func() RpcServer func() *rpcServer @@ -468,7 +468,7 @@ func (b *blockManager) startSync(peers *list.List) { // Remove sync candidate peers that are no longer candidates due // to passing their latest known block. NOTE: The < is - // intentional as opposed to <=. While techcnically the peer + // intentional as opposed to <=. While technically the peer // doesn't have a later block when it's equal, it will likely // have one soon so it is a reasonable choice. It also allows // the case where both are at 0 such as during regression test. @@ -1065,7 +1065,7 @@ func (b *blockManager) handleBlockMsg(bmsg *blockMsg) { b.cfg.TxMemPool.PruneExpiredTx() // Update this peer's latest block height, for future - // potential sync node candidancy. + // potential sync node candidacy. heightUpdate = best.Height blkHashUpdate = &best.Hash @@ -1223,7 +1223,7 @@ func (b *blockManager) handleHeadersMsg(hmsg *headersMsg) { prevNodeEl := b.headerList.Back() if prevNodeEl == nil { bmgrLog.Warnf("Header list does not contain a previous" + - "element as expected -- disconnecting peer") + " element as expected -- disconnecting peer") hmsg.peer.Disconnect() return } @@ -1889,7 +1889,7 @@ func (b *blockManager) handleBlockchainNotification(notification *blockchain.Not // TODO: In the case the new tip disapproves the previous block, any // transactions the previous block contains in its regular tree which // double spend the same inputs as transactions in either tree of the - // current tip should ideally be tracked in the pool as eligibile for + // current tip should ideally be tracked in the pool as eligible for // inclusion in an alternative tip (side chain block) in case the // current tip block does not get enough votes. However, the // transaction pool currently does not provide any way to distinguish diff --git a/chaincfg/chainec/edwards.go b/chaincfg/chainec/edwards.go index 471d24a3..a944deac 100644 --- a/chaincfg/chainec/edwards.go +++ b/chaincfg/chainec/edwards.go @@ -153,7 +153,7 @@ func (e edwardsDSA) Decrypt(privkey []byte, in []byte) ([]byte, return e.decrypt(privkey, in) } -// newEdwardsDSA instatiates a function DSA subsystem over the edwards 25519 +// newEdwardsDSA instantiates a function DSA subsystem over the edwards 25519 // curve. A caveat for the functions below is that they're all routed through // interfaces, and nil returns from the library itself for interfaces must // ALWAYS be checked by checking the return value by attempted dereference diff --git a/chaincfg/chainec/secp256k1.go b/chaincfg/chainec/secp256k1.go index c30be767..9bbc8542 100644 --- a/chaincfg/chainec/secp256k1.go +++ b/chaincfg/chainec/secp256k1.go @@ -154,7 +154,7 @@ func (sp secp256k1DSA) Decrypt(privkey []byte, in []byte) ([]byte, return sp.decrypt(privkey, in) } -// newSecp256k1DSA instatiates a function DSA subsystem over the secp256k1 +// newSecp256k1DSA instantiates a function DSA subsystem over the secp256k1 // curve. A caveat for the functions below is that they're all routed through // interfaces, and nil returns from the library itself for interfaces must // ALWAYS be checked by checking the return value by attempted dereference diff --git a/chaincfg/chainec/secschnorr.go b/chaincfg/chainec/secschnorr.go index 1e73500a..e89c00fd 100644 --- a/chaincfg/chainec/secschnorr.go +++ b/chaincfg/chainec/secschnorr.go @@ -150,7 +150,7 @@ func (sp secSchnorrDSA) Decrypt(privkey []byte, in []byte) ([]byte, return sp.decrypt(privkey, in) } -// newSecSchnorrDSA instatiates a function DSA subsystem over the secp256k1 +// newSecSchnorrDSA instantiates a function DSA subsystem over the secp256k1 // curve. A caveat for the functions below is that they're all routed through // interfaces, and nil returns from the library itself for interfaces must // ALWAYS be checked by checking the return value by attempted dereference diff --git a/cmd/addblock/config.go b/cmd/addblock/config.go index d5f22961..42f51e9d 100644 --- a/cmd/addblock/config.go +++ b/cmd/addblock/config.go @@ -45,7 +45,7 @@ type config struct { Progress int `short:"p" long:"progress" description:"Show a progress message each time this number of seconds have passed -- Use 0 to disable progress announcements"` } -// filesExists reports whether the named file or directory exists. +// fileExists reports whether the named file or directory exists. func fileExists(name string) bool { if _, err := os.Stat(name); err != nil { if os.IsNotExist(err) { diff --git a/cmd/addblock/import.go b/cmd/addblock/import.go index d9f64071..72a110d4 100644 --- a/cmd/addblock/import.go +++ b/cmd/addblock/import.go @@ -139,7 +139,7 @@ func (bi *blockImporter) processBlock(serializedBlock []byte) (bool, error) { } isMainChain := !isOrphan && forkLen == 0 if !isMainChain { - return false, fmt.Errorf("import file contains an block that "+ + return false, fmt.Errorf("import file contains a block that "+ "does not extend the main chain: %v", blockHash) } if isOrphan { diff --git a/cmd/dcrctl/config.go b/cmd/dcrctl/config.go index e2e7744f..0693d57b 100644 --- a/cmd/dcrctl/config.go +++ b/cmd/dcrctl/config.go @@ -212,7 +212,7 @@ func cleanAndExpandPath(path string) string { return filepath.Join(homeDir, path) } -// filesExists reports whether the named file or directory exists. +// fileExists reports whether the named file or directory exists. func fileExists(name string) bool { if _, err := os.Stat(name); err != nil { if os.IsNotExist(err) { diff --git a/cmd/gencerts/gencerts.go b/cmd/gencerts/gencerts.go index 0e38bb4a..456f7b33 100644 --- a/cmd/gencerts/gencerts.go +++ b/cmd/gencerts/gencerts.go @@ -134,7 +134,7 @@ func cleanAndExpandPath(path string) string { return filepath.Join(homeDir, path) } -// filesExists reports whether the named file or directory exists. +// fileExists reports whether the named file or directory exists. func fileExists(name string) bool { if _, err := os.Stat(name); err != nil { if os.IsNotExist(err) { diff --git a/config.go b/config.go index 893e68cb..3e02a063 100644 --- a/config.go +++ b/config.go @@ -359,7 +359,7 @@ func normalizeAddresses(addrs []string, defaultPort string) []string { return removeDuplicateAddresses(addrs) } -// filesExists reports whether the named file or directory exists. +// fileExists reports whether the named file or directory exists. func fileExists(name string) bool { if _, err := os.Stat(name); err != nil { if os.IsNotExist(err) { diff --git a/connmgr/dynamicbanscore.go b/connmgr/dynamicbanscore.go index e5eb30ea..a7fe7b7d 100644 --- a/connmgr/dynamicbanscore.go +++ b/connmgr/dynamicbanscore.go @@ -14,7 +14,7 @@ import ( const ( // Halflife defines the time (in seconds) by which the transient part - // of the ban score decays to one half of it's original value. + // of the ban score decays to one half of its original value. Halflife = 60 // lambda is the decaying constant. diff --git a/database/ffldb/db.go b/database/ffldb/db.go index 36764935..15c4bef7 100644 --- a/database/ffldb/db.go +++ b/database/ffldb/db.go @@ -1086,7 +1086,7 @@ func (tx *transaction) fetchKey(key []byte) []byte { // NOTE: This function must only be called on a writable transaction. Since it // is an internal helper function, it does not check. func (tx *transaction) deleteKey(key []byte, notifyIterators bool) { - // Remove the key from the list of pendings keys to be written on + // Remove the key from the list of pending keys to be written on // transaction commit if needed. tx.pendingKeys.Delete(key) @@ -1999,7 +1999,7 @@ func (db *db) Close() error { return closeErr } -// filesExists reports whether the named file or directory exists. +// fileExists reports whether the named file or directory exists. func fileExists(name string) bool { if _, err := os.Stat(name); err != nil { if os.IsNotExist(err) { diff --git a/database/ffldb/whitebox_test.go b/database/ffldb/whitebox_test.go index 8aff99d7..ffbef482 100644 --- a/database/ffldb/whitebox_test.go +++ b/database/ffldb/whitebox_test.go @@ -195,7 +195,7 @@ func TestCornerCases(t *testing.T) { ldb := idb.(*db).cache.ldb ldb.Close() - // Ensure initilization errors in the underlying database work as + // Ensure initialization errors in the underlying database work as // expected. testName = "initDB: reinitialization" wantErrCode = database.ErrDbNotOpen diff --git a/database/internal/treap/common.go b/database/internal/treap/common.go index f131f07b..42fc2ae9 100644 --- a/database/internal/treap/common.go +++ b/database/internal/treap/common.go @@ -119,7 +119,7 @@ func (s *parentStack) Push(node *treapNode) { // This approach is used over append because reslicing the slice to pop // the item causes the compiler to make unneeded allocations. Also, // since the max number of items is related to the tree depth which - // requires expontentially more items to increase, only increase the cap + // requires exponentially more items to increase, only increase the cap // one item at a time. This is more intelligent than the generic append // expansion algorithm which often doubles the cap. index := s.index - staticDepth diff --git a/database/internal/treap/immutable_test.go b/database/internal/treap/immutable_test.go index 5ba96ce1..5c5e6106 100644 --- a/database/internal/treap/immutable_test.go +++ b/database/internal/treap/immutable_test.go @@ -255,7 +255,7 @@ func TestImmutableReverseSequential(t *testing.T) { } // TestImmutableUnordered ensures that putting keys into an immutable treap in -// no paritcular order works as expected. +// no particular order works as expected. func TestImmutableUnordered(t *testing.T) { t.Parallel() diff --git a/database/internal/treap/mutable_test.go b/database/internal/treap/mutable_test.go index 4cf07575..bdabbbc5 100644 --- a/database/internal/treap/mutable_test.go +++ b/database/internal/treap/mutable_test.go @@ -311,7 +311,7 @@ func TestMutableReverseSequential(t *testing.T) { } // TestMutableUnordered ensures that putting keys into a mutable treap in no -// paritcular order works as expected. +// particular order works as expected. func TestMutableUnordered(t *testing.T) { t.Parallel() diff --git a/dcrec/edwards/ecdsa.go b/dcrec/edwards/ecdsa.go index dca6ad91..0b516188 100644 --- a/dcrec/edwards/ecdsa.go +++ b/dcrec/edwards/ecdsa.go @@ -82,7 +82,7 @@ func SignFromSecretNoReader(priv *PrivateKey, hash []byte) (r, s *big.Int, err e return } -// nonceRFC6979 is a local instatiation of deterministic nonce generation +// nonceRFC6979 is a local instantiation of deterministic nonce generation // by the standards of RFC6979. func nonceRFC6979(privkey []byte, hash []byte, extra []byte, version []byte) []byte { pkD := new(big.Int).SetBytes(privkey) diff --git a/dcrec/edwards/signature.go b/dcrec/edwards/signature.go index 91ccd223..4ce916e1 100644 --- a/dcrec/edwards/signature.go +++ b/dcrec/edwards/signature.go @@ -95,7 +95,7 @@ func parseSig(sigStr []byte, der bool) (*Signature, error) { } // ParseSignature parses a signature in BER format for the curve type `curve' -// into a Signature type, perfoming some basic sanity checks. +// into a Signature type, performing some basic sanity checks. func ParseSignature(sigStr []byte) (*Signature, error) { return parseSig(sigStr, false) } diff --git a/dcrec/edwards/threshold.go b/dcrec/edwards/threshold.go index c413be0c..6588b435 100644 --- a/dcrec/edwards/threshold.go +++ b/dcrec/edwards/threshold.go @@ -54,7 +54,7 @@ func combinePubkeys(pks []*PublicKey) *PublicKey { } // generateNoncePair deterministically generate a nonce pair for use in -// partial signing of a message. Returns a public key (nonce to dissemanate) +// partial signing of a message. Returns a public key (nonce to disseminate) // and a private nonce to keep as a secret for the signer. func generateNoncePair(msg []byte, priv []byte, nonceFunction func([]byte, []byte, []byte, diff --git a/dcrec/secp256k1/field.go b/dcrec/secp256k1/field.go index 4d139a69..05f1c827 100644 --- a/dcrec/secp256k1/field.go +++ b/dcrec/secp256k1/field.go @@ -166,7 +166,7 @@ func (f *fieldVal) Set(val *fieldVal) *fieldVal { } // SetInt sets the field value to the passed integer. This is a convenience -// function since it is fairly common to perform some arithemetic with small +// function since it is fairly common to perform some arithmetic with small // native integers. // // The field value is returned to support chaining. This enables syntax such @@ -506,7 +506,7 @@ func (f *fieldVal) Negate(magnitude uint32) *fieldVal { // AddInt adds the passed integer to the existing field value and stores the // result in f. This is a convenience function since it is fairly common to -// perform some arithemetic with small native integers. +// perform some arithmetic with small native integers. // // The field value is returned to support chaining. This enables syntax like: // f.AddInt(1).Add(f2) so that f = f + 1 + f2. diff --git a/dcrec/secp256k1/field_test.go b/dcrec/secp256k1/field_test.go index a15cdc16..a7222a77 100644 --- a/dcrec/secp256k1/field_test.go +++ b/dcrec/secp256k1/field_test.go @@ -655,7 +655,7 @@ func TestMulInt(t *testing.T) { } } -// TestMul ensures that multiplying two field valuess via Mul works as expected. +// TestMul ensures that multiplying two field values via Mul works as expected. func TestMul(t *testing.T) { tests := []struct { in1 string // first hex encoded value diff --git a/dcrec/secp256k1/schnorr/ecdsa_test.go b/dcrec/secp256k1/schnorr/ecdsa_test.go index ca00ac52..8e48ec18 100644 --- a/dcrec/secp256k1/schnorr/ecdsa_test.go +++ b/dcrec/secp256k1/schnorr/ecdsa_test.go @@ -14,7 +14,7 @@ import ( "github.com/decred/dcrd/dcrec/secp256k1/v2" ) -type SchorrSigningTestVectorHex struct { +type SchnorrSigningTestVectorHex struct { msg string nonce string priv string @@ -24,7 +24,7 @@ type SchorrSigningTestVectorHex struct { // schnorrSigningTestVectors were produced using the testing functions // implemented in libsecp256k1. // https://github.com/bitcoin/secp256k1/blob/258720851e24e23c1036b4802a185850e258a105/src/modules/schnorr/tests_impl.h -var schnorrSigningTestVectors = []SchorrSigningTestVectorHex{ +var schnorrSigningTestVectors = []SchnorrSigningTestVectorHex{ {"304502210088BE0644191B935DB1CD786B43FF27798006578D8C908906B49E89", "D1C4C30F60582323A609B56B92270181EB05C3E5AB3E19AE1F768C65C6D09A29", "714D90C991E5D26CBF5771D8A84D087200AAA3197C3217A702ED8D69EA714CAB", "0A3E13BFD0B64C120AA25D27E3CD87678154A4461CE0AD471273927A6459F0C6" + "B9A36629C110ECEEEBBD52E7A5D491BB10AF59C3C73285B9427D1254F28DC460"}, {"304502210088BE0644191B935DB1CD786B43FF27798006578D8C908906B49E89", "86D9A69D76C1435EDC35347B50B4F944D30EDF8B5CB8E897E95F2C1F1B72D3C3", "60A30BC3BC7CDED4F13C9E3F20F69B8F7B4AB70E60825AE053FC88A2E7046C1F", "D60EFA079B194592A5200C60438A3617691FDE1B5FBCF788D0943A4BB69592F1" + "66D469F48267AA71DAF4BA996BA2BF3A99858C4BF854E2CDFC8AB7E6571D6A8C"}, {"304502210088BE0644191B935DB1CD786B43FF27798006578D8C908906B49E89", "499FE87D281A8EDEC40D7C29202CA93F9E612760C689543897255CC3B543F2E9", "0C23A2A854DD57AC4773533E84039BA165CA1F79BE8019BDF9EA3173741C67E9", "3C3483E5CDAAF894261071A948B1E21906CEF0293D10A3D20325EA84CC129B32" + "FF07618FAD7BE485A5A1C15DD6EE5485058D03514259714E724879AABCD70C5D"}, @@ -85,21 +85,21 @@ var schnorrSigningTestVectors = []SchorrSigningTestVectorHex{ {"304402207C7BC9E2D115C4C5C3E50950E69B30A9810BD73946A6D23C4ACBFF2E", "FFFF01000000FEFFFFFFFFF3FFFFFFFFFFFF7F000000000000F07FF8FFFFFFFF", "FFFFFFFF80FFFF07FEFF7F00000000000000FC07FCFFFF0700000000E0FFFFFF", "93E083E71C14BA94479CBE92213A56FF2ECFF8F2B085B2B3AA5CC6E8FEFAEAC0" + "76444710354091BB4FE9A218E875885F81DD787241A766C4E0422C5C1D7AD271"}, } -type SchorrSigningTestVector struct { +type SchnorrSigningTestVector struct { msg []byte nonce []byte priv []byte sig []byte } -func GetSigningTestVectors() []*SchorrSigningTestVector { - tvs := make([]*SchorrSigningTestVector, 0, len(schnorrSigningTestVectors)) +func GetSigningTestVectors() []*SchnorrSigningTestVector { + tvs := make([]*SchnorrSigningTestVector, 0, len(schnorrSigningTestVectors)) for _, v := range schnorrSigningTestVectors { msg, _ := hex.DecodeString(v.msg) nonce, _ := hex.DecodeString(v.nonce) priv, _ := hex.DecodeString(v.priv) sig, _ := hex.DecodeString(v.sig) - lv := SchorrSigningTestVector{msg, nonce, priv, sig} + lv := SchnorrSigningTestVector{msg, nonce, priv, sig} tvs = append(tvs, &lv) } diff --git a/dcrec/secp256k1/schnorr/signature.go b/dcrec/secp256k1/schnorr/signature.go index 7ce70da2..d1ef4698 100644 --- a/dcrec/secp256k1/schnorr/signature.go +++ b/dcrec/secp256k1/schnorr/signature.go @@ -57,7 +57,7 @@ func parseSig(sigStr []byte) (*Signature, error) { } // ParseSignature parses a signature in BER format for the curve type `curve' -// into a Signature type, perfoming some basic sanity checks. +// into a Signature type, performing some basic sanity checks. func ParseSignature(sigStr []byte) (*Signature, error) { return parseSig(sigStr) } diff --git a/dcrec/secp256k1/schnorr/threshold.go b/dcrec/secp256k1/schnorr/threshold.go index 30946764..d71b42b4 100644 --- a/dcrec/secp256k1/schnorr/threshold.go +++ b/dcrec/secp256k1/schnorr/threshold.go @@ -56,7 +56,7 @@ func combinePubkeys(pks []*secp256k1.PublicKey) *secp256k1.PublicKey { return secp256k1.NewPublicKey(pkSumX, pkSumY) } -// nonceRFC6979 is a local instatiation of deterministic nonce generation +// nonceRFC6979 is a local instantiation of deterministic nonce generation // by the standards of RFC6979. func nonceRFC6979(privkey []byte, hash []byte, extra []byte, version []byte) []byte { @@ -69,7 +69,7 @@ func nonceRFC6979(privkey []byte, hash []byte, extra []byte, } // generateNoncePair deterministically generate a nonce pair for use in -// partial signing of a message. Returns a public key (nonce to dissemanate) +// partial signing of a message. Returns a public key (nonce to disseminate) // and a private nonce to keep as a secret for the signer. func generateNoncePair(msg []byte, priv []byte, nonceFunction func([]byte, []byte, []byte, []byte) []byte, extra []byte, diff --git a/dcrec/secp256k1/signature.go b/dcrec/secp256k1/signature.go index 00657f99..a46641d7 100644 --- a/dcrec/secp256k1/signature.go +++ b/dcrec/secp256k1/signature.go @@ -210,7 +210,7 @@ func parseSig(sigStr []byte, der bool) (*Signature, error) { } // ParseSignature parses a signature in BER format for the curve type `curve' -// into a Signature type, perfoming some basic sanity checks. If parsing +// into a Signature type, performing some basic sanity checks. If parsing // according to the more strict DER format is needed, use ParseDERSignature. func ParseSignature(sigStr []byte) (*Signature, error) { return parseSig(sigStr, false) @@ -352,7 +352,7 @@ func recoverKeyFromSignature(sig *Signature, msg []byte, // 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 padded up to the bitlengh of the curve. +// where the R and S parameters are padded up to the bitlength of the curve. func SignCompact(key *PrivateKey, hash []byte, isCompressedKey bool) ([]byte, error) { sig, err := key.Sign(hash) @@ -399,7 +399,7 @@ func SignCompact(key *PrivateKey, // RecoverCompact verifies the compact signature "signature" of "hash" for the // Koblitz curve in "curve". If the signature matches then the recovered public -// key will be returned as well as a boolen if the original key was compressed +// key will be returned as well as a boolean if the original key was compressed // or not, else an error will be returned. func RecoverCompact(signature, hash []byte) (*PublicKey, bool, error) { diff --git a/dcrjson/cmdparse_test.go b/dcrjson/cmdparse_test.go index cf8e0b2a..d67c10f7 100644 --- a/dcrjson/cmdparse_test.go +++ b/dcrjson/cmdparse_test.go @@ -174,7 +174,7 @@ func TestAssignField(t *testing.T) { continue } - // Inidirect through to the base types to ensure their values + // Indirect through to the base types to ensure their values // are the same. for dst.Kind() == reflect.Ptr { dst = dst.Elem() diff --git a/dcrjson/help.go b/dcrjson/help.go index a097aed2..c6da731d 100644 --- a/dcrjson/help.go +++ b/dcrjson/help.go @@ -197,7 +197,7 @@ func reflectTypeToJSONExample(xT descLookupFunc, rt reflect.Type, indentLevel in // previous field to house the opening array bracket, so // replace the opening object brace with the array // syntax. Also, replace the final closing object brace - // with the variadiac array closing syntax. + // with the variadic array closing syntax. indent := strings.Repeat(" ", indentLevel) if indentLevel == 0 { results[0] = indent + "[{" @@ -209,7 +209,7 @@ func reflectTypeToJSONExample(xT descLookupFunc, rt reflect.Type, indentLevel in // the opening array bracket and object brace are // already a part of the previous field. However, the // closing entry is a simple object brace, so replace it - // with the variadiac array closing syntax. The final + // with the variadic array closing syntax. The final // tabs are necessary so the tab writer lines things up // properly. results[len(results)-1] = indent + "},...],\t\t" @@ -537,7 +537,7 @@ func GenerateHelp(method interface{}, descs map[string]string, resultTypes ...in } // Create a closure for the description lookup function which falls back - // to the base help descritptions map for unrecognized keys and tracks + // to the base help descriptions map for unrecognized keys and tracks // and missing keys. var missingKey string xT := func(key string) string { diff --git a/dcrjson/jsonrpc.go b/dcrjson/jsonrpc.go index ee541f5a..cf551d7c 100644 --- a/dcrjson/jsonrpc.go +++ b/dcrjson/jsonrpc.go @@ -23,10 +23,10 @@ type RPCError struct { Message string `json:"message,omitempty"` } -// Guarantee RPCError satisifies the builtin error interface. +// Guarantee RPCError satisfies the builtin error interface. var _, _ error = RPCError{}, (*RPCError)(nil) -// Error returns a string describing the RPC error. This satisifies the +// Error returns a string describing the RPC error. This satisfies the // builtin error interface. func (e RPCError) Error() string { return fmt.Sprintf("%d: %s", e.Code, e.Message) diff --git a/dcrutil/amount.go b/dcrutil/amount.go index 1a04b451..39df61f1 100644 --- a/dcrutil/amount.go +++ b/dcrutil/amount.go @@ -102,7 +102,7 @@ func (a Amount) ToCoin() float64 { // Format formats a monetary amount counted in coin base units as a // string for a given unit. The conversion will succeed for any unit, -// however, known units will be formated with an appended label describing +// however, known units will be formatted with an appended label describing // the units with SI notation, or "atom" for the base unit. func (a Amount) Format(u AmountUnit) string { units := " " + u.String() diff --git a/dcrutil/example_test.go b/dcrutil/example_test.go index c613cef5..102cf521 100644 --- a/dcrutil/example_test.go +++ b/dcrutil/example_test.go @@ -82,7 +82,7 @@ func ExampleAmount_unitConversions() { } // This example demonstrates decoding addresses, determining their underlying -// type, and displaying their associated underlying hash160 and digitial +// type, and displaying their associated underlying hash160 and digital // signature algorithm. func ExampleDecodeAddress() { // Ordinarily addresses would be read from the user or the result of a @@ -105,7 +105,7 @@ func ExampleDecodeAddress() { // algorithms, so this code is limited to that type switch a := addr.(type) { case *dcrutil.AddressPubKeyHash: - // Determine and display the digitial signature algorithm. + // Determine and display the digital signature algorithm. algo := "unknown" switch a.DSA() { case dcrec.STEcdsaSecp256k1: diff --git a/dcrutil/txsort/txsort.go b/dcrutil/txsort/txsort.go index 5d72892a..9244d7c8 100644 --- a/dcrutil/txsort/txsort.go +++ b/dcrutil/txsort/txsort.go @@ -24,7 +24,7 @@ func (s sortableInputSlice) Len() int { return len(s) } -// Swap swaps the transaction intputs at the passed indices. It is part of the +// Swap swaps the transaction inputs at the passed indices. It is part of the // sort.Interface implementation. func (s sortableInputSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] diff --git a/dcrutil/txsort/txsort_test.go b/dcrutil/txsort/txsort_test.go index f299e55d..0a1e9374 100644 --- a/dcrutil/txsort/txsort_test.go +++ b/dcrutil/txsort/txsort_test.go @@ -76,7 +76,7 @@ func TestSort(t *testing.T) { sortedHash: "bb5f9b338c0244e51182b10f36b5ca4c6eeaa2eae98a7bfc106d1f108f154525", }, { - name: "block 150626 tx[24] - sorts outputs only, based on amount and output script ", + name: "block 150626 tx[24] - sorts outputs only, based on amount and output script", hexFile: "tx150626-24.hex", isSorted: false, unsortedHash: "60542bf8ff4acd9ddb28fd9a2df33d23dd2b70a9aaca1f3dd5fe737879205e56", diff --git a/dcrutil/wif.go b/dcrutil/wif.go index 1dcba1bf..80355017 100644 --- a/dcrutil/wif.go +++ b/dcrutil/wif.go @@ -24,7 +24,7 @@ import ( // encountered. var ErrMalformedPrivateKey = errors.New("malformed private key") -// ErrWrongWIFNetwork desribes an error in which the provided WIF is not for +// ErrWrongWIFNetwork describes an error in which the provided WIF is not for // the expected network. type ErrWrongWIFNetwork [2]byte diff --git a/docs/json_rpc_api.mediawiki b/docs/json_rpc_api.mediawiki index 196bd05d..c7aab8fb 100644 --- a/docs/json_rpc_api.mediawiki +++ b/docs/json_rpc_api.mediawiki @@ -2071,7 +2071,7 @@ The recvtx notification for the same txout, after the transaction was mined into # Block details: (object, optional) details about a block and the index of the transaction within a block, if the transaction is mined. |- !Description -|Notifies a client when an registered outpoint is spent by a transaction accepted to mempool and/or mined into a block. +|Notifies a client when a registered outpoint is spent by a transaction accepted to mempool and/or mined into a block. |- !Example |Example redeemingtx notification for mainnet outpoint 61d3696de4c888730cbe06b0ad8ecb6d72d6108e893895aa9bc067bd7eba3fad:0 after being spent by transaction 4ad0c16ac973ff675dec1f3e5f1273f1c45be2a63554343f21b70240a1e43ece: diff --git a/hdkeychain/example_test.go b/hdkeychain/example_test.go index b60c6ac2..3bf6c087 100644 --- a/hdkeychain/example_test.go +++ b/hdkeychain/example_test.go @@ -59,7 +59,7 @@ func Example_defaultWalletLayout() { // Ordinarily this would either be read from some encrypted source // and be decrypted or generated as the NewMaster example shows, but - // for the purposes of this example, the private exteded key for the + // for the purposes of this example, the private extended key for the // master node is being hard coded here. master := "dprv3hCznBesA6jBushjx7y9NrfheE4ZshnaKYtsoLXefmLPzrXgEiXkd" + "RMD6UngnmBYZzgNhdEd4K3PidxcaCiR6HC9hmpj8FcrP4Cv7zBwELA" @@ -173,7 +173,7 @@ func Example_audits() { // Ordinarily this would either be read from some encrypted source // and be decrypted or generated as the NewMaster example shows, but - // for the purposes of this example, the private exteded key for the + // for the purposes of this example, the private extended key for the // master node is being hard coded here. master := "dprv3hCznBesA6jBushjx7y9NrfheE4ZshnaKYtsoLXefmLPzrXgEiXkd" + "RMD6UngnmBYZzgNhdEd4K3PidxcaCiR6HC9hmpj8FcrP4Cv7zBwELA" diff --git a/log.go b/log.go index f3f506a5..86336e64 100644 --- a/log.go +++ b/log.go @@ -108,9 +108,9 @@ var subsystemLoggers = map[string]slog.Logger{ "TXMP": txmpLog, } -// initLogRotator initializes the logging rotater to write logs to logFile and +// initLogRotator initializes the logging rotator to write logs to logFile and // create roll files in the same directory. It must be called before the -// package-global log rotater variables are used. +// package-global log rotator variables are used. func initLogRotator(logFile string) { logDir, _ := filepath.Split(logFile) err := os.MkdirAll(logDir, 0700) diff --git a/lru/cache_test.go b/lru/cache_test.go index 6f56cd7b..768b57c7 100644 --- a/lru/cache_test.go +++ b/lru/cache_test.go @@ -73,7 +73,7 @@ testLoop: cache.Add(uint64(numNonces) + 1) // Ensure the original lru entry still exists since it was updated - // and should've have become the lru entry. + // and should have become the lru entry. if !cache.Contains(nonces[origLruIndex]) { t.Errorf("Contains #%d (%s) entry %d does not exist", i, test.name, nonces[origLruIndex]) diff --git a/mempool/mempool_test.go b/mempool/mempool_test.go index b1f87021..8aa8e6a9 100644 --- a/mempool/mempool_test.go +++ b/mempool/mempool_test.go @@ -221,7 +221,7 @@ func (s *fakeChain) CalcSequenceLock(tx *dcrutil.Tx, view *blockchain.UtxoViewpo // in order to facilitate testing the fake chain instance instead // allows callers to directly set median times associated with fake // utxos and looks up those values here. - medianTime := s.FakeUxtoMedianTime(&txIn.PreviousOutPoint) + medianTime := s.FakeUtxoMedianTime(&txIn.PreviousOutPoint) // Calculate the minimum required timestamp based on the sum of the // past median time and required relative number of seconds. Since @@ -262,9 +262,9 @@ func (s *fakeChain) SetStandardVerifyFlags(flags txscript.ScriptFlags) { s.scriptFlags = flags } -// FakeUxtoMedianTime returns the median time associated with the requested utxo +// FakeUtxoMedianTime returns the median time associated with the requested utxo // from the fake chain instance. -func (s *fakeChain) FakeUxtoMedianTime(prevOut *wire.OutPoint) int64 { +func (s *fakeChain) FakeUtxoMedianTime(prevOut *wire.OutPoint) int64 { s.RLock() medianTime := s.utxoTimes[*prevOut] s.RUnlock() @@ -349,7 +349,7 @@ func (p *poolHarness) GetKey(addr dcrutil.Address) (chainec.PrivateKey, bool, er return p.signKey, true, nil } -// AddFakeUTXO creates a fake mined uxto for the provided transaction. +// AddFakeUTXO creates a fake mined utxo for the provided transaction. func (p *poolHarness) AddFakeUTXO(tx *dcrutil.Tx, blockHeight int64) { p.chain.utxos.AddTxOuts(tx, blockHeight, wire.NullBlockIndex) } @@ -1333,7 +1333,7 @@ func TestBasicOrphanRemoval(t *testing.T) { testPoolMembership(tc, tx, true, false) } - // Attempt to remove an orphan that has a existing redeemer but itself + // Attempt to remove an orphan that has an existing redeemer but itself // is not present and ensure the state of all other orphans (including // the one that redeems it) are unaffected. harness.txPool.RemoveOrphan(chainedTxns[0]) @@ -1599,14 +1599,14 @@ func TestSequenceLockAcceptance(t *testing.T) { valid: true, }, { - name: "By-time lock with unsatisifed seq == 1024", + name: "By-time lock with unsatisfied seq == 1024", txVersion: 2, sequence: mustLockTimeToSeq(true, seqIntervalToSecs(2)), secsOffset: int64(seqIntervalToSecs(1)), valid: false, }, { - name: "By-time lock with unsatisifed masked max sequence", + name: "By-time lock with unsatisfied masked max sequence", txVersion: 2, sequence: 0xffffffff &^ seqLockTimeDisabled, secsOffset: int64(seqIntervalToSecs(65534)), @@ -1620,7 +1620,7 @@ func TestSequenceLockAcceptance(t *testing.T) { valid: true, }, { - name: "Disabled by-height lock with unsatisified sequence", + name: "Disabled by-height lock with unsatisfied sequence", txVersion: 2, sequence: mustLockTimeToSeq(false, 2) | seqLockTimeDisabled, heightOffset: 0, @@ -1634,7 +1634,7 @@ func TestSequenceLockAcceptance(t *testing.T) { valid: true, }, { - name: "Disabled by-time lock with unsatisifed seq == 1024", + name: "Disabled by-time lock with unsatisfied seq == 1024", txVersion: 2, sequence: mustLockTimeToSeq(true, seqIntervalToSecs(2)) | seqLockTimeDisabled, @@ -1666,7 +1666,7 @@ func TestSequenceLockAcceptance(t *testing.T) { valid: true, }, { - name: "By-time lock with unsatisifed seq == 1024 (v1)", + name: "By-time lock with unsatisfied seq == 1024 (v1)", txVersion: 1, sequence: mustLockTimeToSeq(true, seqIntervalToSecs(2)), secsOffset: int64(seqIntervalToSecs(1)), @@ -1680,7 +1680,7 @@ func TestSequenceLockAcceptance(t *testing.T) { valid: true, }, { - name: "Disabled by-height lock with unsatisified seq (v1)", + name: "Disabled by-height lock with unsatisfied seq (v1)", txVersion: 1, sequence: mustLockTimeToSeq(false, 2) | seqLockTimeDisabled, heightOffset: 0, @@ -1694,7 +1694,7 @@ func TestSequenceLockAcceptance(t *testing.T) { valid: true, }, { - name: "Disabled by-time lock with unsatisifed seq == 1024 (v1)", + name: "Disabled by-time lock with unsatisfied seq == 1024 (v1)", txVersion: 1, sequence: mustLockTimeToSeq(true, seqIntervalToSecs(2)) | seqLockTimeDisabled, diff --git a/mining.go b/mining.go index df8e548a..877281de 100644 --- a/mining.go +++ b/mining.go @@ -833,7 +833,7 @@ func handleTooFewVoters(subsidyCache *standalone.SubsidyCache, nextHeight int64, // Fetch the latest block and head and begin working // off of it with an empty transaction tree regular // and the contents of that stake tree. In the future - // we should have the option of readding some + // we should have the option of reading some // transactions from this block, too. topBlock, err := bm.chain.BlockByHash(&best.Hash) if err != nil { @@ -1050,7 +1050,7 @@ func newBlkTmplGenerator(policy *mining.Policy, txSource mining.TxSource, // This function returns nil, nil if there are not enough voters on any of // the current top blocks to create a new block template. func (g *BlkTmplGenerator) NewBlockTemplate(payToAddress dcrutil.Address) (*BlockTemplate, error) { - // All transaction scripts are verified using the more strict standarad + // All transaction scripts are verified using the more strict standard // flags. scriptFlags, err := standardScriptVerifyFlags(g.chain) if err != nil { @@ -1455,7 +1455,7 @@ mempoolLoop: priorityQueue.SetLessFunc(txPQByStakeAndFee) // Put the transaction back into the priority queue and - // skip it so it is re-priortized by fees if it won't + // skip it so it is re-prioritized by fees if it won't // fit into the high-priority section or the priority is // too low. Otherwise this transaction will be the // final one in the high-priority section, so just fall @@ -1518,7 +1518,7 @@ mempoolLoop: prioItem.tx.Hash(), prioItem.priority, prioItem.feePerKB) // Add transactions which depend on this one (and also do not - // have any other unsatisified dependencies) to the priority + // have any other unsatisfied dependencies) to the priority // queue. for _, item := range deps { // Add the transaction to the priority queue if there @@ -2423,7 +2423,7 @@ type regenHandlerState struct { // can be reset at any time without needing to create a new one and the // associated extra garbage. // - // regenTimer is a underlying timer that is used to implement the timeout. + // regenTimer is an underlying timer that is used to implement the timeout. // // regenChanDrained indicates whether or not the channel for the regen timer // has already been read and is used when resetting the timer to ensure the @@ -2926,7 +2926,7 @@ func (g *BgBlkTmplGenerator) handleVote(ctx context.Context, state *regenHandler } } -// handleTemplateUpdate handles the rtTemlateUpdate event by updating the state +// handleTemplateUpdate handles the rtTemplateUpdate event by updating the state // accordingly. // // This function is only intended for use by the regen handler goroutine. diff --git a/mining/policy.go b/mining/policy.go index d009e2da..7f6c5175 100644 --- a/mining/policy.go +++ b/mining/policy.go @@ -107,7 +107,7 @@ func CalcPriority(tx *wire.MsgTx, utxoView *blockchain.UtxoViewpoint, nextBlockH // A compressed pubkey pay-to-script-hash redemption with a maximum len // signature is of the form: // [OP_DATA_73 <73-byte sig> + OP_DATA_35 + {OP_DATA_33 - // <33 byte compresed pubkey> + OP_CHECKSIG}] + // <33 byte compressed pubkey> + OP_CHECKSIG}] // // Thus 1 + 73 + 1 + 1 + 33 + 1 = 110 overhead := 0 diff --git a/peer/example_test.go b/peer/example_test.go index 6c19a3a0..05a621f2 100644 --- a/peer/example_test.go +++ b/peer/example_test.go @@ -15,7 +15,7 @@ import ( ) // mockRemotePeer creates a basic inbound peer listening on the simnet port for -// use with Example_peerConnection. It does not return until the listner is +// use with Example_peerConnection. It does not return until the listener is // active. func mockRemotePeer() error { // Configure peer to act as a simnet node that offers no services. diff --git a/peer/peer.go b/peer/peer.go index 6a31deca..b5ac8247 100644 --- a/peer/peer.go +++ b/peer/peer.go @@ -208,12 +208,12 @@ type Config struct { NewestBlock HashFunc // HostToNetAddress returns the netaddress for the given host. This can be - // nil in which case the host will be parsed as an IP address. + // nil in which case the host will be parsed as an IP address. HostToNetAddress HostToNetAddrFunc // Proxy indicates a proxy is being used for connections. The only // effect this has is to prevent leaking the tor proxy address, so it - // only needs to specified if using a tor proxy. + // only needs to be specified if using a tor proxy. Proxy string // UserAgentName specifies the user agent name to advertise. It is @@ -1057,7 +1057,7 @@ func (p *Peer) maybeAddDeadline(pendingResponses map[string]time.Time, msgCmd st // Setup a deadline for each message being sent that expects a response. // // NOTE: Pings are intentionally ignored here since they are typically - // sent asynchronously and as a result of a long backlock of messages, + // sent asynchronously and as a result of a long backlog of messages, // such as is typical in the case of initial block download, the // response won't be received in time. log.Debugf("Adding deadline for command %s for peer %s", msgCmd, p.addr) diff --git a/rpc/jsonrpc/types/chainsvrcmds.go b/rpc/jsonrpc/types/chainsvrcmds.go index 62611275..5488e447 100644 --- a/rpc/jsonrpc/types/chainsvrcmds.go +++ b/rpc/jsonrpc/types/chainsvrcmds.go @@ -44,7 +44,7 @@ const ( // persistent peer. NRemove NodeSubCmd = "remove" - // NDisconnect indicates the specified peer should be disonnected. + // NDisconnect indicates the specified peer should be disconnected. NDisconnect NodeSubCmd = "disconnect" ) diff --git a/rpc/jsonrpc/types/chainsvrcmds_test.go b/rpc/jsonrpc/types/chainsvrcmds_test.go index ca61911d..e63feec6 100644 --- a/rpc/jsonrpc/types/chainsvrcmds_test.go +++ b/rpc/jsonrpc/types/chainsvrcmds_test.go @@ -1206,7 +1206,7 @@ func TestChainSvrCmds(t *testing.T) { // new command creation function. cmd, err := test.newCmd() if err != nil { - t.Errorf("Test #%d (%s) unexpected dcrjson.NewCmd error: %v ", + t.Errorf("Test #%d (%s) unexpected dcrjson.NewCmd error: %v", i, test.name, err) } diff --git a/rpc/jsonrpc/types/chainsvrwscmds_test.go b/rpc/jsonrpc/types/chainsvrwscmds_test.go index 1579c716..42b6ac4a 100644 --- a/rpc/jsonrpc/types/chainsvrwscmds_test.go +++ b/rpc/jsonrpc/types/chainsvrwscmds_test.go @@ -181,7 +181,7 @@ func TestChainSvrWsCmds(t *testing.T) { // new command creation function. cmd, err := test.newCmd() if err != nil { - t.Errorf("Test #%d (%s) unexpected dcrjson.NewCmd error: %v ", + t.Errorf("Test #%d (%s) unexpected dcrjson.NewCmd error: %v", i, test.name, err) } diff --git a/rpc/jsonrpc/types/chainsvrwsntfns_test.go b/rpc/jsonrpc/types/chainsvrwsntfns_test.go index 6c94c8b7..147da91a 100644 --- a/rpc/jsonrpc/types/chainsvrwsntfns_test.go +++ b/rpc/jsonrpc/types/chainsvrwsntfns_test.go @@ -184,7 +184,7 @@ func TestChainSvrWsNtfns(t *testing.T) { // generic new notification creation function. cmd, err := test.newNtfn() if err != nil { - t.Errorf("Test #%d (%s) unexpected dcrjson.NewCmd error: %v ", + t.Errorf("Test #%d (%s) unexpected dcrjson.NewCmd error: %v", i, test.name, err) } diff --git a/rpcclient/chain.go b/rpcclient/chain.go index 0d97b29c..e1c6f0a2 100644 --- a/rpcclient/chain.go +++ b/rpcclient/chain.go @@ -707,7 +707,7 @@ func (r FutureGetTxOutResult) Receive() (*chainjson.GetTxOutResult, error) { return nil, nil } - // Unmarshal result as an gettxout result object. + // Unmarshal result as a gettxout result object. var txOutInfo *chainjson.GetTxOutResult err = json.Unmarshal(res, &txOutInfo) if err != nil { diff --git a/rpcclient/doc.go b/rpcclient/doc.go index 88f07cc0..72672dec 100644 --- a/rpcclient/doc.go +++ b/rpcclient/doc.go @@ -107,7 +107,7 @@ Some of the commands are extensions specific to a particular RPC server. For example, the DebugLevel call is an extension only provided by dcrd (and dcrwallet passthrough). Therefore if you call one of these commands against an RPC server that doesn't provide them, you will get an unimplemented error -from the server. An effort has been made to call out which commmands are +from the server. An effort has been made to call out which commands are extensions in their documentation. Also, it is important to realize that dcrd intentionally separates the wallet diff --git a/rpcclient/extensions.go b/rpcclient/extensions.go index 2d227aa3..54c60f57 100644 --- a/rpcclient/extensions.go +++ b/rpcclient/extensions.go @@ -117,7 +117,7 @@ func (r FutureEstimateStakeDiffResult) Receive() (*chainjson.EstimateStakeDiffRe return nil, err } - // Unmarsal result as a estimatestakediff result object. + // Unmarshal result as an estimatestakediff result object. var est chainjson.EstimateStakeDiffResult err = json.Unmarshal(res, &est) if err != nil { @@ -600,7 +600,7 @@ func (r FutureGetHeadersResult) Receive() (*chainjson.GetHeadersResult, error) { return nil, err } - // Unmarsal result as a getheaders result object. + // Unmarshal result as a getheaders result object. var vr chainjson.GetHeadersResult err = json.Unmarshal(res, &vr) if err != nil { @@ -1048,7 +1048,7 @@ func (r FutureTicketFeeInfoResult) Receive() (*chainjson.TicketFeeInfoResult, er return nil, err } - // Unmarsal result as a ticketfeeinfo result object. + // Unmarshal result as a ticketfeeinfo result object. var tfir chainjson.TicketFeeInfoResult err = json.Unmarshal(res, &tfir) if err != nil { @@ -1105,7 +1105,7 @@ func (r FutureTicketVWAPResult) Receive() (dcrutil.Amount, error) { return 0, err } - // Unmarsal result as a ticketvwap result object. + // Unmarshal result as a ticketvwap result object. var vwap float64 err = json.Unmarshal(res, &vwap) if err != nil { @@ -1158,7 +1158,7 @@ func (r FutureTxFeeInfoResult) Receive() (*chainjson.TxFeeInfoResult, error) { return nil, err } - // Unmarsal result as a txfeeinfo result object. + // Unmarshal result as a txfeeinfo result object. var tfir chainjson.TxFeeInfoResult err = json.Unmarshal(res, &tfir) if err != nil { @@ -1206,7 +1206,7 @@ func (r FutureVersionResult) Receive() (map[string]chainjson.VersionResult, erro return nil, err } - // Unmarsal result as a version result object. + // Unmarshal result as a version result object. var vr map[string]chainjson.VersionResult err = json.Unmarshal(res, &vr) if err != nil { diff --git a/rpcclient/infrastructure.go b/rpcclient/infrastructure.go index 3be6cb0a..28361f2a 100644 --- a/rpcclient/infrastructure.go +++ b/rpcclient/infrastructure.go @@ -816,8 +816,8 @@ func (c *Client) sendPostRequest(httpReq *http.Request, jReq *jsonRequest) { } // newFutureError returns a new future result channel that already has the -// passed error waitin on the channel with the reply set to nil. This is useful -// to easily return errors from the various Async functions. +// passed error waiting on the channel with the reply set to nil. This is +// useful to easily return errors from the various Async functions. func newFutureError(err error) chan *response { responseChan := make(chan *response, 1) responseChan <- &response{err: err} diff --git a/rpcclient/notify.go b/rpcclient/notify.go index 39bef2af..236a3a53 100644 --- a/rpcclient/notify.go +++ b/rpcclient/notify.go @@ -527,12 +527,12 @@ func (c *Client) handleNotification(ntfn *rawNotification) { } // wrongNumParams is an error type describing an unparseable JSON-RPC -// notificiation due to an incorrect number of parameters for the +// notification due to an incorrect number of parameters for the // expected notification type. The value is the number of parameters // of the invalid notification. type wrongNumParams int -// Error satisifies the builtin error interface. +// Error satisfies the builtin error interface. func (e wrongNumParams) Error() string { return fmt.Sprintf("wrong number of parameters (%d)", e) } diff --git a/rpcclient/wallet.go b/rpcclient/wallet.go index 7ecffa9e..6f3ef17f 100644 --- a/rpcclient/wallet.go +++ b/rpcclient/wallet.go @@ -481,7 +481,7 @@ func (c *Client) SendToAddressCommentAsync(address dcrutil.Address, // SendToAddressComment sends the passed amount to the given address and stores // the provided comment and comment to in the wallet. The comment parameter is // intended to be used for the purpose of the transaction while the commentTo -// parameter is indended to be used for who the transaction is being sent to. +// parameter is intended to be used for who the transaction is being sent to. // // The comments are not part of the transaction and are only internal // to the wallet. @@ -587,7 +587,7 @@ func (c *Client) SendFromCommentAsync(fromAccount string, // SendFromComment sends the passed amount to the given address using the // provided account as a source of funds and stores the provided comment and // comment to in the wallet. The comment parameter is intended to be used for -// the purpose of the transaction while the commentTo parameter is indended to +// the purpose of the transaction while the commentTo parameter is intended to // be used for who the transaction is being sent to. Only funds with the passed // number of minimum confirmations will be used. // @@ -2226,7 +2226,7 @@ func (r FutureAccountAddressIndexResult) Receive() (int, error) { return 0, err } - // Unmarshal result as a accountaddressindex result object. + // Unmarshal result as an accountaddressindex result object. var index int err = json.Unmarshal(res, &index) if err != nil { diff --git a/rpcserver.go b/rpcserver.go index 660308f5..fcf867a4 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -157,7 +157,7 @@ var ( } // ErrInvalidLongPoll is an internal error code to indicate that - // longpollid is not formated properly. + // longpollid is not formatted properly. ErrInvalidLongPoll = errors.New("invalid longpollid format") ) @@ -425,7 +425,7 @@ func rpcNoTxInfoError(txHash *chainhash.Hash) *dcrjson.RPCError { } // rpcMiscError is a convenience function for returning a nicely formatted RPC -// error which indicates there is a unquantifiable error. Use this sparingly; +// error which indicates there is an unquantifiable error. Use this sparingly; // misc return codes are a cop out. func rpcMiscError(message string) *dcrjson.RPCError { return dcrjson.NewRPCError(dcrjson.ErrRPCMisc, message) @@ -2280,7 +2280,7 @@ func (state *gbtWorkState) templateUpdateChan(prevHash *chainhash.Hash, lastGene // changed or the transactions in the memory pool have been updated and it has // been long enough since the last template was generated. Otherwise, the // timestamp for the existing block template is updated (and possibly the -// difficulty on testnet per the consesus rules). Finally, if the +// difficulty on testnet per the consensus rules). Finally, if the // useCoinbaseValue flag is false and the existing block template does not // already contain a valid payment address, the block template will be updated // with a randomly selected payment address from the list of configured @@ -2813,7 +2813,7 @@ func handleGetBlockTemplateRequest(s *rpcServer, request *types.TemplateRequest, // transactions in the memory pool have been updated and it has been at // least five seconds since the last template was generated. // Otherwise, the timestamp for the existing block template is updated - // (and possibly the difficulty on testnet per the consesus rules). + // (and possibly the difficulty on testnet per the consensus rules). if err := state.updateBlockTemplate(s, useCoinbaseValue); err != nil { return nil, err } @@ -4188,7 +4188,7 @@ func handleGetWorkRequest(s *rpcServer) (interface{}, error) { // Serialize the block header into a buffer large enough to hold the // the block header and the internal blake256 padding that is added and - // retuned as part of the data below. For reference: + // returned as part of the data below. For reference: // data[116] --> nBits // data[136] --> Timestamp // data[140] --> nonce @@ -6170,7 +6170,7 @@ func (s *rpcServer) jsonRPCRead(w http.ResponseWriter, r *http.Request, isAdmin defer buf.Flush() conn.SetReadDeadline(timeZeroVal) // Setup a close notifier. Since the connection is hijacked, - // the CloseNotifer on the ResponseWriter is not available. + // the CloseNotifier on the ResponseWriter is not available. closeChan := make(chan struct{}, 1) go func() { _, err := conn.Read(make([]byte, 1)) diff --git a/rpcserverhelp.go b/rpcserverhelp.go index e6e7305d..05e383d0 100644 --- a/rpcserverhelp.go +++ b/rpcserverhelp.go @@ -379,7 +379,7 @@ var helpDescsEnUS = map[string]string{ // TemplateRequest help. "templaterequest-mode": "This is 'template', 'proposal', or omitted", "templaterequest-capabilities": "List of capabilities", - "templaterequest-longpollid": "The long poll ID of a job to monitor for expiration; required and valid only for long poll requests ", + "templaterequest-longpollid": "The long poll ID of a job to monitor for expiration; required and valid only for long poll requests", "templaterequest-sigoplimit": "Number of signature operations allowed in blocks (this parameter is ignored)", "templaterequest-sizelimit": "Number of bytes allowed in blocks (this parameter is ignored)", "templaterequest-maxversion": "Highest supported block version number (this parameter is ignored)", @@ -403,7 +403,7 @@ var helpDescsEnUS = map[string]string{ "getblocktemplateresult-curtime": "Current time as seen by the server (recommended for block time); must fall within mintime/maxtime rules", "getblocktemplateresult-height": "Height of the block to be solved", "getblocktemplateresult-previousblockhash": "Hex-encoded big-endian hash of the previous block", - "getblocktemplateresult-sigoplimit": "Number of sigops allowed in blocks ", + "getblocktemplateresult-sigoplimit": "Number of sigops allowed in blocks", "getblocktemplateresult-sizelimit": "Number of bytes allowed in blocks", "getblocktemplateresult-transactions": "Array of transactions as JSON objects", "getblocktemplateresult-version": "The block version", diff --git a/rpcwebsocket.go b/rpcwebsocket.go index b3076083..e70419f1 100644 --- a/rpcwebsocket.go +++ b/rpcwebsocket.go @@ -1308,7 +1308,7 @@ out: rpcsLog.Debugf("Received command <%s> from %s", cmd.method, c.addr) // Check auth. The client is immediately disconnected if the - // first request of an unauthentiated websocket client is not + // first request of an unauthenticated websocket client is not // the authenticate request, an authenticate request is received // when the client is already authenticated, or incorrect // authentication credentials are provided in the request. @@ -1545,7 +1545,7 @@ out: rpcsLog.Debugf("Received command <%s> from %s", cmd.method, c.addr) // Check auth. The client is immediately disconnected if the - // first request of an unauthentiated websocket client is not + // first request of an unauthenticated websocket client is not // the authenticate request, an authenticate request is received // when the client is already authenticated, or incorrect // authentication credentials are provided in the request. diff --git a/server.go b/server.go index f20f3b2e..1006eab6 100644 --- a/server.go +++ b/server.go @@ -327,7 +327,7 @@ func (sp *serverPeer) newestBlock() (*chainhash.Hash, int64, error) { return &best.Hash, best.Height, nil } -// addKnownAddresses adds the given addresses to the set of known addreses to +// addKnownAddresses adds the given addresses to the set of known addresses to // the peer to prevent sending duplicate addresses. func (sp *serverPeer) addKnownAddresses(addresses []*wire.NetAddress) { for _, na := range addresses { @@ -1453,7 +1453,7 @@ func (s *server) handleAddPeerMsg(state *peerState, sp *serverPeer) bool { port, err := strconv.ParseUint(activeNetParams.DefaultPort, 10, 16) if err != nil { - srvrLog.Errorf("unabled to parse active network port: %v", err) + srvrLog.Errorf("unable to parse active network port: %v", err) return true } @@ -1853,7 +1853,7 @@ func (s *server) outboundPeerConnected(c *connmgr.ConnReq, conn net.Conn) { s.addrManager.Attempt(sp.NA()) } -// peerDoneHandler handles peer disconnects by notifiying the server that it's +// peerDoneHandler handles peer disconnects by notifying the server that it's // done. func (s *server) peerDoneHandler(sp *serverPeer) { sp.WaitForDisconnect() diff --git a/service_windows.go b/service_windows.go index 7623534e..a34d8c1b 100644 --- a/service_windows.go +++ b/service_windows.go @@ -151,7 +151,7 @@ func installService() error { // Support events to the event log using the standard "standard" Windows // EventCreate.exe message file. This allows easy logging of custom - // messges instead of needing to create our own message catalog. + // messages instead of needing to create our own message catalog. eventlog.Remove(svcName) eventsSupported := uint32(eventlog.Error | eventlog.Warning | eventlog.Info) return eventlog.InstallAsEventCreate(svcName, eventsSupported) diff --git a/txscript/engine_test.go b/txscript/engine_test.go index 4ce10e54..af944f97 100644 --- a/txscript/engine_test.go +++ b/txscript/engine_test.go @@ -131,7 +131,7 @@ func TestCheckErrorCondition(t *testing.T) { err = vm.CheckErrorCondition(false) if !IsErrorCode(err, ErrScriptUnfinished) { - t.Fatalf("got unexepected error %v on %dth iteration", + t.Fatalf("got unexpected error %v on %dth iteration", err, i) } } diff --git a/txscript/error.go b/txscript/error.go index 7cc210c7..e6e837d7 100644 --- a/txscript/error.go +++ b/txscript/error.go @@ -309,7 +309,7 @@ const ( ErrPubKeyType // ErrCleanStack is returned when the ScriptVerifyCleanStack flag - // is set, and after evalution, the stack does not contain only a + // is set, and after evaluation, the stack does not contain only a // single element. ErrCleanStack diff --git a/txscript/opcode.go b/txscript/opcode.go index 557fd245..2cc80cee 100644 --- a/txscript/opcode.go +++ b/txscript/opcode.go @@ -2879,7 +2879,7 @@ func opcodeCheckSigAlt(op *opcode, data []byte, vm *Engine) error { return nil } - // Fallthrough of somekind automatically results in false, but + // Fallthrough of some kind automatically results in false, but // this should never be hit. vm.dstack.PushBool(false) return nil diff --git a/txscript/script_test.go b/txscript/script_test.go index c79877de..c869fc41 100644 --- a/txscript/script_test.go +++ b/txscript/script_test.go @@ -351,7 +351,7 @@ func TestRemoveOpcodeByData(t *testing.T) { "0x01020304"), }, { - name: "invalid opcode ", + name: "invalid opcode", before: []byte{OP_UNKNOWN193}, remove: []byte{1, 2, 3, 4}, after: []byte{OP_UNKNOWN193}, diff --git a/txscript/sigcache_test.go b/txscript/sigcache_test.go index aeeacd2e..1cb7c71d 100644 --- a/txscript/sigcache_test.go +++ b/txscript/sigcache_test.go @@ -79,7 +79,7 @@ func TestSigCacheAddEvictEntry(t *testing.T) { sigCopy, _ := secp256k1.ParseSignature(sig.Serialize()) keyCopy, _ := secp256k1.ParsePubKey(key.SerializeCompressed()) if !sigCache.Exists(*msg, sigCopy, keyCopy) { - t.Errorf("previously added item not found in signature" + + t.Errorf("previously added item not found in signature " + "cache") } } @@ -131,13 +131,13 @@ func TestSigCacheAddMaxEntriesZeroOrNegative(t *testing.T) { sig1Copy, _ := secp256k1.ParseSignature(sig1.Serialize()) key1Copy, _ := secp256k1.ParsePubKey(key1.SerializeCompressed()) if sigCache.Exists(*msg1, sig1Copy, key1Copy) { - t.Errorf("previously added signature found in sigcache, but" + + t.Errorf("previously added signature found in sigcache, but " + "shouldn't have been") } // There shouldn't be any entries in the sigCache. if len(sigCache.validSigs) != 0 { - t.Errorf("%v items found in sigcache, no items should have"+ + t.Errorf("%v items found in sigcache, no items should have "+ "been added", len(sigCache.validSigs)) } } diff --git a/txscript/sign.go b/txscript/sign.go index 041deae4..f5d44cd1 100644 --- a/txscript/sign.go +++ b/txscript/sign.go @@ -433,7 +433,7 @@ sigLoop: } for _, addr := range addresses { - // All multisig addresses should be pubkey addreses + // All multisig addresses should be pubkey addresses // it is an error to call this internal function with // bad input. pkaddr := addr.(*dcrutil.AddressSecpPubKey) @@ -569,7 +569,7 @@ func (kc KeyClosure) GetKey(address dcrutil.Address) (chainec.PrivateKey, bool, } // ScriptDB is an interface type provided to SignTxOutput, it encapsulates any -// user state required to get the scripts for an pay-to-script-hash address. +// user state required to get the scripts for a pay-to-script-hash address. type ScriptDB interface { GetScript(dcrutil.Address) ([]byte, error) } diff --git a/txscript/standard.go b/txscript/standard.go index 78b920a7..bff6a5b7 100644 --- a/txscript/standard.go +++ b/txscript/standard.go @@ -221,7 +221,7 @@ func IsMultisigSigScript(script []byte) bool { // will return nil otherwise. func extractCompressedPubKey(script []byte) []byte { // A pay-to-compressed-pubkey script is of the form: - // OP_DATA_33 <33-byte compresed pubkey> OP_CHECKSIG + // OP_DATA_33 <33-byte compressed pubkey> OP_CHECKSIG // All compressed secp256k1 public keys must start with 0x02 or 0x03. if len(script) == 35 && @@ -252,8 +252,8 @@ func extractUncompressedPubKey(script []byte) []byte { return nil } -// extractPubKey extracts either compressed or uncompressed public key from the -// passed script if it is a either a standard pay-to-compressed-secp256k1-pubkey +// extractPubKey extracts either a compressed or uncompressed public key from the +// passed script if it is either a standard pay-to-compressed-secp256k1-pubkey // or pay-to-uncompressed-secp256k1-pubkey script, respectively. It will return // nil otherwise. func extractPubKey(script []byte) []byte { diff --git a/txscript/standard_test.go b/txscript/standard_test.go index aa9215a2..1258d70b 100644 --- a/txscript/standard_test.go +++ b/txscript/standard_test.go @@ -998,7 +998,7 @@ func TestGenerateProvablyPruneableOut(t *testing.T) { for i, test := range tests { script, err := GenerateProvablyPruneableOut(test.data) if e := tstCheckScriptError(err, test.err); e != nil { - t.Errorf("GenerateProvablyPruneableOut: #%d (%s) %v: ", + t.Errorf("GenerateProvablyPruneableOut: #%d (%s) %v", i, test.name, e) continue diff --git a/upnp.go b/upnp.go index cab75f0a..57af9c52 100644 --- a/upnp.go +++ b/upnp.go @@ -375,7 +375,7 @@ func (n *upnpNAT) AddPortMapping(protocol string, externalPort, internalPort int } // TODO: check response to see if the port was forwarded - // If the port was not wildcard we don't get an reply with the port in + // If the port was not wildcard we don't get a reply with the port in // it. Not sure about wildcard yet. miniupnpc just checks for error // codes here. mappedExternalPort = externalPort diff --git a/wire/bench_test.go b/wire/bench_test.go index 53301147..78c80e0c 100644 --- a/wire/bench_test.go +++ b/wire/bench_test.go @@ -342,7 +342,7 @@ func BenchmarkDeserializeTxSmall(b *testing.B) { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // // Previous output hash - 0xff, 0xff, 0xff, 0xff, // Prevous output index + 0xff, 0xff, 0xff, 0xff, // Previous output index 0x07, // Varint for length of signature script 0x04, 0xff, 0xff, 0x00, 0x1d, 0x01, 0x04, // Signature script 0xff, 0xff, 0xff, 0xff, // Sequence diff --git a/wire/common.go b/wire/common.go index a1b195aa..91aaed06 100644 --- a/wire/common.go +++ b/wire/common.go @@ -647,7 +647,7 @@ func WriteVarString(w io.Writer, pver uint32, str string) error { // as a varInt containing the length of the array followed by the bytes // themselves. An error is returned if the length is greater than the // passed maxAllowed parameter which helps protect against memory exhaustion -// attacks and forced panics thorugh malformed messages. The fieldName +// attacks and forced panics through malformed messages. The fieldName // parameter is only used for the error message so it provides more context in // the error. func ReadVarBytes(r io.Reader, pver uint32, maxAllowed uint32, diff --git a/wire/fixedIO_test.go b/wire/fixedIO_test.go index 21563086..9fcb6c6d 100644 --- a/wire/fixedIO_test.go +++ b/wire/fixedIO_test.go @@ -10,7 +10,7 @@ import ( "io" ) -// fixedWriter implements the io.Writer interface and intentially allows +// fixedWriter implements the io.Writer interface and intentionally allows // testing of error paths by forcing short writes. type fixedWriter struct { b []byte @@ -45,7 +45,7 @@ func newFixedWriter(max int) io.Writer { return &fw } -// fixedReader implements the io.Reader interface and intentially allows +// fixedReader implements the io.Reader interface and intentionally allows // testing of error paths by forcing short reads. type fixedReader struct { buf []byte diff --git a/wire/msgaddr_test.go b/wire/msgaddr_test.go index c8ce2277..cec19645 100644 --- a/wire/msgaddr_test.go +++ b/wire/msgaddr_test.go @@ -85,7 +85,7 @@ func TestAddr(t *testing.T) { } // TestAddrWire tests the MsgAddr wire encode and decode for various numbers -// of addreses and protocol versions. +// of addresses and protocol versions. func TestAddrWire(t *testing.T) { // A couple of NetAddresses to use for testing. na := &NetAddress{ diff --git a/wire/msgblock_test.go b/wire/msgblock_test.go index 8f24719a..94b07ce6 100644 --- a/wire/msgblock_test.go +++ b/wire/msgblock_test.go @@ -732,7 +732,7 @@ var testBlockBytes = []byte{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Previous output hash [186] - 0xff, 0xff, 0xff, 0xff, // Prevous output index [218] + 0xff, 0xff, 0xff, 0xff, // Previous output index [218] 0x00, // Previous output tree [222] 0xff, 0xff, 0xff, 0xff, // Sequence [223] 0x01, // Varint for number of transaction outputs [227] @@ -767,7 +767,7 @@ var testBlockBytes = []byte{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Previous output hash - 0xff, 0xff, 0xff, 0xff, // Prevous output index + 0xff, 0xff, 0xff, 0xff, // Previous output index 0x01, // Previous output tree 0xff, 0xff, 0xff, 0xff, // Sequence 0x01, // Varint for number of transaction outputs diff --git a/wire/msgcftypes_test.go b/wire/msgcftypes_test.go index 01771e11..e1243f85 100644 --- a/wire/msgcftypes_test.go +++ b/wire/msgcftypes_test.go @@ -169,7 +169,7 @@ func TestCFTypesWireErrors(t *testing.T) { oldPver := NodeCFVersion - 1 wireErr := &MessageError{} - // Valid MsgCFTypes with it's encoded format. + // Valid MsgCFTypes with its encoded format. baseCf := NewMsgCFTypes([]FilterType{GCSFilterExtended}) baseCfEncoded := []byte{ 0x01, // Varint for number of filter types diff --git a/wire/msgheaders_test.go b/wire/msgheaders_test.go index c9c7af1d..d2db7e84 100644 --- a/wire/msgheaders_test.go +++ b/wire/msgheaders_test.go @@ -199,7 +199,7 @@ func TestHeadersWireErrors(t *testing.T) { bits := uint32(0x1d00ffff) nonce := uint32(0x9962e301) bh := NewBlockHeader( - int32(pver), // Verision + int32(pver), // Version &hash, // PrevHash &merkleHash, // MerkleRootHash &merkleHash, // StakeRoot @@ -271,7 +271,7 @@ func TestHeadersWireErrors(t *testing.T) { // Intentionally invalid block header that has a transaction count used // to force errors. bhTrans := NewBlockHeader( - int32(0), // Verision + int32(0), // Version &hash, // PrevHash &merkleHash, // MerkleRootHash &merkleHash, // StakeRoot diff --git a/wire/msgtx.go b/wire/msgtx.go index 60321f21..d26d3835 100644 --- a/wire/msgtx.go +++ b/wire/msgtx.go @@ -211,7 +211,7 @@ var scriptPool scriptFreeList = make(chan []byte, freeListMaxItems) // script. It is encoded as a varInt containing the length of the array // followed by the bytes themselves. An error is returned if the length is // greater than the passed maxAllowed parameter which helps protect against -// memory exhaustion attacks and forced panics thorugh malformed messages. The +// memory exhaustion attacks and forced panics through malformed messages. The // fieldName parameter is only used for the error message so it provides more // context in the error. func readScript(r io.Reader, pver uint32, maxAllowed uint32, fieldName string) ([]byte, error) { diff --git a/wire/msgtx_test.go b/wire/msgtx_test.go index 8a6ed753..0bec9239 100644 --- a/wire/msgtx_test.go +++ b/wire/msgtx_test.go @@ -790,7 +790,7 @@ func TestTxOverflowErrors(t *testing.T) { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Previous output hash - 0xff, 0xff, 0xff, 0xff, // Prevous output index + 0xff, 0xff, 0xff, 0xff, // Previous output index 0x00, // Previous output tree 0x00, // Varint for length of signature script 0xff, 0xff, 0xff, 0xff, // Sequence diff --git a/wire/msgversion.go b/wire/msgversion.go index 1bd81aa3..6ce71265 100644 --- a/wire/msgversion.go +++ b/wire/msgversion.go @@ -48,7 +48,7 @@ type MsgVersion struct { // connections. Nonce uint64 - // The user agent that generated messsage. This is a encoded as a varString + // The user agent that generated message. This is encoded as a varString // on the wire. This has a max length of MaxUserAgentLen. UserAgent string diff --git a/wire/msgversion_test.go b/wire/msgversion_test.go index e3348560..87f7b523 100644 --- a/wire/msgversion_test.go +++ b/wire/msgversion_test.go @@ -269,7 +269,7 @@ func TestVersionWireErrors(t *testing.T) { // Make a new buffer big enough to hold the base version plus the new // bytes for the bigger varint to hold the new size of the user agent - // and the new user agent string. Then stich it all together. + // and the new user agent string. Then stitch it all together. newLen := len(baseVersionEncoded) - len(baseVersion.UserAgent) newLen = newLen + len(newUAVarIntBuf.Bytes()) - 1 + len(newUA) exceedUAVerEncoded := make([]byte, newLen) diff --git a/wire/protocol.go b/wire/protocol.go index 97da0e2f..aa8b9b63 100644 --- a/wire/protocol.go +++ b/wire/protocol.go @@ -48,7 +48,7 @@ const ( // SFNodeNetwork is a flag used to indicate a peer is a full node. SFNodeNetwork ServiceFlag = 1 << iota - // SFNodeBloom is a flag used to indiciate a peer supports bloom + // SFNodeBloom is a flag used to indicate a peer supports bloom // filtering. SFNodeBloom