Skip to content

Commit

Permalink
multi: Remove a bunch of dup words in comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
davecgh committed Aug 23, 2023
1 parent 0a35adc commit fc54d98
Show file tree
Hide file tree
Showing 44 changed files with 123 additions and 129 deletions.
4 changes: 2 additions & 2 deletions addrmgr/addrmanager_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2013-2014 The btcsuite developers
// Copyright (c) 2015-2021 The Decred developers
// Copyright (c) 2015-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -57,7 +57,7 @@ func TestStartStop(t *testing.T) {
t.Fatalf("address manager failed to stop: %v", err)
}

// Verify that the the peers file has been written to.
// Verify that the peers file has been written to.
if _, err := os.Stat(peersFile); err != nil {
t.Fatalf("peers file does not exist: %s", peersFile)
}
Expand Down
4 changes: 2 additions & 2 deletions addrmgr/network.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2013-2014 The btcsuite developers
// Copyright (c) 2015-2021 The Decred developers
// Copyright (c) 2015-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand All @@ -12,7 +12,7 @@ import (

var (
// rfc1918Nets specifies the IPv4 private address blocks as defined by
// by RFC1918 (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16).
// RFC1918 (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16).
rfc1918Nets = []net.IPNet{
ipNet("10.0.0.0", 8, 32),
ipNet("172.16.0.0", 12, 32),
Expand Down
2 changes: 1 addition & 1 deletion blockchain/fullblocktests/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ var regNetParams = &chaincfg.Params{
11: {{
Vote: chaincfg.Vote{
Id: chaincfg.VoteIDBlake3Pow,
Description: "Change proof of work hashing algorithm to BLAKE3 as defined in in DCP0011",
Description: "Change proof of work hashing algorithm to BLAKE3 as defined in DCP0011",
Mask: 0x0006, // Bits 1 and 2
Choices: []chaincfg.Choice{{
Id: "abstain",
Expand Down
12 changes: 6 additions & 6 deletions blockchain/stake/internal/ticketdb/chainio.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2015-2022 The Decred developers
// Copyright (c) 2015-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -40,32 +40,32 @@ const (
// the height of the best chain on start up.
//
// There are 5 buckets from the database reserved for tickets. These are:
// 1. Live
// 1. Live:
// Live ticket bucket, for tickets currently in the lottery
//
// k: ticket hash
// v: height
//
// 2. Missed
// 2. Missed:
// Missed tickets bucket, for all tickets that are missed.
//
// k: ticket hash
// v: height
//
// 3. Revoked
// 3. Revoked:
// Revoked tickets bucket, for all tickets that are Revoked.
//
// k: ticket hash
// v: height
//
// 4. BlockUndo
// 4. BlockUndo:
// Block removal data, for reverting the first 3 database buckets to
// a previous state.
//
// k: height
// v: serialized undo ticket data
//
// 5. TicketsToAdd
// 5. TicketsToAdd:
// Tickets to add bucket, which tells which tickets will be maturing and
// entering the (1) in the event that a block at that height is added.
//
Expand Down
10 changes: 5 additions & 5 deletions blockchain/standalone/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ The provided functions fall into the following categories:
# Errors
Errors returned by this package are of type standalone.RuleError. This allows
the caller to differentiate between errors further up the call stack through
type assertions. In addition, callers can programmatically determine the
specific rule violation by examining the ErrorCode field of the type asserted
standalone.RuleError.
The errors returned by this package are of type standalone.RuleError. This
allows the caller to differentiate between errors further up the call stack
through type assertions. In addition, callers can programmatically determine
the specific rule violation by examining the ErrorCode field of the type
asserted standalone.RuleError.
*/
package standalone
2 changes: 1 addition & 1 deletion chaincfg/mainnetparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ func MainNetParams() *Params {
10: {{
Vote: Vote{
Id: VoteIDBlake3Pow,
Description: "Change proof of work hashing algorithm to BLAKE3 as defined in in DCP0011",
Description: "Change proof of work hashing algorithm to BLAKE3 as defined in DCP0011",
Mask: 0x0006, // Bits 1 and 2
Choices: []Choice{{
Id: "abstain",
Expand Down
2 changes: 1 addition & 1 deletion chaincfg/regnetparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ func RegNetParams() *Params {
11: {{
Vote: Vote{
Id: VoteIDBlake3Pow,
Description: "Change proof of work hashing algorithm to BLAKE3 as defined in in DCP0011",
Description: "Change proof of work hashing algorithm to BLAKE3 as defined in DCP0011",
Mask: 0x0006, // Bits 1 and 2
Choices: []Choice{{
Id: "abstain",
Expand Down
2 changes: 1 addition & 1 deletion chaincfg/simnetparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ func SimNetParams() *Params {
11: {{
Vote: Vote{
Id: VoteIDBlake3Pow,
Description: "Change proof of work hashing algorithm to BLAKE3 as defined in in DCP0011",
Description: "Change proof of work hashing algorithm to BLAKE3 as defined in DCP0011",
Mask: 0x0006, // Bits 1 and 2
Choices: []Choice{{
Id: "abstain",
Expand Down
2 changes: 1 addition & 1 deletion chaincfg/testnetparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ func TestNet3Params() *Params {
11: {{
Vote: Vote{
Id: VoteIDBlake3Pow,
Description: "Change proof of work hashing algorithm to BLAKE3 as defined in in DCP0011",
Description: "Change proof of work hashing algorithm to BLAKE3 as defined in DCP0011",
Mask: 0x0006, // Bits 1 and 2
Choices: []Choice{{
Id: "abstain",
Expand Down
14 changes: 7 additions & 7 deletions dcrec/secp256k1/ecdsa/doc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020 The Decred developers
// Copyright (c) 2020-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -32,11 +32,11 @@ key without actually revealing it.
# Errors
Errors returned by this package are of type ecdsa.Error and fully support the
standard library errors.Is and errors.As functions. This allows the caller to
programmatically determine the specific error by examining the ErrorKind field
of the type asserted ecdsa.Error while still providing rich error messages with
contextual information. See ErrorKind in the package documentation for a full
list.
The errors returned by this package are of type ecdsa.Error and fully support
the standard library errors.Is and errors.As functions. This allows the caller
to programmatically determine the specific error by examining the ErrorKind
field of the type asserted ecdsa.Error while still providing rich error messages
with contextual information. See ErrorKind in the package documentation for a
full list.
*/
package ecdsa
19 changes: 9 additions & 10 deletions dcrec/secp256k1/field.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2013-2014 The btcsuite developers
// Copyright (c) 2015-2022 The Decred developers
// Copyright (c) 2013-2022 Dave Collins
// Copyright (c) 2015-2023 The Decred developers
// Copyright (c) 2013-2023 Dave Collins
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -435,7 +435,7 @@ func (f *FieldVal) Normalize() *FieldVal {

// PutBytesUnchecked unpacks the field value to a 32-byte big-endian value
// directly into the passed byte slice in constant time. The target slice must
// must have at least 32 bytes available or it will panic.
// have at least 32 bytes available or it will panic.
//
// There is a similar function, PutBytes, which unpacks the field value into a
// 32-byte array directly. This version is provided since it can be useful
Expand Down Expand Up @@ -816,11 +816,10 @@ func (f *FieldVal) Mul(val *FieldVal) *FieldVal {
return f.Mul2(f, val)
}

// Mul2 multiplies the passed two field values together and stores the result
// result in f in constant time. Note that this function can overflow if
// multiplying any of the individual words exceeds a max uint32. In practice,
// this means the magnitude of either value involved in the multiplication must
// be a max of 8.
// Mul2 multiplies the passed two field values together and stores the result in
// f in constant time. Note that this function can overflow if multiplying any
// of the individual words exceeds a max uint32. In practice, this means the
// magnitude of either value involved in the multiplication must be a max of 8.
//
// The field value is returned to support chaining. This enables syntax like:
// f3.Mul2(f, f2).AddInt(1) so that f3 = (f * f2) + 1.
Expand Down Expand Up @@ -1510,8 +1509,8 @@ func (f *FieldVal) SquareVal(val *FieldVal) *FieldVal {
// Output Max Magnitude: 1
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 multiplicative inverse is
// a*b = 1 (mod p), it follows that b = a*a^(p-2) = a^(p-1) = 1 (mod p).
// 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
Expand Down
4 changes: 2 additions & 2 deletions dcrec/secp256k1/field_bench_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2022 The Decred developers
// Copyright (c) 2020-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -40,7 +40,7 @@ func BenchmarkFieldSqrt(b *testing.B) {
}
}

// BenchmarkBigSqrt benchmarks calculating the square root of an an unsigned
// BenchmarkBigSqrt benchmarks calculating the square root of an unsigned
// 256-bit big-endian integer modulo the field prime with stdlib big integers.
func BenchmarkBigSqrt(b *testing.B) {
// The function is constant time so any value is fine.
Expand Down
6 changes: 3 additions & 3 deletions dcrec/secp256k1/modnscalar.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2022 The Decred developers
// Copyright (c) 2020-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -364,8 +364,8 @@ func (s *ModNScalar) SetByteSlice(b []byte) bool {
}

// PutBytesUnchecked unpacks the scalar to a 32-byte big-endian value directly
// into the passed byte slice in constant time. The target slice must must have
// at least 32 bytes available or it will panic.
// into the passed byte slice in constant time. The target slice must have at
// least 32 bytes available or it will panic.
//
// There is a similar function, PutBytes, which unpacks the scalar into a
// 32-byte array directly. This version is provided since it can be useful to
Expand Down
9 changes: 4 additions & 5 deletions dcrec/secp256k1/modnscalar_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2022 The Decred developers
// Copyright (c) 2020-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -1259,10 +1259,9 @@ func TestModNScalarIsOverHalfOrder(t *testing.T) {
}
}

// TestModNScalarIsOverHalfOrderRandom ensures ensures that scalars report
// whether or not they exceeed the half order for random values works as
// expected by also performing the same operation with big ints and comparing
// the results.
// TestModNScalarIsOverHalfOrderRandom ensures that scalars report whether or
// not they exceeed the half order for random values works as expected by also
// performing the same operation with big ints and comparing the results.
func TestModNScalarIsOverHalfOrderRandom(t *testing.T) {
// Use a unique random seed each test instance and log it if the tests fail.
seed := time.Now().Unix()
Expand Down
4 changes: 2 additions & 2 deletions dcrjson/error.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2014 The btcsuite developers
// Copyright (c) 2015-2020 The Decred developers
// Copyright (c) 2015-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand All @@ -26,7 +26,7 @@ const (
ErrInvalidType = ErrorKind("ErrInvalidType")

// ErrEmbeddedType indicates the provided command struct contains an
// embedded type which is not not supported.
// embedded type which is not supported.
ErrEmbeddedType = ErrorKind("ErrEmbeddedType")

// ErrUnexportedField indicates the provided command struct contains an
Expand Down
12 changes: 6 additions & 6 deletions gcs/doc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018-2022 The Decred developers
// Copyright (c) 2018-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -27,11 +27,11 @@ are parameterized by the following:
# Errors
Errors returned by this package are of type gcs.Error. This allows the caller
to programmatically determine the specific error by examining the ErrorKind
field of the type asserted gcs.Error while still providing rich error messages
with contextual information. See ErrorKind in the package documentation
for a full list.
The errors returned by this package are of type gcs.Error. This allows the
caller to programmatically determine the specific error by examining the
ErrorKind field of the type asserted gcs.Error while still providing rich error
messages with contextual information. See ErrorKind in the package
documentation for a full list.
# GCS use in Decred
Expand Down
2 changes: 1 addition & 1 deletion internal/blockchain/chainview.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (c *chainView) Next(node *blockNode) *blockNode {
}

// findFork returns the final common block between the provided node and the
// the chain view. It will return nil if there is no common block. This only
// chain view. It will return nil if there is no common block. This only
// differs from the exported version in that it is up to the caller to ensure
// the lock is held.
//
Expand Down
6 changes: 3 additions & 3 deletions internal/blockchain/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -4674,9 +4674,9 @@ func serializeHeaderCommitmentsV1(commitments []chainhash.Hash) []byte {
//
// The database is guaranteed to have the header commitments for all blocks
// after the point that header commitments activated and also have both the
// block data data and associated filter data available. In practice, that
// includes all blocks that are part of the main chain as well as any side chain
// blocks that were fully connected at some point.
// block data and associated filter data available. In practice, that includes
// all blocks that are part of the main chain as well as any side chain blocks
// that were fully connected at some point.
func initializeHeaderCmts(ctx context.Context, db database.DB, params *chaincfg.Params) error {
log.Info("Storing header commitments. This may take a while...")
start := time.Now()
Expand Down
2 changes: 1 addition & 1 deletion internal/blockchain/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ func standaloneToChainRuleError(err error) error {
// difficulty is not performed.
func checkProofOfWorkSanity(header *wire.BlockHeader, powLimit *big.Int, flags BehaviorFlags) error {
// Only ensure the target difficulty bits are in the valid range when the
// the flag to avoid proof of work checks is set.
// flag to avoid proof of work checks is set.
if flags&BFNoPoWCheck == BFNoPoWCheck {
err := standalone.CheckProofOfWorkRange(header.Bits, powLimit)
return standaloneToChainRuleError(err)
Expand Down
2 changes: 1 addition & 1 deletion internal/blockchain/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ func TestCheckConnectBlockTemplate(t *testing.T) {
g.ExpectTip("b3a") // Ensure chain tip didn't change.

// Create a block template that builds on the current tip and ensure it
// it is still accepted after the forced reorg.
// is still accepted after the forced reorg.
//
// ... -> b2(1) -> b3a(2)
// \-> b4ct(3)
Expand Down
16 changes: 8 additions & 8 deletions internal/mempool/doc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018-2022 The Decred developers
// Copyright (c) 2018-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -75,13 +75,13 @@ be an exhaustive list.
# Errors
Errors returned by this package are either the raw errors provided by underlying
calls or of type mempool.RuleError. Since there are two classes of rules
(mempool acceptance rules and blockchain (consensus) acceptance rules), the
mempool.RuleError type contains a single Err field which will, in turn, either
be a mempool.TxRuleError or a blockchain.RuleError. The first indicates a
violation of mempool acceptance rules while the latter indicates a violation of
consensus acceptance rules. This allows the caller to easily differentiate
The errors returned by this package are either the raw errors provided by
underlying calls or of type mempool.RuleError. Since there are two classes of
rules (mempool acceptance rules and blockchain (consensus) acceptance rules),
the mempool.RuleError type contains a single Err field which will, in turn,
either be a mempool.TxRuleError or a blockchain.RuleError. The first indicates
a violation of mempool acceptance rules while the latter indicates a violation
of consensus acceptance rules. This allows the caller to easily differentiate
between unexpected errors, such as database errors, versus errors due to rule
violations through type assertions. In addition, callers can programmatically
determine the specific rule violation by type asserting the Err field to one of
Expand Down
4 changes: 2 additions & 2 deletions internal/mempool/error.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2014-2016 The btcsuite developers
// Copyright (c) 2015-2022 The Decred developers
// Copyright (c) 2015-2023 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand All @@ -25,7 +25,7 @@ const (
// prevailing orphan policy.
ErrOrphanPolicyViolation = ErrorKind("ErrOrphanPolicyViolation")

// ErrMempoolDoubleSpend indicates a transaction that attempts to to spend
// ErrMempoolDoubleSpend indicates a transaction that attempts to spend
// coins already spent by other transactions in the pool.
ErrMempoolDoubleSpend = ErrorKind("ErrMempoolDoubleSpend")

Expand Down
4 changes: 2 additions & 2 deletions internal/mempool/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ type Policy struct {
MaxOrphanTxs int

// MaxOrphanTxSize is the maximum size allowed for orphan transactions.
// This helps prevent memory exhaustion attacks from sending a lot of
// of big orphans.
// This helps prevent memory exhaustion attacks from sending a lot of big
// orphans.
MaxOrphanTxSize int

// MaxSigOpsPerTx is the maximum number of signature operations
Expand Down
Loading

0 comments on commit fc54d98

Please sign in to comment.