multi: Remove a bunch of dup words in comments.
This commit is contained in:
parent
0a35adc021
commit
fc54d98b1e
@ -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)
|
||||
}
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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.
|
||||
//
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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
|
||||
|
||||
12
gcs/doc.go
12
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
|
||||
|
||||
|
||||
@ -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.
|
||||
//
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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")
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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()
|
||||
|
||||
|
||||
@ -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"`
|
||||
|
||||
@ -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"`
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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.
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user