diff --git a/addrmgr/addrmanager_test.go b/addrmgr/addrmanager_test.go index f7f24f65c7..72d8087e2d 100644 --- a/addrmgr/addrmanager_test.go +++ b/addrmgr/addrmanager_test.go @@ -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. @@ -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) } diff --git a/addrmgr/network.go b/addrmgr/network.go index 8d5720da7d..b1c1b3fec6 100644 --- a/addrmgr/network.go +++ b/addrmgr/network.go @@ -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. @@ -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), diff --git a/blockchain/fullblocktests/params.go b/blockchain/fullblocktests/params.go index 452d0f24e1..3354a33e07 100644 --- a/blockchain/fullblocktests/params.go +++ b/blockchain/fullblocktests/params.go @@ -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", diff --git a/blockchain/stake/internal/ticketdb/chainio.go b/blockchain/stake/internal/ticketdb/chainio.go index 35805ce8e5..25d3828b52 100644 --- a/blockchain/stake/internal/ticketdb/chainio.go +++ b/blockchain/stake/internal/ticketdb/chainio.go @@ -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. @@ -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. // diff --git a/blockchain/standalone/doc.go b/blockchain/standalone/doc.go index 22aef4aa65..d787df70af 100644 --- a/blockchain/standalone/doc.go +++ b/blockchain/standalone/doc.go @@ -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 diff --git a/chaincfg/mainnetparams.go b/chaincfg/mainnetparams.go index 4bc7ab0164..689f9e2470 100644 --- a/chaincfg/mainnetparams.go +++ b/chaincfg/mainnetparams.go @@ -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", diff --git a/chaincfg/regnetparams.go b/chaincfg/regnetparams.go index a6c1701a49..f52b1922fe 100644 --- a/chaincfg/regnetparams.go +++ b/chaincfg/regnetparams.go @@ -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", diff --git a/chaincfg/simnetparams.go b/chaincfg/simnetparams.go index cbd785d123..d135ed4374 100644 --- a/chaincfg/simnetparams.go +++ b/chaincfg/simnetparams.go @@ -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", diff --git a/chaincfg/testnetparams.go b/chaincfg/testnetparams.go index a9939dc32d..141ec341ac 100644 --- a/chaincfg/testnetparams.go +++ b/chaincfg/testnetparams.go @@ -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", diff --git a/dcrec/secp256k1/ecdsa/doc.go b/dcrec/secp256k1/ecdsa/doc.go index 6a1c070aca..18d12c5266 100644 --- a/dcrec/secp256k1/ecdsa/doc.go +++ b/dcrec/secp256k1/ecdsa/doc.go @@ -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. @@ -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 diff --git a/dcrec/secp256k1/field.go b/dcrec/secp256k1/field.go index 8d9ac74d53..494b209bdb 100644 --- a/dcrec/secp256k1/field.go +++ b/dcrec/secp256k1/field.go @@ -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. @@ -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 @@ -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. @@ -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 diff --git a/dcrec/secp256k1/field_bench_test.go b/dcrec/secp256k1/field_bench_test.go index ec77447f07..b15d132552 100644 --- a/dcrec/secp256k1/field_bench_test.go +++ b/dcrec/secp256k1/field_bench_test.go @@ -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. @@ -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. diff --git a/dcrec/secp256k1/modnscalar.go b/dcrec/secp256k1/modnscalar.go index f66496ed5e..c1ec69b88e 100644 --- a/dcrec/secp256k1/modnscalar.go +++ b/dcrec/secp256k1/modnscalar.go @@ -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. @@ -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 diff --git a/dcrec/secp256k1/modnscalar_test.go b/dcrec/secp256k1/modnscalar_test.go index 6d2aec8dd0..1500f8accf 100644 --- a/dcrec/secp256k1/modnscalar_test.go +++ b/dcrec/secp256k1/modnscalar_test.go @@ -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. @@ -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() diff --git a/dcrjson/error.go b/dcrjson/error.go index c831905d2e..9605b6b1a3 100644 --- a/dcrjson/error.go +++ b/dcrjson/error.go @@ -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. @@ -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 diff --git a/gcs/doc.go b/gcs/doc.go index 1b04420701..8d480a0c70 100644 --- a/gcs/doc.go +++ b/gcs/doc.go @@ -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. @@ -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 diff --git a/internal/blockchain/chainview.go b/internal/blockchain/chainview.go index 8c1afbaabf..ba3816d9af 100644 --- a/internal/blockchain/chainview.go +++ b/internal/blockchain/chainview.go @@ -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. // diff --git a/internal/blockchain/upgrade.go b/internal/blockchain/upgrade.go index d7b1b63058..64a50c6c45 100644 --- a/internal/blockchain/upgrade.go +++ b/internal/blockchain/upgrade.go @@ -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() diff --git a/internal/blockchain/validate.go b/internal/blockchain/validate.go index f43469d061..f6e4c34a35 100644 --- a/internal/blockchain/validate.go +++ b/internal/blockchain/validate.go @@ -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) diff --git a/internal/blockchain/validate_test.go b/internal/blockchain/validate_test.go index 6f46204b0a..2ea3866389 100644 --- a/internal/blockchain/validate_test.go +++ b/internal/blockchain/validate_test.go @@ -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) diff --git a/internal/mempool/doc.go b/internal/mempool/doc.go index af4c371737..ff3cf01aca 100644 --- a/internal/mempool/doc.go +++ b/internal/mempool/doc.go @@ -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. @@ -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 diff --git a/internal/mempool/error.go b/internal/mempool/error.go index 26458e1824..bbf8eb974b 100644 --- a/internal/mempool/error.go +++ b/internal/mempool/error.go @@ -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. @@ -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") diff --git a/internal/mempool/mempool.go b/internal/mempool/mempool.go index b94aba3841..5287c4ff6f 100644 --- a/internal/mempool/mempool.go +++ b/internal/mempool/mempool.go @@ -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 diff --git a/internal/mining/error.go b/internal/mining/error.go index 329b3fe728..489ee1a96d 100644 --- a/internal/mining/error.go +++ b/internal/mining/error.go @@ -1,4 +1,4 @@ -// 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. @@ -61,11 +61,10 @@ func (e ErrorKind) Error() string { return string(e) } -// Error identifies a mining rule rule violation. It has full support for -// errors.Is and errors.As, so the caller can ascertain the specific reason -// for the error by checking the underlying error. It is used to indicate -// that processing of a block or transaction failed due to one of the many -// validation rules. +// Error identifies a mining rule violation. It has full support for errors.Is +// and errors.As, so the caller can ascertain the specific reason for the error +// by checking the underlying error. It is used to indicate that processing of +// a block or transaction failed due to one of the many validation rules. type Error struct { Err error Description string diff --git a/internal/netsync/manager.go b/internal/netsync/manager.go index 9a8b9b5350..776b625a02 100644 --- a/internal/netsync/manager.go +++ b/internal/netsync/manager.go @@ -994,7 +994,7 @@ func (m *SyncManager) guessHeaderSyncProgress(header *wire.BlockHeader) float64 } // headerSyncProgress returns a percentage that is a guess of the progress of -// of the header sync process. +// the header sync process. // // This function is safe for concurrent access. func (m *SyncManager) headerSyncProgress() float64 { diff --git a/internal/rpcserver/rpcserver.go b/internal/rpcserver/rpcserver.go index eebe8f64e7..77b610a380 100644 --- a/internal/rpcserver/rpcserver.go +++ b/internal/rpcserver/rpcserver.go @@ -551,7 +551,7 @@ type workState struct { // prevBestHash houses the previous best known chain tip. // // waitForUpdatedTemplate determines whether or not a getwork invocation - // should should block until a new template is received from the background + // should block until a new template is received from the background // template generator. // // templatePool houses unique block templates that have been returned to diff --git a/internal/rpcserver/rpcserverhandlers_test.go b/internal/rpcserver/rpcserverhandlers_test.go index 7345a4f744..4c9ace5a3a 100644 --- a/internal/rpcserver/rpcserverhandlers_test.go +++ b/internal/rpcserver/rpcserverhandlers_test.go @@ -244,8 +244,8 @@ func (c *testRPCChain) ChainTips() []blockchain.ChainTipInfo { return c.chainTips } -// ChainWork returns returns a mocked total work up to and including the block -// of the provided block hash. +// ChainWork returns a mocked total work up to and including the block of the +// provided block hash. func (c *testRPCChain) ChainWork(hash *chainhash.Hash) (uint256.Uint256, error) { return c.chainWork, c.chainWorkErr } diff --git a/math/uint256/uint256.go b/math/uint256/uint256.go index 3f712be99b..9e71cad232 100644 --- a/math/uint256/uint256.go +++ b/math/uint256/uint256.go @@ -1,4 +1,4 @@ -// Copyright (c) 2021-2022 The Decred developers +// Copyright (c) 2021-2023 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. @@ -190,8 +190,8 @@ func (n *Uint256) SetByteSliceLE(b []byte) *Uint256 { } // PutBytesUnchecked unpacks the uint256 to a 32-byte big-endian value directly -// into the passed byte slice. The target slice must must have at least 32 -// bytes available or it will panic. +// into the passed byte slice. The target slice must have at least 32 bytes +// available or it will panic. // // There is a similar function, PutBytes, which unpacks the uint256 into a // 32-byte array directly. This version is provided since it can be useful to @@ -236,8 +236,8 @@ func (n *Uint256) PutBytesUnchecked(b []byte) { } // PutBytesUncheckedLE unpacks the uint256 to a 32-byte little-endian value -// directly into the passed byte slice. The target slice must must have at -// least 32 bytes available or it will panic. +// directly into the passed byte slice. The target slice must have at least 32 +// bytes available or it will panic. // // There is a similar function, PutBytesLE, which unpacks the uint256 into a // 32-byte array directly. This version is provided since it can be useful to diff --git a/math/uint256/uint256_test.go b/math/uint256/uint256_test.go index d757354abb..f6c7b536e9 100644 --- a/math/uint256/uint256_test.go +++ b/math/uint256/uint256_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2021 The Decred developers +// Copyright (c) 2021-2023 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. @@ -3400,8 +3400,8 @@ func TestUint256BitLen(t *testing.T) { } // TestUint256Text ensures the converting uint256s to the supported output bases -// via the Text method works as intended that that it also handles nil pointers -// as intended. +// via the Text method works as intended that it also handles nil pointers as +// intended. func TestUint256Text(t *testing.T) { t.Parallel() diff --git a/rpc/jsonrpc/types/chainsvrcmds.go b/rpc/jsonrpc/types/chainsvrcmds.go index bd583a1702..4ec2ff443e 100644 --- a/rpc/jsonrpc/types/chainsvrcmds.go +++ b/rpc/jsonrpc/types/chainsvrcmds.go @@ -1,5 +1,5 @@ // Copyright (c) 2014 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. @@ -70,7 +70,7 @@ type SStxInput struct { } // SStxCommitOut represents the output to an SStx transaction. Specifically a -// a commitment address and amount, and a change address and amount. +// commitment address and amount, and a change address and amount. type SStxCommitOut struct { Addr string `json:"addr"` CommitAmt int64 `json:"commitamt"` diff --git a/rpc/jsonrpc/types/chainsvrresults.go b/rpc/jsonrpc/types/chainsvrresults.go index 2db1120453..1bc8f84448 100644 --- a/rpc/jsonrpc/types/chainsvrresults.go +++ b/rpc/jsonrpc/types/chainsvrresults.go @@ -523,7 +523,6 @@ type FeeInfoWindow struct { } // TicketFeeInfoResult models the data returned from the ticketfeeinfo command. -// command. type TicketFeeInfoResult struct { FeeInfoMempool FeeInfoMempool `json:"feeinfomempool"` FeeInfoBlocks []FeeInfoBlock `json:"feeinfoblocks"` @@ -531,7 +530,6 @@ type TicketFeeInfoResult struct { } // TxFeeInfoResult models the data returned from the ticketfeeinfo command. -// command. type TxFeeInfoResult struct { FeeInfoMempool FeeInfoMempool `json:"feeinfomempool"` FeeInfoBlocks []FeeInfoBlock `json:"feeinfoblocks"` diff --git a/rpcclient/infrastructure.go b/rpcclient/infrastructure.go index 3d95da8eb2..808e12eb7c 100644 --- a/rpcclient/infrastructure.go +++ b/rpcclient/infrastructure.go @@ -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. @@ -532,7 +532,7 @@ func (c *Client) sendMessage(marshalledJSON []byte) { // reregisterNtfns creates and sends commands needed to re-establish the current // notification state associated with the client. It should only be called on -// on reconnect by the resendRequests function. +// reconnect by the resendRequests function. func (c *Client) reregisterNtfns(ctx context.Context) error { // Nothing to do if the caller is not interested in notifications. if c.ntfnHandlers == nil { diff --git a/rpcclient/rawtransactions.go b/rpcclient/rawtransactions.go index f53c660e9e..efd2174049 100644 --- a/rpcclient/rawtransactions.go +++ b/rpcclient/rawtransactions.go @@ -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. @@ -253,8 +253,8 @@ func (r *FutureCreateRawSStxResult) Receive() (*wire.MsgTx, error) { } // SStxCommitOut represents the output to an SStx transaction. Specifically a -// a commitment address and amount, and a change address and amount. Same -// name as the JSON lib, but different internal structures. +// commitment address and amount, and a change address and amount. Same name as +// the JSON lib, but different internal structures. type SStxCommitOut struct { Addr stdaddr.Address CommitAmt dcrutil.Amount diff --git a/server.go b/server.go index d8ff98d422..866ab08955 100644 --- a/server.go +++ b/server.go @@ -2366,7 +2366,7 @@ func (s *server) AddPeer(sp *serverPeer) { } } -// DonePeer removes a disconnected peer from the the server. +// DonePeer removes a disconnected peer from the server. func (s *server) DonePeer(sp *serverPeer) { select { case <-s.quit: diff --git a/txscript/doc.go b/txscript/doc.go index adb17d1982..acbdf7d30a 100644 --- a/txscript/doc.go +++ b/txscript/doc.go @@ -1,5 +1,5 @@ // Copyright (c) 2013-2017 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. @@ -29,7 +29,7 @@ what conditions must be met in order to spend decred. # Errors -Errors returned by this package are of type txscript.ErrorKind wrapped by +The errors returned by this package are of type txscript.ErrorKind wrapped by txscript.Error which has full support for the standard library errors.Is and errors.As functions. This allows the caller to programmatically determine the specific error while still providing rich error messages with contextual diff --git a/txscript/opcode.go b/txscript/opcode.go index 464d1f0553..386d6bbae0 100644 --- a/txscript/opcode.go +++ b/txscript/opcode.go @@ -1,5 +1,5 @@ // Copyright (c) 2013-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. @@ -1738,7 +1738,7 @@ func opcodeNegate(op *opcode, data []byte, vm *Engine) error { } // opcodeAbs treats the top item on the data stack as an integer and replaces it -// it with its absolute value. +// with its absolute value. // // Stack transformation: [... x1 x2] -> [... x1 abs(x2)] func opcodeAbs(op *opcode, data []byte, vm *Engine) error { diff --git a/txscript/stdaddr/address.go b/txscript/stdaddr/address.go index 0fb76a2811..04e468f5ef 100644 --- a/txscript/stdaddr/address.go +++ b/txscript/stdaddr/address.go @@ -1,4 +1,4 @@ -// Copyright (c) 2021 The Decred developers +// Copyright (c) 2021-2023 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. @@ -311,7 +311,7 @@ func NewAddressPubKeyHashEcdsaSecp256k1(scriptVersion uint16, pkHash []byte, return nil, makeError(ErrUnsupportedScriptVersion, str) } -// NewAddressPubKeyHashEd25519 returns an address that represents a a payment +// NewAddressPubKeyHashEd25519 returns an address that represents a payment // destination which imposes an encumbrance that requires an Ed25519 public key // that hashes to the provided public key hash along with a valid Ed25519 // signature for that public key. diff --git a/txscript/stdaddr/addressv0.go b/txscript/stdaddr/addressv0.go index 9218422af8..998391dced 100644 --- a/txscript/stdaddr/addressv0.go +++ b/txscript/stdaddr/addressv0.go @@ -1,4 +1,4 @@ -// Copyright (c) 2021 The Decred developers +// Copyright (c) 2021-2023 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. @@ -722,7 +722,7 @@ func (addr *AddressPubKeyHashEcdsaSecp256k1V0) Hash160() *[ripemd160.Size]byte { return &addr.hash } -// AddressPubKeyHashEd25519V0 specifies an address that represents a a payment +// AddressPubKeyHashEd25519V0 specifies an address that represents a payment // destination which imposes an encumbrance that requires an Ed25519 public key // that hashes to the given public key hash along with a valid Ed25519 signature // for that public key. @@ -738,7 +738,7 @@ type AddressPubKeyHashEd25519V0 struct { var _ Address = (*AddressPubKeyHashEd25519V0)(nil) var _ Hash160er = (*AddressPubKeyHashEd25519V0)(nil) -// NewAddressPubKeyHashEd25519V0 returns an address that represents a a payment +// NewAddressPubKeyHashEd25519V0 returns an address that represents a payment // destination which imposes an encumbrance that requires an Ed25519 public key // that hashes to the provided public key hash along with a valid Ed25519 // signature for that public key using version 0 scripts. diff --git a/wire/doc.go b/wire/doc.go index d99c19e668..eab1c853ba 100644 --- a/wire/doc.go +++ b/wire/doc.go @@ -1,5 +1,5 @@ // Copyright (c) 2013-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. @@ -142,9 +142,9 @@ from a remote peer is: # Errors -Errors returned by this package are either the raw errors provided by underlying -calls to read/write from streams such as io.EOF, io.ErrUnexpectedEOF, and -io.ErrShortWrite, or of type wire.MessageError. This allows the caller to +The errors returned by this package are either the raw errors provided by +underlying calls to read/write from streams such as io.EOF, io.ErrUnexpectedEOF, +and io.ErrShortWrite, or of type wire.MessageError. This allows the caller to differentiate between general IO errors and malformed messages through type assertions. diff --git a/wire/message.go b/wire/message.go index 09a362071c..fe771a258a 100644 --- a/wire/message.go +++ b/wire/message.go @@ -1,5 +1,5 @@ // Copyright (c) 2013-2016 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. @@ -292,8 +292,8 @@ func WriteMessageN(w io.Writer, msg Message, pver uint32, dcrnet CurrencyNet) (i // WriteMessage writes a Decred Message to w including the necessary header // information. This function is the same as WriteMessageN except it doesn't -// doesn't return the number of bytes written. This function is mainly provided -// for backwards compatibility with the original API, but it's also useful for +// return the number of bytes written. This function is mainly provided for +// backwards compatibility with the original API, but it's also useful for // callers that don't care about byte counts. func WriteMessage(w io.Writer, msg Message, pver uint32, dcrnet CurrencyNet) error { _, err := WriteMessageN(w, msg, pver, dcrnet) diff --git a/wire/msgblock.go b/wire/msgblock.go index 113b140e4e..8dc5723b8e 100644 --- a/wire/msgblock.go +++ b/wire/msgblock.go @@ -311,7 +311,7 @@ func (msg *MsgBlock) Bytes() ([]byte, error) { } // SerializeSize returns the number of bytes it would take to serialize the -// the block. +// block. func (msg *MsgBlock) SerializeSize() int { // Check to make sure that all transactions have the correct // type and version to be included in a block. diff --git a/wire/msgreject.go b/wire/msgreject.go index 32a01ae288..189950cadb 100644 --- a/wire/msgreject.go +++ b/wire/msgreject.go @@ -1,5 +1,5 @@ // Copyright (c) 2014-2016 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. @@ -55,9 +55,8 @@ func (code RejectCode) String() string { // Deprecated: This message is no longer valid as of protocol version // RemoveRejectVersion. type MsgReject struct { - // Cmd is the command for the message which was rejected such as - // as CmdBlock or CmdTx. This can be obtained from the Command function - // of a Message. + // Cmd is the command for the message which was rejected such as CmdBlock or + // CmdTx. This can be obtained from the Command function of a Message. Cmd string // RejectCode is a code indicating why the command was rejected. It diff --git a/wire/msgtx.go b/wire/msgtx.go index b7c10f5611..9fc22d7881 100644 --- a/wire/msgtx.go +++ b/wire/msgtx.go @@ -1,5 +1,5 @@ // Copyright (c) 2013-2016 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. @@ -333,7 +333,7 @@ type TxOut struct { } // SerializeSize returns the number of bytes it would take to serialize the -// the transaction output. +// transaction output. func (t *TxOut) SerializeSize() int { // Value 8 bytes + Version 2 bytes + serialized varint size for // the length of PkScript + PkScript bytes. @@ -1001,7 +1001,7 @@ func (msg *MsgTx) BytesWitness() ([]byte, error) { } // SerializeSize returns the number of bytes it would take to serialize the -// the transaction. +// transaction. func (msg *MsgTx) SerializeSize() int { // Unknown type return 0. n := 0 diff --git a/wire/netaddress.go b/wire/netaddress.go index 26b5ed64ed..a903cedc2a 100644 --- a/wire/netaddress.go +++ b/wire/netaddress.go @@ -1,5 +1,5 @@ // Copyright (c) 2013-2015 The btcsuite developers -// Copyright (c) 2015-2016 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. @@ -136,9 +136,9 @@ func readNetAddress(r io.Reader, pver uint32, na *NetAddress, ts bool) error { // version and whether or not the timestamp is included per ts. Some messages // like version do not include the timestamp. func writeNetAddress(w io.Writer, pver uint32, na *NetAddress, ts bool) error { - // NOTE: The Decred protocol uses a uint32 for the timestamp so it will - // stop working somewhere around 2106. Also timestamp wasn't added until - // until protocol version >= NetAddressTimeVersion. + // NOTE: The Decred protocol uses a uint32 for the timestamp so it will stop + // working somewhere around 2106. Also timestamp wasn't added until + // protocol version >= NetAddressTimeVersion. if ts { err := writeElement(w, uint32(na.Timestamp.Unix())) if err != nil {