multi: Properly capitalize Decred.

Decred is inconsistencly capitalized in the code base,
change all occurences of decred to Decred.
This commit is contained in:
Markus Richter 2018-03-01 23:23:35 +00:00 committed by Dave Collins
parent 2b8bde41ea
commit 1e42b8524d
71 changed files with 258 additions and 258 deletions

View File

@ -1,6 +1,6 @@
============================================================================
User visible changes for dcrd
A full-node decred implementation written in Go
A full-node Decred implementation written in Go
============================================================================
Changes in 0.11.1 (Wed May 27 2015)

View File

@ -79,12 +79,12 @@ dep ensure
go install . ./cmd/...
```
For more information about decred and how to set up your software please go to
For more information about Decred and how to set up your software please go to
our docs page at [docs.decred.org](https://docs.decred.org/getting-started/beginner-guide/).
## Docker
All tests and linters may be run in a docker container using the script `run_tests.sh`. This script defaults to using the current supported version of go. You can run it with the major version of go you would like to use as the only arguement to test a previous on a previous version of go (generally decred supports the current version of go and the previous one).
All tests and linters may be run in a docker container using the script `run_tests.sh`. This script defaults to using the current supported version of go. You can run it with the major version of go you would like to use as the only arguement to test a previous on a previous version of go (generally Decred supports the current version of go and the previous one).
```
./run_tests.sh 1.8

View File

@ -28,7 +28,7 @@ import (
)
// AddrManager provides a concurrency safe address manager for caching potential
// peers on the decred network.
// peers on the Decred network.
type AddrManager struct {
mtx sync.Mutex
peersFile string
@ -1087,7 +1087,7 @@ func (a *AddrManager) GetBestLocalAddress(remoteAddr *wire.NetAddress) *wire.Net
return bestAddress
}
// New returns a new decred address manager.
// New returns a new Decred address manager.
// Use Start to begin processing asynchronous address updates.
func New(dataDir string, lookupFunc func(string) ([]net.IP, error)) *AddrManager {
am := AddrManager{

View File

@ -5,7 +5,7 @@ blockchain
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/decred/dcrd/blockchain)
Package blockchain implements decred block handling and chain selection rules.
Package blockchain implements Decred block handling and chain selection rules.
The test coverage is currently only around 60%, but will be increasing over
time. See `test_coverage.txt` for the gocov coverage report. Alternatively, if
you are running a POSIX OS, you can run the `cov_report.sh` script for a

View File

@ -1184,7 +1184,7 @@ func hashMerkleBranches(left *chainhash.Hash, right *chainhash.Hash) *chainhash.
// is stored in a linear array.
//
// A merkle tree is a tree in which every non-leaf node is the hash of its
// children nodes. A diagram depicting how this works for decred transactions
// children nodes. A diagram depicting how this works for Decred transactions
// where h(x) is a blake256 hash follows:
//
// root = h1234 = h(h12 + h34)
@ -1299,7 +1299,7 @@ func hashToBig(hash *chainhash.Hash) *big.Int {
// The formula to calculate N is:
// N = (-1^sign) * mantissa * 256^(exponent-3)
//
// This compact form is only used in decred to encode unsigned 256-bit numbers
// This compact form is only used in Decred to encode unsigned 256-bit numbers
// which represent difficulty targets, thus there really is not a need for a
// sign bit, but it is implemented here to stay consistent with bitcoind.
func compactToBig(compact uint32) *big.Int {

View File

@ -67,7 +67,7 @@ func HashToBig(hash *chainhash.Hash) *big.Int {
// The formula to calculate N is:
// N = (-1^sign) * mantissa * 256^(exponent-3)
//
// This compact form is only used in decred to encode unsigned 256-bit numbers
// This compact form is only used in Decred to encode unsigned 256-bit numbers
// which represent difficulty targets, thus there really is not a need for a
// sign bit, but it is implemented here to stay consistent with bitcoind.
func CompactToBig(compact uint32) *big.Int {

View File

@ -4,12 +4,12 @@
// license that can be found in the LICENSE file.
/*
Package blockchain implements decred block handling and chain selection rules.
Package blockchain implements Decred block handling and chain selection rules.
The decred block handling and chain selection rules are an integral, and quite
The Decred block handling and chain selection rules are an integral, and quite
likely the most important, part of decred. Unfortunately, at the time of
this writing, these rules are also largely undocumented and had to be
ascertained from the bitcoind source code. At its core, decred is a
ascertained from the bitcoind source code. At its core, Decred is a
distributed consensus of which blocks are valid and which ones will comprise the
main block chain (public ledger) that ultimately determines accepted
transactions, so it is extremely important that fully validating nodes agree on
@ -21,7 +21,7 @@ functionality such as rejecting duplicate blocks, ensuring blocks and
transactions follow all rules, orphan handling, and best chain selection along
with reorganization.
Since this package does not deal with other decred specifics such as network
Since this package does not deal with other Decred specifics such as network
communication or wallets, it provides a notification system which gives the
caller a high level of flexibility in how they want to react to certain events
such as orphan blocks which need their parents requested and newly connected

View File

@ -46,7 +46,7 @@ func HashMerkleBranches(left *chainhash.Hash, right *chainhash.Hash) *chainhash.
// is stored in a linear array.
//
// A merkle tree is a tree in which every non-leaf node is the hash of its
// children nodes. A diagram depicting how this works for decred transactions
// children nodes. A diagram depicting how this works for Decred transactions
// where h(x) is a blake256 hash follows:
//
// root = h1234 = h(h12 + h34)

View File

@ -182,7 +182,7 @@ func CheckTransactionSanity(tx *wire.MsgTx, params *chaincfg.Params) error {
// output must not be negative or more than the max allowed per
// transaction. Also, the total of all outputs must abide by the same
// restrictions. All amounts in a transaction are in a unit value
// known as an atom. One decred is a quantity of atoms as defined by
// known as an atom. One Decred is a quantity of atoms as defined by
// the AtomsPerCoin constant.
var totalAtom int64
for _, txOut := range tx.TxOut {
@ -1221,7 +1221,7 @@ func (b *BlockChain) checkDupTxs(txSet []*dcrutil.Tx, view *UtxoViewpoint) error
// requirements are met, detecting double spends, validating all values and
// fees are in the legal range and the total output amount doesn't exceed the
// input amount, and verifying the signatures to prove the spender was the
// owner of the decred and therefore allowed to spend them. As it checks the
// owner of the Decred and therefore allowed to spend them. As it checks the
// inputs, it also calculates the total fees for the transaction and returns
// that value.
//
@ -1773,7 +1773,7 @@ func CheckTransactionInputs(subsidyCache *SubsidyCache, tx *dcrutil.Tx, txHeight
// output values of the input transactions must not be negative
// or more than the max allowed per transaction. All amounts
// in a transaction are in a unit value known as an atom. One
// decred is a quantity of atoms as defined by the AtomPerCoin
// Decred is a quantity of atoms as defined by the AtomPerCoin
// constant.
originTxAtom := utxoEntry.AmountByIndex(originTxIndex)
if originTxAtom < 0 {

View File

@ -71,21 +71,21 @@ type newPeerMsg struct {
peer *serverPeer
}
// blockMsg packages a decred block message and the peer it came from together
// blockMsg packages a Decred block message and the peer it came from together
// so the block handler has access to that information.
type blockMsg struct {
block *dcrutil.Block
peer *serverPeer
}
// invMsg packages a decred inv message and the peer it came from together
// invMsg packages a Decred inv message and the peer it came from together
// so the block handler has access to that information.
type invMsg struct {
inv *wire.MsgInv
peer *serverPeer
}
// headersMsg packages a decred headers message and the peer it came from
// headersMsg packages a Decred headers message and the peer it came from
// together so the block handler has access to that information.
type headersMsg struct {
headers *wire.MsgHeaders
@ -97,7 +97,7 @@ type donePeerMsg struct {
peer *serverPeer
}
// txMsg packages a decred tx message and the peer it came from together
// txMsg packages a Decred tx message and the peer it came from together
// so the block handler has access to that information.
type txMsg struct {
tx *dcrutil.Tx
@ -2517,7 +2517,7 @@ func (b *blockManager) SetParentTemplate(bt *BlockTemplate) {
<-reply
}
// newBlockManager returns a new decred block manager.
// newBlockManager returns a new Decred block manager.
// Use Start to begin processing asynchronous block and inv updates.
func newBlockManager(s *server, indexManager blockchain.IndexManager, interrupt <-chan struct{}) (*blockManager, error) {
bm := blockManager{

View File

@ -55,7 +55,7 @@ func validDbType(dbType string) bool {
return false
}
// netName returns the name used when referring to a decred network. At the
// netName returns the name used when referring to a Decred network. At the
// time of writing, dcrd currently places blocks for testnet version 2 in the
// data and log directory "testnet2", which does not match the Name field of the
// chaincfg parameters. This function can be used to override this directory name

View File

@ -10,7 +10,7 @@ Decred (secp256k1 only for now). It is designed so that it may be used with the
standard crypto/ecdsa packages provided with go. A comprehensive suite of test
is provided to ensure proper functionality. Package dcrec was originally based
on work from ThePiachu which is licensed under the same terms as Go, but it has
signficantly diverged since then. The decred developers original is licensed
signficantly diverged since then. The Decred developers original is licensed
under the liberal ISC license.
Although this package was primarily written for dcrd, it has intentionally been

View File

@ -285,7 +285,7 @@ func hashToInt(hash []byte) *big.Int {
// SEC 1 Ver 2.0, page 47-48 (53 and 54 in the pdf). This performs the details
// in the inner loop in Step 1. The counter provided is actually the j parameter
// of the loop * 2 - on the first iteration of j we do the R case, else the -R
// case in step 1.6. This counter is used in the decred compressed signature
// case in step 1.6. This counter is used in the Decred compressed signature
// format and thus we match bitcoind's behaviour here.
func recoverKeyFromSignature(sig *Signature, msg []byte,
iter int, doChecks bool) (*PublicKey, error) {

View File

@ -47,7 +47,7 @@ $ go get -u github.com/decred/dcrd/dcrjson
## GPG Verification Key
All official release tags are signed by Conformal so users can ensure the code
has not been tampered with and is coming from the decred developers. To
has not been tampered with and is coming from the Decred developers. To
verify the signature perform the following:
- Download the public key from the Conformal website at

View File

@ -4,7 +4,7 @@
// license that can be found in the LICENSE file.
/*
Package dcrjson provides primitives for working with the decred JSON-RPC API.
Package dcrjson provides primitives for working with the Decred JSON-RPC API.
Overview

View File

@ -116,7 +116,7 @@ func (a Amount) String() string {
// MulF64 multiplies an Amount by a floating point value. While this is not
// an operation that must typically be done by a full node or wallet, it is
// useful for services that build on top of decred (for example, calculating
// useful for services that build on top of Decred (for example, calculating
// a fee by multiplying by a percentage).
func (a Amount) MulF64(f float64) Amount {
return round(float64(a) * f)

View File

@ -8,14 +8,14 @@ Package dcrutil provides decred-specific convenience functions and types.
Block Overview
A Block defines a decred block that provides easier and more efficient
A Block defines a Decred block that provides easier and more efficient
manipulation of raw wire protocol blocks. It also memoizes hashes for the
block and its transactions on their first access so subsequent accesses don't
have to repeat the relatively expensive hashing operations.
Tx Overview
A Tx defines a decred transaction that provides more efficient manipulation of
A Tx defines a Decred transaction that provides more efficient manipulation of
raw wire protocol transactions. It memoizes the hash for the transaction on its
first access so subsequent accesses don't have to repeat the relatively
expensive hashing operations.

View File

@ -67,7 +67,7 @@ func TstAddressPubKey(serializedPubKey []byte, pubKeyFormat PubKeyFormat,
}
// TstAddressSAddr returns the expected script address bytes for
// P2PKH and P2SH decred addresses.
// P2PKH and P2SH Decred addresses.
func TstAddressSAddr(addr string) []byte {
decoded := base58.Decode(addr)
return decoded[2 : 2+ripemd160.Size]

2
doc.go
View File

@ -4,7 +4,7 @@
// license that can be found in the LICENSE file.
/*
dcrd is a full-node decred implementation written in Go.
dcrd is a full-node Decred implementation written in Go.
The default options are sane for most users. This means dcrd will work 'out of
the box' for most users. However, there are also a wide variety of flags that

View File

@ -23,7 +23,7 @@
<a name="About" />
### 1. About
dcrd is a full node decred implementation written in [Go](http://golang.org),
dcrd is a full node Decred implementation written in [Go](http://golang.org),
licensed under the [copyfree](http://www.copyfree.org) ISC License.
This project is currently under active development and is in a Beta state. It is

View File

@ -188,7 +188,7 @@ the method name for further details such as parameter and return information.
|32|[verifychain](#verifychain)|N|Verifies the block chain database.|
|33|[debuglevel](#debuglevel)|N|Dynamically changes the debug logging level.|
|34|[getbestblock](#getbestblock)|Y|Get block height and hash of best block in the main chain.|
|35|[getcurrentnet](#getcurrentnet)|Y|Get decred network dcrd is running on.|
|35|[getcurrentnet](#getcurrentnet)|Y|Get Decred network dcrd is running on.|
|36|[searchrawtransactions](#searchrawtransactions)|Y|Query for transactions related to a particular address.|
|37|[node](#node)|N|Attempts to add or remove a peer. |
|38|[generate](#generate)|N|When in simnet or regtest mode, generate a set number of blocks. |
@ -229,7 +229,7 @@ the method name for further details such as parameter and return information.
|Method|decoderawtransaction|
|Parameters|1. `data`: `(string, required)` serialized, hex-encoded transaction.|
|Description|Returns a JSON object representing the provided serialized, hex-encoded transaction.|
|Returns|`(json object)`<br />`txid`: `(string)` the transaction id. <br />`hash`: `(string)` the hash of the transaction. <br /> `locktime`: `(numeric)` the transaction lock time.<br />`version`: `(numeric)` the block version. <br />`expiry`: `(numeric)` the transaction expiry. <br />`vin`: `(array of json objects)` the transaction inputs as json objects.<br />`vout`: `(array of json objects)` the transaction outputs as json objects.<br /><br />`{"txid": "hash", "locktime": n, "version":n, "expiry": n, "vin": [...], "vout": [...]}`<br /><br />**vin (for coinbase transactions)**<br />`(json object)`<br /> `coinbase`: (string) the hex-encoded bytes of the signature script.<br />`sequence`: (numeric) the script sequence number.<br /><br />`{"coinbase": "data", "sequence": n, ...}`<br /><br />**vin (for stakebase transactions)**<br />`(json object)`<br /> `stakebase`: (string) the hash of the stake transaction.<br />`sequence`: (numeric) the script sequence number.<br /><br />`{"stakebase": "hash", "sequence": n, ...}`<br /><br />**vin (for non-coinbase / non-stakebase transactions)**<br />`(json object)`<br />`txid`: `(string)` the hash of the origin transaction.<br />`vout`: `(numeric)` the index of the output being redeemed from the origin transaction.<br />`scriptSig`: `(json object)` the signature script used to redeem the origin transaction.<br />`asm`:`(string)` disassembly of the script.<br />`data`: `(string)` hex-encoded bytes of the script.<br />`sequence`: `(numeric)` the script sequence number.<br /><br />`{"txid": "hash", "vout": n,"scriptSig": {"asm": "asm", "hex": "data"}, "sequence": n, ...}`<br /><br />**vout**<br />`(json object)`<br />`value`: `(numeric)` the value in DCR.<br />`n`: `(numeric)` the index of this transaction output.<br />`scriptPubKey`:`(json object)` the public key script used to pay coins.<br />`asm`: `(string)` disassembly of the script.<br /> `hex`: `(string)` hex-encoded bytes of the script.<br /> `reqSigs`: `(numeric)` the number of required signatures.<br />`type`: `(string)` the type of the script (e.g. 'pubkeyhash').<br />`addresses`: `(json array of string)` the decred addresses associated with this output.<br /><br />`{ "value": n, "n": n, "scriptPubKey": {"asm": "asm", "hex": "data","reqSigs": n, "type": "scripttype","addresses": [...]}}`|
|Returns|`(json object)`<br />`txid`: `(string)` the transaction id. <br />`hash`: `(string)` the hash of the transaction. <br /> `locktime`: `(numeric)` the transaction lock time.<br />`version`: `(numeric)` the block version. <br />`expiry`: `(numeric)` the transaction expiry. <br />`vin`: `(array of json objects)` the transaction inputs as json objects.<br />`vout`: `(array of json objects)` the transaction outputs as json objects.<br /><br />`{"txid": "hash", "locktime": n, "version":n, "expiry": n, "vin": [...], "vout": [...]}`<br /><br />**vin (for coinbase transactions)**<br />`(json object)`<br /> `coinbase`: (string) the hex-encoded bytes of the signature script.<br />`sequence`: (numeric) the script sequence number.<br /><br />`{"coinbase": "data", "sequence": n, ...}`<br /><br />**vin (for stakebase transactions)**<br />`(json object)`<br /> `stakebase`: (string) the hash of the stake transaction.<br />`sequence`: (numeric) the script sequence number.<br /><br />`{"stakebase": "hash", "sequence": n, ...}`<br /><br />**vin (for non-coinbase / non-stakebase transactions)**<br />`(json object)`<br />`txid`: `(string)` the hash of the origin transaction.<br />`vout`: `(numeric)` the index of the output being redeemed from the origin transaction.<br />`scriptSig`: `(json object)` the signature script used to redeem the origin transaction.<br />`asm`:`(string)` disassembly of the script.<br />`data`: `(string)` hex-encoded bytes of the script.<br />`sequence`: `(numeric)` the script sequence number.<br /><br />`{"txid": "hash", "vout": n,"scriptSig": {"asm": "asm", "hex": "data"}, "sequence": n, ...}`<br /><br />**vout**<br />`(json object)`<br />`value`: `(numeric)` the value in DCR.<br />`n`: `(numeric)` the index of this transaction output.<br />`scriptPubKey`:`(json object)` the public key script used to pay coins.<br />`asm`: `(string)` disassembly of the script.<br /> `hex`: `(string)` hex-encoded bytes of the script.<br /> `reqSigs`: `(numeric)` the number of required signatures.<br />`type`: `(string)` the type of the script (e.g. 'pubkeyhash').<br />`addresses`: `(json array of string)` the Decred addresses associated with this output.<br /><br />`{ "value": n, "n": n, "scriptPubKey": {"asm": "asm", "hex": "data","reqSigs": n, "type": "scripttype","addresses": [...]}}`|
|Example Return|**For coinbase transactions**<br />`{"txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b", "version": 1, "locktime": 0, "vin": [{"coinbase": "04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6...","sequence": 4294967295}, ...],"vout": [{"value": 50, "n": 0, "scriptPubKey": {"asm": "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4ce...","hex": "4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4...", "reqSigs": 1,"type": "pubkey","addresses": ["1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", ...]}}]}`<br /><br />**For stakebase transactions**<br />`{"txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b", "version": 1, "locktime": 0, "vin": [{"stakebase": "60ac4b057247b3d0b9a8173de56b5e1be8c1d1da970511c626ef53706c66be04","sequence": 4294967295}, ...],"vout": [{"value": 50, "n": 0, "scriptPubKey": {"asm": "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4ce...","hex": "4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4...", "reqSigs": 1,"type": "pubkey","addresses": ["1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", ...]}}]}`<br /><br />**For non-coinbase / non-stakebase transactions**<br />`{"txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b", "version": 1, "locktime": 0, "vin": [{"txid": "60ac4b057247b3d0b9a8173de56b5e1be8c1d1da970511c626ef53706c66be04", "vout": 0, "scriptSig": {"asm": "3046022100cb42f8df44eca83dd0a727988dcde9384953e830b1f8004d57485e2ede1b9c8f0...", "hex": "493046022100cb42f8df44eca83dd0a727988dcde9384953e830b1f8004d57485e2ede1b9c8...",},"sequence": 4294967295}, ...],"vout": [{"value": 50, "n": 0, "scriptPubKey": {"asm": "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4ce...","hex": "4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4...", "reqSigs": 1,"type": "pubkey","addresses": ["1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", ...]}}]}`|
[Return to Overview](#MethodOverview)<br />
***
@ -240,7 +240,7 @@ the method name for further details such as parameter and return information.
|Method|decodescript|
|Parameters|1. `script`: `(string, required)` hex-encoded script.|
|Description|Returns a JSON object with information about the provided hex-encoded script.|
|Returns|`(json object)`<br />`asm`: `(string)` disassembly of the script (absent for nonstandard scripts).<br />`reqSigs`: `(numeric)` the number of required signatures.<br />`type`: `(string)` the type of the script (e.g. 'pubkeyhash').<br />`addresses`: `(json array of string)` the decred addresses associated with this script.<br />`p2sh`: `(string)` the script hash for use in pay-to-script-hash transactions.<br /><br />`{ "asm": "asm", "reqSigs": n, "type": "scripttype", "addresses": [...], "p2sh": "scripthash"}`|
|Returns|`(json object)`<br />`asm`: `(string)` disassembly of the script (absent for nonstandard scripts).<br />`reqSigs`: `(numeric)` the number of required signatures.<br />`type`: `(string)` the type of the script (e.g. 'pubkeyhash').<br />`addresses`: `(json array of string)` the Decred addresses associated with this script.<br />`p2sh`: `(string)` the script hash for use in pay-to-script-hash transactions.<br /><br />`{ "asm": "asm", "reqSigs": n, "type": "scripttype", "addresses": [...], "p2sh": "scripthash"}`|
|Example Return|`{"asm": "OP_DUP OP_HASH160 b0a4d8a91981106e4ed85165a66748b19f7b7ad4 OP_EQUALVERIFY OP_CHECKSIG", "reqSigs": 1, "type": "pubkeyhash", "addresses": ["1H71QVBpzuLTNUh5pewaH3UTLTo2vWgcRJ"], "p2sh": "359b84ff799f48231990ff0298206f54117b08b6"}`|
[Return to Overview](#MethodOverview)<br />
@ -462,7 +462,7 @@ the method name for further details such as parameter and return information.
|Parameters|1. `transaction hash`: `(string, required)` the hash of the transaction.<br />2. `verbose`: `(int, optional, default=0)` specifies the transaction is returned as a JSON object instead of hex-encoded string.|
|Description|Returns information about a transaction given its hash.|
|Returns (verbose=0)|`"data" (string) hex-encoded bytes of the serialized transaction`|
|Returns (verbose=1)|`(json object)`<br />`hex`: `(string)` hex-encoded transaction / hex-encoded bytes of the script.<br />`txid`: `(string)` the hash of the transaction.<br />`version`: `(numeric)` the transaction version.<br />`locktime`: `(numeric)` the transaction lock time.<br />`vin`: `(array of json objects)` the transaction inputs as json objects.<br />`coinbase`: `(string)` the hex-encoded bytes of the signature script.<br />`stakebase`: `(string)` the hash of the stake transaction.<br />`sequence`: `(numeric)` the script sequence number.<br />`txid`: `(string)` the hash of the origin transaction.<br />`vout`: `(numeric)` the index of the output being redeemed from the origin transaction.<br />`scriptSig`: `(json object)` the signature script used to redeem the origin transaction.<br />`asm`: `(string)` disassembly of the script.<br />`sequence`: `(numeric)` the script sequence number.<br />`vout`: `(array of json objects)` the transaction outputs as json objects.<br />`value`: `(numeric)` the value in DCR.<br />`n`: `(numeric)` the index of this transaction output.<br />`scriptPubKey`: `(json object)` the public key script used to pay coins.<br />`reqSigs`: `(numeric)` the number of required signatures.<br />`type`: `(string)` the type of the script (e.g. 'pubkeyhash').<br />`addresses`: `(json array of string)` the decred addresses associated with this output.<br />`decredaddress`: `(string)` the decred address<br /><br />**For coinbase transactions**<br />`{"hex": "data", "txid": "hash", "version": n, "locktime": n, "vin": [{ "coinbase": "data", "sequence": n}, ...], "vout": [{"value": n, "n": n,"scriptPubKey": { "asm": "asm","hex": "data", "reqSigs": n,"type": "scripttype", "addresses": [ "decredaddress", ...]}}, ...]}`<br /><br />**For stakebase transactions**<br />`{"hex": "data", "txid": "hash", "version": n, "locktime": n, "vin": [{ "stakebase": "hash", "sequence": n}, ...], "vout": [{"value": n, "n": n,"scriptPubKey": { "asm": "asm","hex": "data", "reqSigs": n,"type": "scripttype", "addresses": [ "decredaddress", ...]}}, ...]}`<br /><br />**For non-coinbase / non-stakebase transactions**<br />`{"hex": "data", "txid": "hash", "version": n, "locktime": n, "vin": [{"txid": "hash","vout": n, "scriptSig": {"asm": "asm", "hex": "data"}, "sequence": n}, ...], "vout": [{"value": n, "n": n,"scriptPubKey": { "asm": "asm","hex": "data", "reqSigs": n,"type": "scripttype", "addresses": [ "decredaddress", ...]}}, ...]}`|
|Returns (verbose=1)|`(json object)`<br />`hex`: `(string)` hex-encoded transaction / hex-encoded bytes of the script.<br />`txid`: `(string)` the hash of the transaction.<br />`version`: `(numeric)` the transaction version.<br />`locktime`: `(numeric)` the transaction lock time.<br />`vin`: `(array of json objects)` the transaction inputs as json objects.<br />`coinbase`: `(string)` the hex-encoded bytes of the signature script.<br />`stakebase`: `(string)` the hash of the stake transaction.<br />`sequence`: `(numeric)` the script sequence number.<br />`txid`: `(string)` the hash of the origin transaction.<br />`vout`: `(numeric)` the index of the output being redeemed from the origin transaction.<br />`scriptSig`: `(json object)` the signature script used to redeem the origin transaction.<br />`asm`: `(string)` disassembly of the script.<br />`sequence`: `(numeric)` the script sequence number.<br />`vout`: `(array of json objects)` the transaction outputs as json objects.<br />`value`: `(numeric)` the value in DCR.<br />`n`: `(numeric)` the index of this transaction output.<br />`scriptPubKey`: `(json object)` the public key script used to pay coins.<br />`reqSigs`: `(numeric)` the number of required signatures.<br />`type`: `(string)` the type of the script (e.g. 'pubkeyhash').<br />`addresses`: `(json array of string)` the Decred addresses associated with this output.<br />`decredaddress`: `(string)` the Decred address<br /><br />**For coinbase transactions**<br />`{"hex": "data", "txid": "hash", "version": n, "locktime": n, "vin": [{ "coinbase": "data", "sequence": n}, ...], "vout": [{"value": n, "n": n,"scriptPubKey": { "asm": "asm","hex": "data", "reqSigs": n,"type": "scripttype", "addresses": [ "decredaddress", ...]}}, ...]}`<br /><br />**For stakebase transactions**<br />`{"hex": "data", "txid": "hash", "version": n, "locktime": n, "vin": [{ "stakebase": "hash", "sequence": n}, ...], "vout": [{"value": n, "n": n,"scriptPubKey": { "asm": "asm","hex": "data", "reqSigs": n,"type": "scripttype", "addresses": [ "decredaddress", ...]}}, ...]}`<br /><br />**For non-coinbase / non-stakebase transactions**<br />`{"hex": "data", "txid": "hash", "version": n, "locktime": n, "vin": [{"txid": "hash","vout": n, "scriptSig": {"asm": "asm", "hex": "data"}, "sequence": n}, ...], "vout": [{"value": n, "n": n,"scriptPubKey": { "asm": "asm","hex": "data", "reqSigs": n,"type": "scripttype", "addresses": [ "decredaddress", ...]}}, ...]}`|
|Example Return (verbose=0)|Newlines added for display purposes. The actual return does not contain newlines.<br />`"010000000104be666c7053ef26c6110597dad1c1e81b5e6be53d17a8b9d0b34772054bac60000000`<br />`008c493046022100cb42f8df44eca83dd0a727988dcde9384953e830b1f8004d57485e2ede1b9c8f`<br />`022100fbce8d84fcf2839127605818ac6c3e7a1531ebc69277c504599289fb1e9058df0141045a33`<br />`76eeb85e494330b03c1791619d53327441002832f4bd618fd9efa9e644d242d5e1145cb9c2f71965`<br />`656e276633d4ff1a6db5e7153a0a9042745178ebe0f5ffffffff0280841e00000000001976a91406`<br />`f1b6703d3f56427bfcfd372f952d50d04b64bd88ac4dd52700000000001976a9146b63f291c295ee`<br />`abd9aee6be193ab2d019e7ea7088ac00000000`|
|Example Return (verbose=1)|**For coinbase transactions**<br />`{"hex": "01000000010000000000000000000000000000000000000000000000000000000000000000f...","txid": "90743aad855880e517270550d2a881627d84db5265142fd1e7fb7add38b08be9","version": 1,"locktime": 0,"vin": [{"coinbase": "03708203062f503253482f04066d605108f800080100000ea2122f6f7a636f696e4065757374726174756d2f","sequence": 0},...], "vout": [{"value": 25.1394,"n": 0, "scriptPubKey": {"asm": "OP_DUP OP_HASH160 ea132286328cfc819457b9dec386c4b5c84faa5c OP_EQUALVERIFY OP_CHECKSIG", "hex": "76a914ea132286328cfc819457b9dec386c4b5c84faa5c88ac", "reqSigs": 1, "type": "pubkeyhash", "addresses": ["1NLg3QJMsMQGM5KEUaEu5ADDmKQSLHwmyh", ...]}}, ...]}`<br /><br />**For stakebase transactions**<br />`{"hex": "01000000010000000000000000000000000000000000000000000000000000000000000000f...","txid": "90743aad855880e517270550d2a881627d84db5265142fd1e7fb7add38b08be9","version": 1,"locktime": 0,"vin": [{"stakebase": "90743aad855880e517270550d2a881627d84db5265142fd1e7fb7add38b08be9","sequence": 0},...], "vout": [{"value": 25.1394,"n": 0, "scriptPubKey": {"asm": "OP_DUP OP_HASH160 ea132286328cfc819457b9dec386c4b5c84faa5c OP_EQUALVERIFY OP_CHECKSIG", "hex": "76a914ea132286328cfc819457b9dec386c4b5c84faa5c88ac", "reqSigs": 1, "type": "pubkeyhash", "addresses": ["1NLg3QJMsMQGM5KEUaEu5ADDmKQSLHwmyh", ...]}}, ...]}`<br /><br />**For non-coinbase / non-stakebase transactions**<br />`{"hex": "01000000010000000000000000000000000000000000000000000000000000000000000000f...","txid": "90743aad855880e517270550d2a881627d84db5265142fd1e7fb7add38b08be9","version": 1,"locktime": 0,"vin": [{"txid": "60ac4b057247b3d0b9a8173de56b5e1be8c1d1da970511c626ef53706c66be04","scriptSig": {"asm": "3046022100cb42f8df44eca83dd0a727988dcde9384953e830b1f8004d57485e2ede1b9c8f0...","hex": "493046022100cb42f8df44eca83dd0a727988dcde9384953e830b1f8004d57485e2ede1b9c8..."}, "sequence": 4294967295}, ...], "vout": [{"value": 25.1394,"n": 0, "scriptPubKey": {"asm": "OP_DUP OP_HASH160 ea132286328cfc819457b9dec386c4b5c84faa5c OP_EQUALVERIFY OP_CHECKSIG", "hex": "76a914ea132286328cfc819457b9dec386c4b5c84faa5c88ac", "reqSigs": 1, "type": "pubkeyhash", "addresses": ["1NLg3QJMsMQGM5KEUaEu5ADDmKQSLHwmyh", ...]}}, ...]}`|
[Return to Overview](#MethodOverview)<br />
@ -573,9 +573,9 @@ the method name for further details such as parameter and return information.
| | |
|---|---|
|Method|validateaddress|
|Parameters|1. `address`: `(string, required)` decred address.|
|Parameters|1. `address`: `(string, required)` Decred address.|
|Description|Verify an address is valid.|
|Returns|`(json object)`<br />`isvalid`: `(bool)` whether or not the address is valid.<br />`address`: `(string)` the decred address validated.<br /><br />`{"isvalid": true or false,"address": "decredaddress"}`|
|Returns|`(json object)`<br />`isvalid`: `(bool)` whether or not the address is valid.<br />`address`: `(string)` the Decred address validated.<br /><br />`{"isvalid": true or false,"address": "decredaddress"}`|
[Return to Overview](#MethodOverview)<br />
***
@ -624,7 +624,7 @@ the method name for further details such as parameter and return information.
|---|---|
|Method|getcurrentnet|
|Parameters|None|
|Description|Get decred network dcrd is running on.|
|Description|Get Decred network dcrd is running on.|
|Returns|`numeric`|
|Example Return|`(mainnet)` `3652501241` <br /> `(testnet)` `118034699` <br /> `(testnet2)` `1223139429` |
[Return to Overview](#ExtMethodOverview)<br />
@ -636,10 +636,10 @@ the method name for further details such as parameter and return information.
| | |
|---|---|
|Method|searchrawtransactions|
|Parameters|1. `address`: `(string, required)` decred address.<br /> 2. `verbose`: `(int, optional, default=true)` specifies the transaction is returned as a JSON object instead of hex-encoded string.<br />3. `skip`: `(int, optional, default=0)` the number of leading transactions to leave out of the final response.<br /> 4. `count`: `(int, optional, default=100)` the maximum number of transactions to return.<br /> 5. `vinextra`: `(int, optional, default=0)` specify that extra data from previous output will be returned in vin.|
|Parameters|1. `address`: `(string, required)` Decred address.<br /> 2. `verbose`: `(int, optional, default=true)` specifies the transaction is returned as a JSON object instead of hex-encoded string.<br />3. `skip`: `(int, optional, default=0)` the number of leading transactions to leave out of the final response.<br /> 4. `count`: `(int, optional, default=100)` the maximum number of transactions to return.<br /> 5. `vinextra`: `(int, optional, default=0)` specify that extra data from previous output will be returned in vin.|
|Description|Returns raw data for transactions involving the passed address. Returned transactions are pulled from both the database, and transactions currently in the mempool. Transactions pulled from the mempool will have the `"confirmations"` field set to 0. Usage of this RPC requires the optional `--addrindex` flag to be activated, otherwise all responses will simply return with an error stating the address index has not yet been built up. Similarly, until the address index has caught up with the current best height, all requests will return an error response in order to avoid serving stale data.|
|Returns (verbose=0)|`(json array of strings)`<br />`serializedtx`: `(string)` hex-encoded bytes of the serialized transaction.<br />`["serializedtx", ... ]` |
|Returns (verbose=1)|`(array of json objects)`<br/>`hex`: `(string)` hex-encoded transaction.<br />`txid`: `(string)` the hash of the transaction.<br />`version`: `(numeric)` the transaction version.<br />`locktime`: `(numeric)` the transaction lock time.<br />`vin`: `(json array)` the transaction inputs as json objects.<br />`coinbase`: `(string)` the hex-encoded bytes of the signature script.<br />`stakebase`: `(string)` the hash of the stake transaction.<br />`sequence`: `(numeric)` the script sequence number.<br />`txid`: `(string)` the hash of the origin transaction.<br />`vout`: `(numeric)` the index of the output being redeemed from the origin transaction.<br />`scriptSig`: `(json object)` the signature script used to redeem the origin transaction.<br />`asm`: `(string)` disassembly of the script.<br />`hex`: `(string)` hex-encoded bytes of the script.<br />`prevOut`: Data from the origin transaction output with index vout.<br />`addresses`: `(array of string)` previous output addresses.<br />`value`: `(numeric)` previous output value.<br />`sequence`: `(numeric)` the script sequence number.<br />`vout`: `(array of json objects)` the transaction outputs as json objects.<br />`value`: `(numeric)` the value in DCR.<br />`n`: `(numeric)` the index of this transaction output.<br />`scriptPubKey`: `(json object)` the public key script used to pay coins.<br />`asm`: `(string)` disassembly of the script.<br />`hex`: `(string)` hex-encoded bytes of the script.<br />`reqSigs`: `(numeric)` the number of required signatures.<br />`type`: `(string)` the type of the script (e.g. 'pubkeyhash').<br />`addresses`: `(json array of string)` the decred addresses associated with this output.<br />`address`: `(string)` the decred address.<br />`blockhash`: `(string)` hash of the block the transaction is part of.<br />`confirmations`: `(numeric)` number of numeric confirmations of block.<br /> `time`: `(numeric)` transaction time in seconds since the epoch.<br />`blocktime`: `(numeric)` block time in seconds since the epoch.<br/><br />**For coinbase transactions**<br />`[{"hex": "data", "txid": "hash", "version": n, "locktime": n,"vin": [{"coinbase": "data", "sequence": n},{"txid": "hash", "vout": n, "scriptSig": {"asm": "asm", "hex": "data"}, "prevOut": {"addresses": ["value", ...], "value": n.nnn}, "sequence": n}, ...],"vout": [{ "value": n,"n": n, "scriptPubKey": {"asm": "asm", "hex": "data", "reqSigs": n, "type": "scripttype", "addresses": ["address", ...]}}, ...], "blockhash":"hash", "confirmations":n, "time":t, "blocktime":t },...]`<br /><br />**For stakebase transactions**<br />`[{"hex": "data", "txid": "hash", "version": n, "locktime": n,"vin": [{"stakebase": "hash", "sequence": n},{"txid": "hash", "vout": n, "scriptSig": {"asm": "asm", "hex": "data"}, "prevOut": {"addresses": ["value", ...], "value": n.nnn}, "sequence": n}, ...],"vout": [{ "value": n,"n": n, "scriptPubKey": {"asm": "asm", "hex": "data", "reqSigs": n, "type": "scripttype", "addresses": ["address", ...]}}, ...], "blockhash":"hash", "confirmations":n, "time":t, "blocktime":t },...]`<br /><br />**For non-coinbase / non-stakebase transactions**<br />`[{"hex": "data", "txid": "hash", "version": n, "locktime": n,"vin": [{"txid": "hash", "vout": n, "scriptSig": {"asm": "asm", "hex": "data"}, "prevOut": {"addresses": ["value",...], "value": n.nnn}, "sequence": n}, ...],"vout": [{ "value": n,"n": n, "scriptPubKey": {"asm": "asm", "hex": "data", "reqSigs": n, "type": "scripttype", "addresses": ["address", ...]}}, ...], "blockhash":"hash", "confirmations":n, "time":t, "blocktime":t },...]`|
|Returns (verbose=1)|`(array of json objects)`<br/>`hex`: `(string)` hex-encoded transaction.<br />`txid`: `(string)` the hash of the transaction.<br />`version`: `(numeric)` the transaction version.<br />`locktime`: `(numeric)` the transaction lock time.<br />`vin`: `(json array)` the transaction inputs as json objects.<br />`coinbase`: `(string)` the hex-encoded bytes of the signature script.<br />`stakebase`: `(string)` the hash of the stake transaction.<br />`sequence`: `(numeric)` the script sequence number.<br />`txid`: `(string)` the hash of the origin transaction.<br />`vout`: `(numeric)` the index of the output being redeemed from the origin transaction.<br />`scriptSig`: `(json object)` the signature script used to redeem the origin transaction.<br />`asm`: `(string)` disassembly of the script.<br />`hex`: `(string)` hex-encoded bytes of the script.<br />`prevOut`: Data from the origin transaction output with index vout.<br />`addresses`: `(array of string)` previous output addresses.<br />`value`: `(numeric)` previous output value.<br />`sequence`: `(numeric)` the script sequence number.<br />`vout`: `(array of json objects)` the transaction outputs as json objects.<br />`value`: `(numeric)` the value in DCR.<br />`n`: `(numeric)` the index of this transaction output.<br />`scriptPubKey`: `(json object)` the public key script used to pay coins.<br />`asm`: `(string)` disassembly of the script.<br />`hex`: `(string)` hex-encoded bytes of the script.<br />`reqSigs`: `(numeric)` the number of required signatures.<br />`type`: `(string)` the type of the script (e.g. 'pubkeyhash').<br />`addresses`: `(json array of string)` the Decred addresses associated with this output.<br />`address`: `(string)` the Decred address.<br />`blockhash`: `(string)` hash of the block the transaction is part of.<br />`confirmations`: `(numeric)` number of numeric confirmations of block.<br /> `time`: `(numeric)` transaction time in seconds since the epoch.<br />`blocktime`: `(numeric)` block time in seconds since the epoch.<br/><br />**For coinbase transactions**<br />`[{"hex": "data", "txid": "hash", "version": n, "locktime": n,"vin": [{"coinbase": "data", "sequence": n},{"txid": "hash", "vout": n, "scriptSig": {"asm": "asm", "hex": "data"}, "prevOut": {"addresses": ["value", ...], "value": n.nnn}, "sequence": n}, ...],"vout": [{ "value": n,"n": n, "scriptPubKey": {"asm": "asm", "hex": "data", "reqSigs": n, "type": "scripttype", "addresses": ["address", ...]}}, ...], "blockhash":"hash", "confirmations":n, "time":t, "blocktime":t },...]`<br /><br />**For stakebase transactions**<br />`[{"hex": "data", "txid": "hash", "version": n, "locktime": n,"vin": [{"stakebase": "hash", "sequence": n},{"txid": "hash", "vout": n, "scriptSig": {"asm": "asm", "hex": "data"}, "prevOut": {"addresses": ["value", ...], "value": n.nnn}, "sequence": n}, ...],"vout": [{ "value": n,"n": n, "scriptPubKey": {"asm": "asm", "hex": "data", "reqSigs": n, "type": "scripttype", "addresses": ["address", ...]}}, ...], "blockhash":"hash", "confirmations":n, "time":t, "blocktime":t },...]`<br /><br />**For non-coinbase / non-stakebase transactions**<br />`[{"hex": "data", "txid": "hash", "version": n, "locktime": n,"vin": [{"txid": "hash", "vout": n, "scriptSig": {"asm": "asm", "hex": "data"}, "prevOut": {"addresses": ["value",...], "value": n.nnn}, "sequence": n}, ...],"vout": [{ "value": n,"n": n, "scriptPubKey": {"asm": "asm", "hex": "data", "reqSigs": n, "type": "scripttype", "addresses": ["address", ...]}}, ...], "blockhash":"hash", "confirmations":n, "time":t, "blocktime":t },...]`|
[Return to Overview](#ExtMethodOverview)<br />
***
@ -750,7 +750,7 @@ user. Click the method name for further details such as parameter and return in
|---|---|
|Method|notifyreceived|
|Notifications|[recvtx](#recvtx) and [redeemingtx](#redeemingtx)|
|Parameters|1. `Addresses`: `(JSON array, required)`<br />`decredaddress`: `(string)` the decred address.<br /><br />`["decredaddress", ...]`|
|Parameters|1. `Addresses`: `(JSON array, required)`<br />`decredaddress`: `(string)` the Decred address.<br /><br />`["decredaddress", ...]`|
|Description|Send a recvtx notification when a transaction added to mempool or appears in a newly-attached block contains a txout pkScript sending to any of the passed addresses. Matching outpoints are automatically registered for redeemingtx notifications.|
|Returns|Nothing|
[Return to Overview](#WSMethodOverview)<br />
@ -763,7 +763,7 @@ user. Click the method name for further details such as parameter and return in
|---|---|
|Method|stopnotifyreceived|
|Notifications|None|
|Parameters|1. `Addresses`: `(JSON array, required)`<br />`decredaddress`: `(string)` the decred address.<br /><br />`["decredaddress", ...]`|
|Parameters|1. `Addresses`: `(JSON array, required)`<br />`decredaddress`: `(string)` the Decred address.<br /><br />`["decredaddress", ...]`|
|Description|Cancel registered receive notifications for each passed address.|
|Returns|Nothing|
[Return to Overview](#WSMethodOverview)<br />

View File

@ -4,7 +4,7 @@
// license that can be found in the LICENSE file.
/*
Package hdkeychain provides an API for decred hierarchical deterministic
Package hdkeychain provides an API for Decred hierarchical deterministic
extended keys (based on BIP0032).
Overview

View File

@ -118,7 +118,7 @@ func Example_defaultWalletLayout() {
}
// Get and show the address associated with the extended keys for the
// main decred network.
// main Decred network.
acct0ExtAddr, err := acct0Ext10.Address(&chaincfg.MainNetParams)
if err != nil {
fmt.Println(err)

View File

@ -354,7 +354,7 @@ func (k *ExtendedKey) ECPrivKey() (chainec.PrivateKey, error) {
return privKey, nil
}
// Address converts the extended key to a standard decred pay-to-pubkey-hash
// Address converts the extended key to a standard Decred pay-to-pubkey-hash
// address for the passed network.
func (k *ExtendedKey) Address(net *chaincfg.Params) (*dcrutil.AddressPubKeyHash, error) {
pkHash := dcrutil.Hash160(k.pubKeyBytes())
@ -403,7 +403,7 @@ func (k *ExtendedKey) String() (string, error) {
}
// IsForNet returns whether or not the extended key is associated with the
// passed decred network.
// passed Decred network.
func (k *ExtendedKey) IsForNet(net *chaincfg.Params) bool {
return bytes.Equal(k.version, net.HDPrivateKeyID[:]) ||
bytes.Equal(k.version, net.HDPublicKeyID[:])

View File

@ -1,5 +1,5 @@
// Copyright (c) 2013-2016 The btcsuite developers
// Copyright (c) 2016 The decred developers
// Copyright (c) 2016 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

View File

@ -11,7 +11,7 @@ import (
)
// activeNetParams is a pointer to the parameters specific to the
// currently active decred network.
// currently active Decred network.
var activeNetParams = &mainNetParams
// params is used to group parameters for various networks such as the main
@ -46,7 +46,7 @@ var simNetParams = params{
rpcPort: "19556",
}
// netName returns the name used when referring to a decred network. At the
// netName returns the name used when referring to a Decred network. At the
// time of writing, dcrd currently places blocks for testnet version 0 in the
// data and log directory "testnet", which does not match the Name field of the
// chaincfg parameters. This function can be used to override this directory name

View File

@ -10,16 +10,16 @@ peers.
Overview
This package builds upon the wire package, which provides the fundamental
primitives necessary to speak the decred wire protocol, in order to simplify
primitives necessary to speak the Decred wire protocol, in order to simplify
the process of creating fully functional peers. In essence, it provides a
common base for creating concurrent safe fully validating nodes, Simplified
Payment Verification (SPV) nodes, proxies, etc.
A quick overview of the major features peer provides are as follows:
- Provides a basic concurrent safe decred peer for handling decred
- Provides a basic concurrent safe Decred peer for handling decred
communications via the peer-to-peer protocol
- Full duplex reading and writing of decred protocol messages
- Full duplex reading and writing of Decred protocol messages
- Automatic handling of the initial handshake process including protocol
version negotiation
- Asynchronous message queuing of outbound messages with optional channel for
@ -32,7 +32,7 @@ A quick overview of the major features peer provides are as follows:
- Decred network
- Service support signalling (full nodes, bloom filters, etc)
- Maximum supported protocol version
- Ability to register callbacks for handling decred protocol messages
- Ability to register callbacks for handling Decred protocol messages
- Inventory message batching and send trickling with known inventory detection
and avoidance
- Automatic periodic keep-alive pinging and pong responses

View File

@ -370,13 +370,13 @@ type HostToNetAddrFunc func(host string, port uint16,
// It acts as the traffic cop between the external world and the actual
// goroutine which writes to the network socket.
// Peer provides a basic concurrent safe decred peer for handling decred
// Peer provides a basic concurrent safe Decred peer for handling decred
// communications via the peer-to-peer protocol. It provides full duplex
// reading and writing, automatic handling of the initial handshake process,
// querying of usage statistics and other information about the remote peer such
// as its address, user agent, and protocol version, output message queuing,
// inventory trickling, and the ability to dynamically register and unregister
// callbacks for handling decred protocol messages.
// callbacks for handling Decred protocol messages.
//
// Outbound messages are typically queued via QueueMessage or QueueInventory.
// QueueMessage is intended for all messages, including responses to data such
@ -2017,7 +2017,7 @@ func (p *Peer) negotiateOutboundProtocol() error {
return p.readRemoteVersionMsg()
}
// newPeerBase returns a new base decred peer based on the inbound flag. This
// newPeerBase returns a new base Decred peer based on the inbound flag. This
// is used by the NewInboundPeer and NewOutboundPeer functions to perform base
// setup needed by both types of peers.
func newPeerBase(cfg *Config, inbound bool) *Peer {
@ -2052,13 +2052,13 @@ func newPeerBase(cfg *Config, inbound bool) *Peer {
return &p
}
// NewInboundPeer returns a new inbound decred peer. Use Start to begin
// NewInboundPeer returns a new inbound Decred peer. Use Start to begin
// processing incoming and outgoing messages.
func NewInboundPeer(cfg *Config) *Peer {
return newPeerBase(cfg, true)
}
// NewOutboundPeer returns a new outbound decred peer.
// NewOutboundPeer returns a new outbound Decred peer.
func NewOutboundPeer(cfg *Config, addr string) (*Peer, error) {
p := newPeerBase(cfg, false)
p.addr = addr

View File

@ -1014,7 +1014,7 @@ func (r FutureSessionResult) Receive() (*dcrjson.SessionResult, error) {
//
// See Session for the blocking version and more details.
//
// NOTE: This is a decred extension.
// NOTE: This is a Decred extension.
func (c *Client) SessionAsync() FutureSessionResult {
// Not supported in HTTP POST mode.
if c.config.HTTPPostMode {
@ -1029,7 +1029,7 @@ func (c *Client) SessionAsync() FutureSessionResult {
//
// This RPC requires the client to be running in websocket mode.
//
// NOTE: This is a decred extension.
// NOTE: This is a Decred extension.
func (c *Client) Session() (*dcrjson.SessionResult, error) {
return c.SessionAsync().Receive()
}
@ -1062,7 +1062,7 @@ func (r FutureTicketFeeInfoResult) Receive() (*dcrjson.TicketFeeInfoResult, erro
//
// See TicketFeeInfo for the blocking version and more details.
//
// NOTE: This is a decred extension.
// NOTE: This is a Decred extension.
func (c *Client) TicketFeeInfoAsync(blocks *uint32, windows *uint32) FutureTicketFeeInfoResult {
// Not supported in HTTP POST mode.
if c.config.HTTPPostMode {
@ -1086,7 +1086,7 @@ func (c *Client) TicketFeeInfoAsync(blocks *uint32, windows *uint32) FutureTicke
//
// This RPC requires the client to be running in websocket mode.
//
// NOTE: This is a decred extension.
// NOTE: This is a Decred extension.
func (c *Client) TicketFeeInfo(blocks *uint32, windows *uint32) (*dcrjson.TicketFeeInfoResult, error) {
return c.TicketFeeInfoAsync(blocks, windows).Receive()
}
@ -1124,7 +1124,7 @@ func (r FutureTicketVWAPResult) Receive() (dcrutil.Amount, error) {
//
// See TicketVWAP for the blocking version and more details.
//
// NOTE: This is a decred extension.
// NOTE: This is a Decred extension.
func (c *Client) TicketVWAPAsync(start *uint32, end *uint32) FutureTicketVWAPResult {
// Not supported in HTTP POST mode.
if c.config.HTTPPostMode {
@ -1139,7 +1139,7 @@ func (c *Client) TicketVWAPAsync(start *uint32, end *uint32) FutureTicketVWAPRes
//
// This RPC requires the client to be running in websocket mode.
//
// NOTE: This is a decred extension.
// NOTE: This is a Decred extension.
func (c *Client) TicketVWAP(start *uint32, end *uint32) (dcrutil.Amount, error) {
return c.TicketVWAPAsync(start, end).Receive()
}
@ -1172,7 +1172,7 @@ func (r FutureTxFeeInfoResult) Receive() (*dcrjson.TxFeeInfoResult, error) {
//
// See TxFeeInfo for the blocking version and more details.
//
// NOTE: This is a decred extension.
// NOTE: This is a Decred extension.
func (c *Client) TxFeeInfoAsync(blocks *uint32, start *uint32, end *uint32) FutureTxFeeInfoResult {
// Not supported in HTTP POST mode.
if c.config.HTTPPostMode {
@ -1187,7 +1187,7 @@ func (c *Client) TxFeeInfoAsync(blocks *uint32, start *uint32, end *uint32) Futu
//
// This RPC requires the client to be running in websocket mode.
//
// NOTE: This is a decred extension.
// NOTE: This is a Decred extension.
func (c *Client) TxFeeInfo(blocks *uint32, start *uint32, end *uint32) (*dcrjson.TxFeeInfoResult, error) {
return c.TxFeeInfoAsync(blocks, start, end).Receive()
}

View File

@ -449,7 +449,7 @@ func (c *Client) SubmitBlockAsync(block *dcrutil.Block, options *dcrjson.SubmitB
return c.sendCmd(cmd)
}
// SubmitBlock attempts to submit a new block into the decred network.
// SubmitBlock attempts to submit a new block into the Decred network.
func (c *Client) SubmitBlock(block *dcrutil.Block, options *dcrjson.SubmitBlockOptions) error {
return c.SubmitBlockAsync(block, options).Receive()
}

View File

@ -1587,7 +1587,7 @@ func (c *Client) RenameAccount(oldAccount, newAccount string) error {
type FutureValidateAddressResult chan *response
// Receive waits for the response promised by the future and returns information
// about the given decred address.
// about the given Decred address.
func (r FutureValidateAddressResult) Receive() (*dcrjson.ValidateAddressWalletResult, error) {
res, err := receiveFuture(r)
if err != nil {
@ -1615,7 +1615,7 @@ func (c *Client) ValidateAddressAsync(address dcrutil.Address) FutureValidateAdd
return c.sendCmd(cmd)
}
// ValidateAddress returns information about the given decred address.
// ValidateAddress returns information about the given Decred address.
func (c *Client) ValidateAddress(address dcrutil.Address) (*dcrjson.ValidateAddressWalletResult, error) {
return c.ValidateAddressAsync(address).Receive()
}

View File

@ -1783,7 +1783,7 @@ func handleGenerate(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (i
func handleGetAddedNodeInfo(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*dcrjson.GetAddedNodeInfoCmd)
// Retrieve a list of persistent (added) peers from the decred server
// Retrieve a list of persistent (added) peers from the Decred server
// and filter the list of peers per the specified address (if any).
peers := s.server.AddedNodeInfo()
if c.Node != nil {

View File

@ -131,7 +131,7 @@ var helpDescsEnUS = map[string]string{
"scriptpubkeyresult-hex": "Hex-encoded bytes of the script",
"scriptpubkeyresult-reqSigs": "The number of required signatures",
"scriptpubkeyresult-type": "The type of the script (e.g. 'pubkeyhash')",
"scriptpubkeyresult-addresses": "The decred addresses associated with this script",
"scriptpubkeyresult-addresses": "The Decred addresses associated with this script",
"scriptpubkeyresult-commitamt": "The ticket commitment value if the script is for a staking commitment",
// Vout help.
@ -156,7 +156,7 @@ var helpDescsEnUS = map[string]string{
"decodescriptresult-asm": "Disassembly of the script",
"decodescriptresult-reqSigs": "The number of required signatures",
"decodescriptresult-type": "The type of the script (e.g. 'pubkeyhash')",
"decodescriptresult-addresses": "The decred addresses associated with this script",
"decodescriptresult-addresses": "The Decred addresses associated with this script",
"decodescriptresult-p2sh": "The script hash for use in pay-to-script-hash transactions (only present if the provided redeem script is not already a pay-to-script-hash script)",
// DecodeScriptCmd help.
@ -430,7 +430,7 @@ var helpDescsEnUS = map[string]string{
"getconnectioncount--result0": "The number of connections",
// GetCurrentNetCmd help.
"getcurrentnet--synopsis": "Get decred network the server is running on.",
"getcurrentnet--synopsis": "Get Decred network the server is running on.",
"getcurrentnet--result0": "The network identifer",
// GetDifficultyCmd help.
@ -519,7 +519,7 @@ var helpDescsEnUS = map[string]string{
"infowalletresult-version": "The version of the server",
"infowalletresult-protocolversion": "The latest supported protocol version",
"infowalletresult-walletversion": "The version of the wallet server",
"infowalletresult-balance": "The total decred balance of the wallet",
"infowalletresult-balance": "The total Decred balance of the wallet",
"infowalletresult-blocks": "The number of blocks processed",
"infowalletresult-timeoffset": "The time offset",
"infowalletresult-connections": "The number of connected peers",
@ -724,7 +724,7 @@ var helpDescsEnUS = map[string]string{
// ValidateAddressResult help.
"validateaddresschainresult-isvalid": "Whether or not the address is valid",
"validateaddresschainresult-address": "The decred address (only when isvalid is true)",
"validateaddresschainresult-address": "The Decred address (only when isvalid is true)",
// ValidateAddressCmd help.
"validateaddress--synopsis": "Verify an address is valid.",
@ -742,7 +742,7 @@ var helpDescsEnUS = map[string]string{
// VerifyMessageCmd help.
"verifymessage--synopsis": "Verify a signed message.",
"verifymessage-address": "The decred address to use for the signature",
"verifymessage-address": "The Decred address to use for the signature",
"verifymessage-signature": "The base-64 encoded signature provided by the signer",
"verifymessage-message": "The signed message",
"verifymessage--result0": "Whether or not the signature verified",

View File

@ -59,7 +59,7 @@ const (
var (
// userAgentName is the user agent name and is used to help identify
// ourselves to other decred peers.
// ourselves to other Decred peers.
userAgentName = "dcrd"
// userAgentVersion is the user agent version and is used to help
@ -67,7 +67,7 @@ var (
userAgentVersion = fmt.Sprintf("%d.%d.%d", appMajor, appMinor, appPatch)
)
// broadcastMsg provides the ability to house a decred message to be broadcast
// broadcastMsg provides the ability to house a Decred message to be broadcast
// to all connected peers except specified excluded peers.
type broadcastMsg struct {
message wire.Message
@ -137,8 +137,8 @@ func (ps *peerState) forAllPeers(closure func(sp *serverPeer)) {
ps.forAllOutboundPeers(closure)
}
// server provides a decred server for handling communications to and from
// decred peers.
// server provides a Decred server for handling communications to and from
// Decred peers.
type server struct {
// The following variables must only be used atomically.
// Putting the uint64s first makes them 64-bit aligned for 32-bit systems.
@ -2232,7 +2232,7 @@ func standardScriptVerifyFlags(chain *blockchain.BlockChain) (txscript.ScriptFla
}
// newServer returns a new dcrd server configured to listen on addr for the
// decred network type specified by chainParams. Use start to begin accepting
// Decred network type specified by chainParams. Use start to begin accepting
// connections from peers.
func newServer(listenAddrs []string, db database.DB, chainParams *chaincfg.Params, interrupt <-chan struct{}) (*server, error) {
services := defaultServices

View File

@ -26,7 +26,7 @@ const (
svcDisplayName = "Dcrd Service"
// svcDesc is the description of the service.
svcDesc = "Downloads and stays synchronized with the decred block " +
svcDesc = "Downloads and stays synchronized with the Decred block " +
"chain and provides chain services to applications."
)

View File

@ -5,16 +5,16 @@ txscript
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/decred/dcrd/txscript)
Package txscript implements the decred transaction script language. There is
Package txscript implements the Decred transaction script language. There is
a comprehensive test suite.
This package has intentionally been designed so it can be used as a standalone
package for any projects needing to use or validate decred transaction scripts.
package for any projects needing to use or validate Decred transaction scripts.
## Decred Scripts
Decred provides a stack-based, FORTH-like language for the scripts in
the decred transactions. This language is not turing complete
the Decred transactions. This language is not turing complete
although it is still fairly powerful.
## Installation and Updating
@ -26,7 +26,7 @@ $ go get -u github.com/decred/dcrd/txscript
## Examples
* [Standard Pay-to-pubkey-hash Script](http://godoc.org/github.com/decred/dcrd/txscript#example-PayToAddrScript)
Demonstrates creating a script which pays to a decred address. It also
Demonstrates creating a script which pays to a Decred address. It also
prints the created script hex and uses the DisasmString function to display
the disassembled script.

View File

@ -4,7 +4,7 @@
// license that can be found in the LICENSE file.
/*
Package txscript implements the decred transaction script language.
Package txscript implements the Decred transaction script language.
This package provides data structures and functions to parse and execute
decred transaction scripts.
@ -13,7 +13,7 @@ Script Overview
Decred transaction scripts are written in a stack-base, FORTH-like language.
The decred script language consists of a number of opcodes which fall into
The Decred script language consists of a number of opcodes which fall into
several categories such pushing and popping data to and from the stack,
performing basic and bitwise arithmetic, conditional branching, comparing
hashes, and checking cryptographic signatures. Scripts are processed from left

View File

@ -21,7 +21,7 @@ var secp = 0
var edwards = 1
var secSchnorr = 2
// This example demonstrates creating a script which pays to a decred address.
// This example demonstrates creating a script which pays to a Decred address.
// It also prints the created script hex and uses the DisasmString function to
// display the disassembled script.
func ExamplePayToAddrScript() {

View File

@ -295,7 +295,7 @@ func TestRemoveOpcodeByData(t *testing.T) {
remove: []byte{1, 2, 3, 5},
after: []byte{txscript.OP_DATA_4, 1, 2, 3, 4},
},
// fix to allow for decred tests too
// fix to allow for Decred tests too
/*
{
name: "stakesubmission",

View File

@ -644,8 +644,8 @@ func TestPayToAddrScript(t *testing.T) {
"f9137f23c2c409273eb16e65 CHECKSIG",
nil,
},
// pay-to-pubkey address on mainnet. for decred this would
// be uncompressed, but standard for decred is 33 byte
// pay-to-pubkey address on mainnet. for Decred this would
// be uncompressed, but standard for Decred is 33 byte
// compressed public keys.
{
p2pkUncompressedMain,

View File

@ -5,11 +5,11 @@ wire
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/decred/dcrd/wire)
Package wire implements the decred wire protocol. A comprehensive suite of
Package wire implements the Decred wire protocol. A comprehensive suite of
tests with 100% test coverage is provided to ensure proper functionality.
This package has intentionally been designed so it can be used as a standalone
package for any projects needing to interface with decred peers at the wire
package for any projects needing to interface with Decred peers at the wire
protocol level.
## Installation and Updating
@ -20,34 +20,34 @@ $ go get -u github.com/decred/dcrd/wire
## Decred Message Overview
The decred protocol consists of exchanging messages between peers. Each message
The Decred protocol consists of exchanging messages between peers. Each message
is preceded by a header which identifies information about it such as which
decred network it is a part of, its type, how big it is, and a checksum to
verify validity. All encoding and decoding of message headers is handled by this
package.
To accomplish this, there is a generic interface for decred messages named
To accomplish this, there is a generic interface for Decred messages named
`Message` which allows messages of any type to be read, written, or passed
around through channels, functions, etc. In addition, concrete implementations
of most of the currently supported decred messages are provided. For these
of most of the currently supported Decred messages are provided. For these
supported messages, all of the details of marshalling and unmarshalling to and
from the wire using decred encoding are handled so the caller doesn't have to
from the wire using Decred encoding are handled so the caller doesn't have to
concern themselves with the specifics.
## Reading Messages Example
In order to unmarshal decred messages from the wire, use the `ReadMessage`
In order to unmarshal Decred messages from the wire, use the `ReadMessage`
function. It accepts any `io.Reader`, but typically this will be a `net.Conn`
to a remote node running a decred peer. Example syntax is:
to a remote node running a Decred peer. Example syntax is:
```Go
// Use the most recent protocol version supported by the package and the
// main decred network.
// main Decred network.
pver := wire.ProtocolVersion
dcrnet := wire.MainNet
// Reads and validates the next decred message from conn using the
// protocol version pver and the decred network dcrnet. The returns
// Reads and validates the next Decred message from conn using the
// protocol version pver and the Decred network dcrnet. The returns
// are a wire.Message, a []byte which contains the unmarshalled
// raw payload, and a possible error.
msg, rawPayload, err := wire.ReadMessage(conn, pver, dcrnet)
@ -60,22 +60,22 @@ See the package documentation for details on determining the message type.
## Writing Messages Example
In order to marshal decred messages to the wire, use the `WriteMessage`
In order to marshal Decred messages to the wire, use the `WriteMessage`
function. It accepts any `io.Writer`, but typically this will be a `net.Conn`
to a remote node running a decred peer. Example syntax to request addresses
to a remote node running a Decred peer. Example syntax to request addresses
from a remote peer is:
```Go
// Use the most recent protocol version supported by the package and the
// main decred network.
// main Decred network.
pver := wire.ProtocolVersion
dcrnet := wire.MainNet
// Create a new getaddr decred message.
// Create a new getaddr Decred message.
msg := wire.NewMsgGetAddr()
// Writes a decred message msg to conn using the protocol version
// pver, and the decred network dcrnet. The return is a possible
// Writes a Decred message msg to conn using the protocol version
// pver, and the Decred network dcrnet. The return is a possible
// error.
err := wire.WriteMessage(conn, msg, pver, dcrnet)
if err != nil {

View File

@ -185,7 +185,7 @@ func NewBlockHeader(version int32, prevHash *chainhash.Hash,
}
}
// readBlockHeader reads a decred block header from r. See Deserialize for
// readBlockHeader reads a Decred block header from r. See Deserialize for
// decoding block headers stored to disk, such as in a database, as opposed to
// decoding from the wire.
func readBlockHeader(r io.Reader, pver uint32, bh *BlockHeader) error {
@ -196,7 +196,7 @@ func readBlockHeader(r io.Reader, pver uint32, bh *BlockHeader) error {
&bh.Nonce, &bh.ExtraData, &bh.StakeVersion)
}
// writeBlockHeader writes a decred block header to w. See Serialize for
// writeBlockHeader writes a Decred block header to w. See Serialize for
// encoding block headers to be stored to disk, such as in a database, as
// opposed to encoding for the wire.
func writeBlockHeader(w io.Writer, pver uint32, bh *BlockHeader) error {

View File

@ -4,39 +4,39 @@
// license that can be found in the LICENSE file.
/*
Package wire implements the decred wire protocol.
Package wire implements the Decred wire protocol.
For the complete details of the decred protocol, see the official wiki entry
For the complete details of the Decred protocol, see the official wiki entry
at https://en.bitcoin.it/wiki/Protocol_specification. The following only serves
as a quick overview to provide information on how to use the package.
At a high level, this package provides support for marshalling and unmarshalling
supported decred messages to and from the wire. This package does not deal
supported Decred messages to and from the wire. This package does not deal
with the specifics of message handling such as what to do when a message is
received. This provides the caller with a high level of flexibility.
Decred Message Overview
The decred protocol consists of exchanging messages between peers. Each
The Decred protocol consists of exchanging messages between peers. Each
message is preceded by a header which identifies information about it such as
which decred network it is a part of, its type, how big it is, and a checksum
which Decred network it is a part of, its type, how big it is, and a checksum
to verify validity. All encoding and decoding of message headers is handled by
this package.
To accomplish this, there is a generic interface for decred messages named
To accomplish this, there is a generic interface for Decred messages named
Message which allows messages of any type to be read, written, or passed around
through channels, functions, etc. In addition, concrete implementations of most
of the currently supported decred messages are provided. For these supported
of the currently supported Decred messages are provided. For these supported
messages, all of the details of marshalling and unmarshalling to and from the
wire using decred encoding are handled so the caller doesn't have to concern
wire using Decred encoding are handled so the caller doesn't have to concern
themselves with the specifics.
Message Interaction
The following provides a quick summary of how the decred messages are intended
The following provides a quick summary of how the Decred messages are intended
to interact with one another. As stated above, these interactions are not
directly handled by this package. For more in-depth details about the
appropriate interactions, see the official decred protocol wiki entry at
appropriate interactions, see the official Decred protocol wiki entry at
https://en.bitcoin.it/wiki/Protocol_specification.
The initial handshake consists of two peers sending each other a version message
@ -66,7 +66,7 @@ interactions in no particular order.
Common Parameters
There are several common parameters that arise when using this package to read
and write decred messages. The following sections provide a quick overview of
and write Decred messages. The following sections provide a quick overview of
these parameters so the next sections can build on them.
Protocol Version
@ -80,8 +80,8 @@ negotiated.
Decred Network
The decred network is a magic number which is used to identify the start of a
message and which decred network the message applies to. This package provides
The Decred network is a magic number which is used to identify the start of a
message and which Decred network the message applies to. This package provides
the following constants:
wire.MainNet
@ -90,8 +90,8 @@ the following constants:
Determining Message Type
As discussed in the decred message overview section, this package reads
and writes decred messages using a generic interface named Message. In
As discussed in the Decred message overview section, this package reads
and writes Decred messages using a generic interface named Message. In
order to determine the actual concrete type of the message, use a type
switch or type assertion. An example of a type switch follows:
@ -108,12 +108,12 @@ switch or type assertion. An example of a type switch follows:
Reading Messages
In order to unmarshall decred messages from the wire, use the ReadMessage
In order to unmarshall Decred messages from the wire, use the ReadMessage
function. It accepts any io.Reader, but typically this will be a net.Conn to
a remote node running a decred peer. Example syntax is:
a remote node running a Decred peer. Example syntax is:
// Reads and validates the next decred message from conn using the
// protocol version pver and the decred network btcnet. The returns
// Reads and validates the next Decred message from conn using the
// protocol version pver and the Decred network btcnet. The returns
// are a wire.Message, a []byte which contains the unmarshalled
// raw payload, and a possible error.
msg, rawPayload, err := wire.ReadMessage(conn, pver, btcnet)
@ -123,16 +123,16 @@ a remote node running a decred peer. Example syntax is:
Writing Messages
In order to marshall decred messages to the wire, use the WriteMessage
In order to marshall Decred messages to the wire, use the WriteMessage
function. It accepts any io.Writer, but typically this will be a net.Conn to
a remote node running a decred peer. Example syntax to request addresses
a remote node running a Decred peer. Example syntax to request addresses
from a remote peer is:
// Create a new getaddr decred message.
// Create a new getaddr Decred message.
msg := wire.NewMsgGetAddr()
// Writes a decred message msg to conn using the protocol version
// pver, and the decred network btcnet. The return is a possible
// Writes a Decred message msg to conn using the protocol version
// pver, and the Decred network btcnet. The return is a possible
// error.
err := wire.WriteMessage(conn, msg, pver, btcnet)
if err != nil {

View File

@ -14,7 +14,7 @@ import (
const (
// MaxInvPerMsg is the maximum number of inventory vectors that can be in a
// single decred inv message.
// single Decred inv message.
MaxInvPerMsg = 50000
// Maximum payload size for an inventory vector.
@ -49,7 +49,7 @@ func (invtype InvType) String() string {
return fmt.Sprintf("Unknown InvType (%d)", uint32(invtype))
}
// InvVect defines a decred inventory vector which is used to describe data,
// InvVect defines a Decred inventory vector which is used to describe data,
// as specified by the Type field, that a peer wants, has, or does not have to
// another peer.
type InvVect struct {

View File

@ -14,12 +14,12 @@ import (
"github.com/decred/dcrd/chaincfg/chainhash"
)
// MessageHeaderSize is the number of bytes in a decred message header.
// MessageHeaderSize is the number of bytes in a Decred message header.
// Decred network (magic) 4 bytes + command 12 bytes + payload length 4 bytes +
// checksum 4 bytes.
const MessageHeaderSize = 24
// CommandSize is the fixed size of all commands in the common decred message
// CommandSize is the fixed size of all commands in the common Decred message
// header. Shorter commands must be zero padded.
const CommandSize = 12
@ -56,7 +56,7 @@ const (
CmdFeeFilter = "feefilter"
)
// Message is an interface that describes a decred message. A type that
// Message is an interface that describes a Decred message. A type that
// implements Message has complete control over the representation of its data
// and may therefore contain additional or fewer fields than those which
// are used directly in the protocol encoded message.
@ -153,7 +153,7 @@ func makeEmptyMessage(command string) (Message, error) {
return msg, nil
}
// messageHeader defines the header structure for all decred protocol messages.
// messageHeader defines the header structure for all Decred protocol messages.
type messageHeader struct {
magic CurrencyNet // 4 bytes
command string // 12 bytes
@ -161,7 +161,7 @@ type messageHeader struct {
checksum [4]byte // 4 bytes
}
// readMessageHeader reads a decred message header from r.
// readMessageHeader reads a Decred message header from r.
func readMessageHeader(r io.Reader) (int, *messageHeader, error) {
// Since readElements doesn't return the amount of bytes read, attempt
// to read the entire header into a buffer first in case there is a
@ -205,7 +205,7 @@ func discardInput(r io.Reader, n uint32) {
}
}
// WriteMessageN writes a decred Message to w including the necessary header
// WriteMessageN writes a Decred Message to w including the necessary header
// information and returns the number of bytes written. This function is the
// same as WriteMessage except it also returns the number of bytes written.
func WriteMessageN(w io.Writer, msg Message, pver uint32, dcrnet CurrencyNet) (int, error) {
@ -273,7 +273,7 @@ func WriteMessageN(w io.Writer, msg Message, pver uint32, dcrnet CurrencyNet) (i
return totalBytes, err
}
// WriteMessage writes a decred Message to w including the necessary header
// 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
@ -283,8 +283,8 @@ func WriteMessage(w io.Writer, msg Message, pver uint32, dcrnet CurrencyNet) err
return err
}
// ReadMessageN reads, validates, and parses the next decred Message from r for
// the provided protocol version and decred network. It returns the number of
// ReadMessageN reads, validates, and parses the next Decred Message from r for
// the provided protocol version and Decred network. It returns the number of
// bytes read in addition to the parsed Message and raw bytes which comprise the
// message. This function is the same as ReadMessage except it also returns the
// number of bytes read.
@ -305,7 +305,7 @@ func ReadMessageN(r io.Reader, pver uint32, dcrnet CurrencyNet) (int, Message, [
}
// Check for messages from the wrong decred network.
// Check for messages from the wrong Decred network.
if hdr.magic != dcrnet {
discardInput(r, hdr.length)
str := fmt.Sprintf("message from other network [%v]", hdr.magic)
@ -368,8 +368,8 @@ func ReadMessageN(r io.Reader, pver uint32, dcrnet CurrencyNet) (int, Message, [
return totalBytes, msg, payload, nil
}
// ReadMessage reads, validates, and parses the next decred Message from r for
// the provided protocol version and decred network. It returns the parsed
// ReadMessage reads, validates, and parses the next Decred Message from r for
// the provided protocol version and Decred network. It returns the parsed
// Message and raw bytes which comprise the message. This function only differs
// from ReadMessageN in that it doesn't return the number of bytes read. This
// function is mainly provided for backwards compatibility with the original

View File

@ -23,8 +23,8 @@ import (
func makeHeader(dcrnet CurrencyNet, command string,
payloadLen uint32, checksum uint32) []byte {
// The length of a decred message header is 24 bytes.
// 4 byte magic number of the decred network + 12 byte command + 4 byte
// The length of a Decred message header is 24 bytes.
// 4 byte magic number of the Decred network + 12 byte command + 4 byte
// payload length + 4 byte checksum.
buf := make([]byte, 24)
binary.LittleEndian.PutUint32(buf, uint32(dcrnet))

View File

@ -313,7 +313,7 @@ func NewAlertFromPayload(serializedPayload []byte, pver uint32) (*Alert, error)
return &alert, nil
}
// MsgAlert implements the Message interface and defines a decred alert
// MsgAlert implements the Message interface and defines a Decred alert
// message.
//
// This is a signed message that provides notifications that the client should
@ -332,7 +332,7 @@ type MsgAlert struct {
Payload *Alert
}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgAlert) BtcDecode(r io.Reader, pver uint32) error {
var err error
@ -353,7 +353,7 @@ func (msg *MsgAlert) BtcDecode(r io.Reader, pver uint32) error {
return err
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgAlert) BtcEncode(w io.Writer, pver uint32) error {
var err error
@ -397,7 +397,7 @@ func (msg *MsgAlert) MaxPayloadLength(pver uint32) uint32 {
return MaxMessagePayload
}
// NewMsgAlert returns a new decred alert message that conforms to the Message
// NewMsgAlert returns a new Decred alert message that conforms to the Message
// interface. See MsgAlert for details.
func NewMsgAlert(serializedPayload []byte, signature []byte) *MsgAlert {
return &MsgAlert{

View File

@ -79,7 +79,7 @@ func (msg *MsgBlock) ClearSTransactions() {
msg.STransactions = make([]*MsgTx, 0, defaultTransactionAlloc)
}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
// See Deserialize for decoding blocks stored to disk, such as in a database, as
// opposed to decoding blocks from the wire.
@ -145,7 +145,7 @@ func (msg *MsgBlock) BtcDecode(r io.Reader, pver uint32) error {
// Deserialize decodes a block from r into the receiver using a format that is
// suitable for long-term storage such as a database while respecting the
// Version field in the block. This function differs from BtcDecode in that
// BtcDecode decodes from the decred wire protocol as it was sent across the
// BtcDecode decodes from the Decred wire protocol as it was sent across the
// network. The wire encoding can technically differ depending on the protocol
// version and doesn't even really need to match the format of a stored block at
// all. As of the time this comment was written, the encoded block is the same
@ -246,7 +246,7 @@ func (msg *MsgBlock) DeserializeTxLoc(r *bytes.Buffer) ([]TxLoc, []TxLoc, error)
return txLocs, sTxLocs, nil
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
// See Serialize for encoding blocks to be stored to disk, such as in a
// database, as opposed to encoding blocks for the wire.
@ -286,7 +286,7 @@ func (msg *MsgBlock) BtcEncode(w io.Writer, pver uint32) error {
// Serialize encodes the block to w using a format that suitable for long-term
// storage such as a database while respecting the Version field in the block.
// This function differs from BtcEncode in that BtcEncode encodes the block to
// the decred wire protocol in order to be sent across the network. The wire
// the Decred wire protocol in order to be sent across the network. The wire
// encoding can technically differ depending on the protocol version and doesn't
// even really need to match the format of a stored block at all. As of the
// time this comment was written, the encoded block is the same in both
@ -377,7 +377,7 @@ func (msg *MsgBlock) STxHashes() []chainhash.Hash {
return hashList
}
// NewMsgBlock returns a new decred block message that conforms to the
// NewMsgBlock returns a new Decred block message that conforms to the
// Message interface. See MsgBlock for details.
func NewMsgBlock(blockHeader *BlockHeader) *MsgBlock {
return &MsgBlock{

View File

@ -26,7 +26,7 @@ type MsgFilterAdd struct {
Data []byte
}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgFilterAdd) BtcDecode(r io.Reader, pver uint32) error {
var err error
@ -35,7 +35,7 @@ func (msg *MsgFilterAdd) BtcDecode(r io.Reader, pver uint32) error {
return err
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgFilterAdd) BtcEncode(w io.Writer, pver uint32) error {
size := len(msg.Data)
@ -61,7 +61,7 @@ func (msg *MsgFilterAdd) MaxPayloadLength(pver uint32) uint32 {
MaxFilterAddDataSize
}
// NewMsgFilterAdd returns a new decred filteradd message that conforms to the
// NewMsgFilterAdd returns a new Decred filteradd message that conforms to the
// Message interface. See MsgFilterAdd for details.
func NewMsgFilterAdd(data []byte) *MsgFilterAdd {
return &MsgFilterAdd{

View File

@ -16,13 +16,13 @@ import (
// no payload.
type MsgFilterClear struct{}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgFilterClear) BtcDecode(r io.Reader, pver uint32) error {
return nil
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgFilterClear) BtcEncode(w io.Writer, pver uint32) error {
return nil
@ -40,7 +40,7 @@ func (msg *MsgFilterClear) MaxPayloadLength(pver uint32) uint32 {
return 0
}
// NewMsgFilterClear returns a new decred filterclear message that conforms to the Message
// NewMsgFilterClear returns a new Decred filterclear message that conforms to the Message
// interface. See MsgFilterClear for details.
func NewMsgFilterClear() *MsgFilterClear {
return &MsgFilterClear{}

View File

@ -50,7 +50,7 @@ type MsgFilterLoad struct {
Flags BloomUpdateType
}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgFilterLoad) BtcDecode(r io.Reader, pver uint32) error {
var err error
@ -74,7 +74,7 @@ func (msg *MsgFilterLoad) BtcDecode(r io.Reader, pver uint32) error {
return nil
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgFilterLoad) BtcEncode(w io.Writer, pver uint32) error {
size := len(msg.Filter)
@ -113,7 +113,7 @@ func (msg *MsgFilterLoad) MaxPayloadLength(pver uint32) uint32 {
MaxFilterLoadFilterSize + 9
}
// NewMsgFilterLoad returns a new decred filterload message that conforms to
// NewMsgFilterLoad returns a new Decred filterload message that conforms to
// the Message interface. See MsgFilterLoad for details.
func NewMsgFilterLoad(filter []byte, hashFuncs uint32, tweak uint32, flags BloomUpdateType) *MsgFilterLoad {
return &MsgFilterLoad{

View File

@ -17,13 +17,13 @@ import (
// This message has no payload.
type MsgGetAddr struct{}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgGetAddr) BtcDecode(r io.Reader, pver uint32) error {
return nil
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgGetAddr) BtcEncode(w io.Writer, pver uint32) error {
return nil
@ -41,7 +41,7 @@ func (msg *MsgGetAddr) MaxPayloadLength(pver uint32) uint32 {
return 0
}
// NewMsgGetAddr returns a new decred getaddr message that conforms to the
// NewMsgGetAddr returns a new Decred getaddr message that conforms to the
// Message interface. See MsgGetAddr for details.
func NewMsgGetAddr() *MsgGetAddr {
return &MsgGetAddr{}

View File

@ -49,7 +49,7 @@ func (msg *MsgGetBlocks) AddBlockLocatorHash(hash *chainhash.Hash) error {
return nil
}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgGetBlocks) BtcDecode(r io.Reader, pver uint32) error {
err := readElement(r, &msg.ProtocolVersion)
@ -84,7 +84,7 @@ func (msg *MsgGetBlocks) BtcDecode(r io.Reader, pver uint32) error {
return readElement(r, &msg.HashStop)
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgGetBlocks) BtcEncode(w io.Writer, pver uint32) error {
count := len(msg.BlockLocatorHashes)
@ -128,7 +128,7 @@ func (msg *MsgGetBlocks) MaxPayloadLength(pver uint32) uint32 {
return 4 + MaxVarIntPayload + (MaxBlockLocatorsPerMsg * chainhash.HashSize) + chainhash.HashSize
}
// NewMsgGetBlocks returns a new decred getblocks message that conforms to the
// NewMsgGetBlocks returns a new Decred getblocks message that conforms to the
// Message interface using the passed parameters and defaults for the remaining
// fields.
func NewMsgGetBlocks(hashStop *chainhash.Hash) *MsgGetBlocks {

View File

@ -36,7 +36,7 @@ func (msg *MsgGetData) AddInvVect(iv *InvVect) error {
return nil
}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgGetData) BtcDecode(r io.Reader, pver uint32) error {
count, err := ReadVarInt(r, pver)
@ -66,7 +66,7 @@ func (msg *MsgGetData) BtcDecode(r io.Reader, pver uint32) error {
return nil
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgGetData) BtcEncode(w io.Writer, pver uint32) error {
// Limit to max inventory vectors per message.
@ -104,7 +104,7 @@ func (msg *MsgGetData) MaxPayloadLength(pver uint32) uint32 {
return MaxVarIntPayload + (MaxInvPerMsg * maxInvVectPayload)
}
// NewMsgGetData returns a new decred getdata message that conforms to the
// NewMsgGetData returns a new Decred getdata message that conforms to the
// Message interface. See MsgGetData for details.
func NewMsgGetData() *MsgGetData {
return &MsgGetData{
@ -112,7 +112,7 @@ func NewMsgGetData() *MsgGetData {
}
}
// NewMsgGetDataSizeHint returns a new decred getdata message that conforms to
// NewMsgGetDataSizeHint returns a new Decred getdata message that conforms to
// the Message interface. See MsgGetData for details. This function differs
// from NewMsgGetData in that it allows a default allocation size for the
// backing array which houses the inventory vector list. This allows callers

View File

@ -46,7 +46,7 @@ func (msg *MsgGetHeaders) AddBlockLocatorHash(hash *chainhash.Hash) error {
return nil
}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgGetHeaders) BtcDecode(r io.Reader, pver uint32) error {
err := readElement(r, &msg.ProtocolVersion)
@ -81,7 +81,7 @@ func (msg *MsgGetHeaders) BtcDecode(r io.Reader, pver uint32) error {
return readElement(r, &msg.HashStop)
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgGetHeaders) BtcEncode(w io.Writer, pver uint32) error {
// Limit to max block locator hashes per message.
@ -127,7 +127,7 @@ func (msg *MsgGetHeaders) MaxPayloadLength(pver uint32) uint32 {
chainhash.HashSize) + chainhash.HashSize
}
// NewMsgGetHeaders returns a new decred getheaders message that conforms to
// NewMsgGetHeaders returns a new Decred getheaders message that conforms to
// the Message interface. See MsgGetHeaders for details.
func NewMsgGetHeaders() *MsgGetHeaders {
return &MsgGetHeaders{

View File

@ -14,13 +14,13 @@ import (
// from a peer.
type MsgGetMiningState struct{}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgGetMiningState) BtcDecode(r io.Reader, pver uint32) error {
return nil
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgGetMiningState) BtcEncode(w io.Writer, pver uint32) error {
return nil
@ -38,7 +38,7 @@ func (msg *MsgGetMiningState) MaxPayloadLength(pver uint32) uint32 {
return 0
}
// NewMsgGetMiningState returns a new decred pong message that conforms to the Message
// NewMsgGetMiningState returns a new Decred pong message that conforms to the Message
// interface. See MsgPong for details.
func NewMsgGetMiningState() *MsgGetMiningState {
return &MsgGetMiningState{}

View File

@ -11,10 +11,10 @@ import (
)
// MaxBlockHeadersPerMsg is the maximum number of block headers that can be in
// a single decred headers message.
// a single Decred headers message.
const MaxBlockHeadersPerMsg = 2000
// MsgHeaders implements the Message interface and represents a decred headers
// MsgHeaders implements the Message interface and represents a Decred headers
// message. It is used to deliver block header information in response
// to a getheaders message (MsgGetHeaders). The maximum number of block headers
// per message is currently 2000. See MsgGetHeaders for details on requesting
@ -35,7 +35,7 @@ func (msg *MsgHeaders) AddBlockHeader(bh *BlockHeader) error {
return nil
}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgHeaders) BtcDecode(r io.Reader, pver uint32) error {
count, err := ReadVarInt(r, pver)
@ -78,7 +78,7 @@ func (msg *MsgHeaders) BtcDecode(r io.Reader, pver uint32) error {
return nil
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgHeaders) BtcEncode(w io.Writer, pver uint32) error {
// Limit to max block headers per message.
@ -128,7 +128,7 @@ func (msg *MsgHeaders) MaxPayloadLength(pver uint32) uint32 {
MaxBlockHeadersPerMsg)
}
// NewMsgHeaders returns a new decred headers message that conforms to the
// NewMsgHeaders returns a new Decred headers message that conforms to the
// Message interface. See MsgHeaders for details.
func NewMsgHeaders() *MsgHeaders {
return &MsgHeaders{

View File

@ -19,7 +19,7 @@ import (
// typical case.
const defaultInvListAlloc = 1000
// MsgInv implements the Message interface and represents a decred inv message.
// MsgInv implements the Message interface and represents a Decred inv message.
// It is used to advertise a peer's known data such as blocks and transactions
// through inventory vectors. It may be sent unsolicited to inform other peers
// of the data or in response to a getblocks message (MsgGetBlocks). Each
@ -44,7 +44,7 @@ func (msg *MsgInv) AddInvVect(iv *InvVect) error {
return nil
}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgInv) BtcDecode(r io.Reader, pver uint32) error {
count, err := ReadVarInt(r, pver)
@ -74,7 +74,7 @@ func (msg *MsgInv) BtcDecode(r io.Reader, pver uint32) error {
return nil
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgInv) BtcEncode(w io.Writer, pver uint32) error {
// Limit to max inventory vectors per message.
@ -112,7 +112,7 @@ func (msg *MsgInv) MaxPayloadLength(pver uint32) uint32 {
return MaxVarIntPayload + (MaxInvPerMsg * maxInvVectPayload)
}
// NewMsgInv returns a new decred inv message that conforms to the Message
// NewMsgInv returns a new Decred inv message that conforms to the Message
// interface. See MsgInv for details.
func NewMsgInv() *MsgInv {
return &MsgInv{
@ -120,7 +120,7 @@ func NewMsgInv() *MsgInv {
}
}
// NewMsgInvSizeHint returns a new decred inv message that conforms to the
// NewMsgInvSizeHint returns a new Decred inv message that conforms to the
// Message interface. See MsgInv for details. This function differs from
// NewMsgInv in that it allows a default allocation size for the backing array
// which houses the inventory vector list. This allows callers who know in

View File

@ -9,7 +9,7 @@ import (
"io"
)
// MsgMemPool implements the Message interface and represents a decred mempool
// MsgMemPool implements the Message interface and represents a Decred mempool
// message. It is used to request a list of transactions still in the active
// memory pool of a relay.
//
@ -17,13 +17,13 @@ import (
// starting with BIP0035Version.
type MsgMemPool struct{}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgMemPool) BtcDecode(r io.Reader, pver uint32) error {
return nil
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgMemPool) BtcEncode(w io.Writer, pver uint32) error {
return nil
@ -41,7 +41,7 @@ func (msg *MsgMemPool) MaxPayloadLength(pver uint32) uint32 {
return 0
}
// NewMsgMemPool returns a new decred pong message that conforms to the Message
// NewMsgMemPool returns a new Decred pong message that conforms to the Message
// interface. See MsgPong for details.
func NewMsgMemPool() *MsgMemPool {
return &MsgMemPool{}

View File

@ -60,7 +60,7 @@ func (msg *MsgMerkleBlock) AddSTxHash(hash *chainhash.Hash) error {
return nil
}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgMerkleBlock) BtcDecode(r io.Reader, pver uint32) error {
err := readBlockHeader(r, pver, &msg.Header)
@ -130,7 +130,7 @@ func (msg *MsgMerkleBlock) BtcDecode(r io.Reader, pver uint32) error {
return err
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgMerkleBlock) BtcEncode(w io.Writer, pver uint32) error {
// Read num transaction hashes and limit to max.
@ -214,7 +214,7 @@ func (msg *MsgMerkleBlock) MaxPayloadLength(pver uint32) uint32 {
return MaxBlockPayload
}
// NewMsgMerkleBlock returns a new decred merkleblock message that conforms to
// NewMsgMerkleBlock returns a new Decred merkleblock message that conforms to
// the Message interface. See MsgMerkleBlock for details.
func NewMsgMerkleBlock(bh *BlockHeader) *MsgMerkleBlock {
return &MsgMerkleBlock{

View File

@ -188,7 +188,7 @@ func (msg *MsgMiningState) MaxPayloadLength(pver uint32) uint32 {
chainhash.HashSize)
}
// NewMsgMiningState returns a new decred miningstate message that conforms to
// NewMsgMiningState returns a new Decred miningstate message that conforms to
// the Message interface using the defaults for the fields.
func NewMsgMiningState() *MsgMiningState {
return &MsgMiningState{

View File

@ -10,7 +10,7 @@ import (
"io"
)
// MsgNotFound defines a decred notfound message which is sent in response to
// MsgNotFound defines a Decred notfound message which is sent in response to
// a getdata message if any of the requested data in not available on the peer.
// Each message is limited to a maximum number of inventory vectors, which is
// currently 50,000.
@ -33,7 +33,7 @@ func (msg *MsgNotFound) AddInvVect(iv *InvVect) error {
return nil
}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgNotFound) BtcDecode(r io.Reader, pver uint32) error {
count, err := ReadVarInt(r, pver)
@ -63,7 +63,7 @@ func (msg *MsgNotFound) BtcDecode(r io.Reader, pver uint32) error {
return nil
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgNotFound) BtcEncode(w io.Writer, pver uint32) error {
// Limit to max inventory vectors per message.
@ -102,7 +102,7 @@ func (msg *MsgNotFound) MaxPayloadLength(pver uint32) uint32 {
return MaxVarIntPayload + (MaxInvPerMsg * maxInvVectPayload)
}
// NewMsgNotFound returns a new decred notfound message that conforms to the
// NewMsgNotFound returns a new Decred notfound message that conforms to the
// Message interface. See MsgNotFound for details.
func NewMsgNotFound() *MsgNotFound {
return &MsgNotFound{

View File

@ -9,7 +9,7 @@ import (
"io"
)
// MsgPing implements the Message interface and represents a decred ping
// MsgPing implements the Message interface and represents a Decred ping
// message.
//
// For versions BIP0031Version and earlier, it is used primarily to confirm
@ -26,14 +26,14 @@ type MsgPing struct {
Nonce uint64
}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgPing) BtcDecode(r io.Reader, pver uint32) error {
err := readElement(r, &msg.Nonce)
return err
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgPing) BtcEncode(w io.Writer, pver uint32) error {
err := writeElement(w, msg.Nonce)
@ -57,7 +57,7 @@ func (msg *MsgPing) MaxPayloadLength(pver uint32) uint32 {
return plen
}
// NewMsgPing returns a new decred ping message that conforms to the Message
// NewMsgPing returns a new Decred ping message that conforms to the Message
// interface. See MsgPing for details.
func NewMsgPing(nonce uint64) *MsgPing {
return &MsgPing{

View File

@ -9,9 +9,9 @@ import (
"io"
)
// MsgPong implements the Message interface and represents a decred pong
// MsgPong implements the Message interface and represents a Decred pong
// message which is used primarily to confirm that a connection is still valid
// in response to a decred ping message (MsgPing).
// in response to a Decred ping message (MsgPing).
//
// This message was not added until protocol versions AFTER BIP0031Version.
type MsgPong struct {
@ -20,13 +20,13 @@ type MsgPong struct {
Nonce uint64
}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgPong) BtcDecode(r io.Reader, pver uint32) error {
return readElement(r, &msg.Nonce)
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgPong) BtcEncode(w io.Writer, pver uint32) error {
return writeElement(w, msg.Nonce)
@ -49,7 +49,7 @@ func (msg *MsgPong) MaxPayloadLength(pver uint32) uint32 {
return plen
}
// NewMsgPong returns a new decred pong message that conforms to the Message
// NewMsgPong returns a new Decred pong message that conforms to the Message
// interface. See MsgPong for details.
func NewMsgPong(nonce uint64) *MsgPong {
return &MsgPong{

View File

@ -49,7 +49,7 @@ func (code RejectCode) String() string {
return fmt.Sprintf("Unknown RejectCode (%d)", uint8(code))
}
// MsgReject implements the Message interface and represents a decred reject
// MsgReject implements the Message interface and represents a Decred reject
// message.
//
// This message was not added until protocol version RejectVersion.
@ -72,7 +72,7 @@ type MsgReject struct {
Hash chainhash.Hash
}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgReject) BtcDecode(r io.Reader, pver uint32) error {
// Command that was rejected.
@ -108,7 +108,7 @@ func (msg *MsgReject) BtcDecode(r io.Reader, pver uint32) error {
return nil
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgReject) BtcEncode(w io.Writer, pver uint32) error {
// Command that was rejected.
@ -151,13 +151,13 @@ func (msg *MsgReject) Command() string {
// MaxPayloadLength returns the maximum length the payload can be for the
// receiver. This is part of the Message interface implementation.
func (msg *MsgReject) MaxPayloadLength(pver uint32) uint32 {
// Unfortunately the decred protocol does not enforce a sane
// Unfortunately the Decred protocol does not enforce a sane
// limit on the length of the reason, so the max payload is the
// overall maximum message payload.
return uint32(MaxMessagePayload)
}
// NewMsgReject returns a new decred reject message that conforms to the
// NewMsgReject returns a new Decred reject message that conforms to the
// Message interface. See MsgReject for details.
func NewMsgReject(command string, code RejectCode, reason string) *MsgReject {
return &MsgReject{

View File

@ -246,7 +246,7 @@ func readScript(r io.Reader, pver uint32, maxAllowed uint32, fieldName string) (
return b, nil
}
// OutPoint defines a decred data type that is used to track previous
// OutPoint defines a Decred data type that is used to track previous
// transaction outputs.
type OutPoint struct {
Hash chainhash.Hash
@ -254,7 +254,7 @@ type OutPoint struct {
Tree int8
}
// NewOutPoint returns a new decred transaction outpoint point with the
// NewOutPoint returns a new Decred transaction outpoint point with the
// provided hash and index.
func NewOutPoint(hash *chainhash.Hash, index uint32, tree int8) *OutPoint {
return &OutPoint{
@ -279,7 +279,7 @@ func (o OutPoint) String() string {
return string(buf)
}
// TxIn defines a decred transaction input.
// TxIn defines a Decred transaction input.
type TxIn struct {
// Non-witness
PreviousOutPoint OutPoint
@ -329,7 +329,7 @@ func (t *TxIn) SerializeSizeWitnessValueSigning() int {
len(t.SignatureScript)
}
// NewTxIn returns a new decred transaction input with the provided
// NewTxIn returns a new Decred transaction input with the provided
// previous outpoint point and signature script with a default sequence of
// MaxTxInSequenceNum.
func NewTxIn(prevOut *OutPoint, signatureScript []byte) *TxIn {
@ -343,7 +343,7 @@ func NewTxIn(prevOut *OutPoint, signatureScript []byte) *TxIn {
}
}
// TxOut defines a decred transaction output.
// TxOut defines a Decred transaction output.
type TxOut struct {
Value int64
Version uint16
@ -358,7 +358,7 @@ func (t *TxOut) SerializeSize() int {
return 8 + 2 + VarIntSerializeSize(uint64(len(t.PkScript))) + len(t.PkScript)
}
// NewTxOut returns a new decred transaction output with the provided
// NewTxOut returns a new Decred transaction output with the provided
// transaction value and public key script.
func NewTxOut(value int64, pkScript []byte) *TxOut {
return &TxOut{
@ -368,7 +368,7 @@ func NewTxOut(value int64, pkScript []byte) *TxOut {
}
}
// MsgTx implements the Message interface and represents a decred tx message.
// MsgTx implements the Message interface and represents a Decred tx message.
// It is used to deliver transaction information in response to a getdata
// message (MsgGetData) for a given transaction.
//
@ -874,7 +874,7 @@ func (msg *MsgTx) decodeWitnessValueSigning(r io.Reader, pver uint32) (uint64, e
return totalScriptSize, nil
}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
// See Deserialize for decoding transactions stored to disk, such as in a
// database, as opposed to decoding transactions from the wire.
@ -1142,7 +1142,7 @@ func (msg *MsgTx) BtcEncode(w io.Writer, pver uint32) error {
// Serialize encodes the transaction to w using a format that suitable for
// long-term storage such as a database while respecting the Version field in
// the transaction. This function differs from BtcEncode in that BtcEncode
// encodes the transaction to the decred wire protocol in order to be sent
// encodes the transaction to the Decred wire protocol in order to be sent
// across the network. The wire encoding can technically differ depending on
// the protocol version and doesn't even really need to match the format of a
// stored transaction at all. As of the time this comment was written, the
@ -1303,7 +1303,7 @@ func (msg *MsgTx) PkScriptLocs() []int {
return pkScriptLocs
}
// NewMsgTx returns a new decred tx message that conforms to the Message
// NewMsgTx returns a new Decred tx message that conforms to the Message
// interface. The return instance has a default version of TxVersion and there
// are no transaction inputs or outputs. Also, the lock time is set to zero
// to indicate the transaction is valid immediately as opposed to some time in
@ -1338,7 +1338,7 @@ func ReadOutPoint(r io.Reader, pver uint32, version uint16, op *OutPoint) error
return nil
}
// WriteOutPoint encodes op to the decred protocol encoding for an OutPoint
// WriteOutPoint encodes op to the Decred protocol encoding for an OutPoint
// to w.
func WriteOutPoint(w io.Writer, pver uint32, version uint16, op *OutPoint) error {
_, err := w.Write(op.Hash[:])
@ -1426,7 +1426,7 @@ func readTxInWitnessValueSigning(r io.Reader, pver uint32, version uint16, ti *T
return err
}
// writeTxInPrefixs encodes ti to the decred protocol encoding for a transaction
// writeTxInPrefixs encodes ti to the Decred protocol encoding for a transaction
// input (TxIn) prefix to w.
func writeTxInPrefix(w io.Writer, pver uint32, version uint16, ti *TxIn) error {
err := WriteOutPoint(w, pver, version, &ti.PreviousOutPoint)
@ -1437,7 +1437,7 @@ func writeTxInPrefix(w io.Writer, pver uint32, version uint16, ti *TxIn) error {
return binarySerializer.PutUint32(w, littleEndian, ti.Sequence)
}
// writeTxWitness encodes ti to the decred protocol encoding for a transaction
// writeTxWitness encodes ti to the Decred protocol encoding for a transaction
// input (TxIn) witness to w.
func writeTxInWitness(w io.Writer, pver uint32, version uint16, ti *TxIn) error {
// ValueIn.
@ -1462,14 +1462,14 @@ func writeTxInWitness(w io.Writer, pver uint32, version uint16, ti *TxIn) error
return WriteVarBytes(w, pver, ti.SignatureScript)
}
// writeTxInWitnessSigning encodes ti to the decred protocol encoding for a
// writeTxInWitnessSigning encodes ti to the Decred protocol encoding for a
// transaction input (TxIn) witness to w for signing.
func writeTxInWitnessSigning(w io.Writer, pver uint32, version uint16, ti *TxIn) error {
// Only write the signature script.
return WriteVarBytes(w, pver, ti.SignatureScript)
}
// writeTxInWitnessValueSigning encodes ti to the decred protocol encoding for a
// writeTxInWitnessValueSigning encodes ti to the Decred protocol encoding for a
// transaction input (TxIn) witness to w for signing with value included.
func writeTxInWitnessValueSigning(w io.Writer, pver uint32, version uint16, ti *TxIn) error {
// ValueIn.
@ -1501,7 +1501,7 @@ func readTxOut(r io.Reader, pver uint32, version uint16, to *TxOut) error {
return err
}
// writeTxOut encodes to into the decred protocol encoding for a transaction
// writeTxOut encodes to into the Decred protocol encoding for a transaction
// output (TxOut) to w.
func writeTxOut(w io.Writer, pver uint32, version uint16, to *TxOut) error {
err := binarySerializer.PutUint64(w, littleEndian, uint64(to.Value))

View File

@ -9,20 +9,20 @@ import (
"io"
)
// MsgVerAck defines a decred verack message which is used for a peer to
// MsgVerAck defines a Decred verack message which is used for a peer to
// acknowledge a version message (MsgVersion) after it has used the information
// to negotiate parameters. It implements the Message interface.
//
// This message has no payload.
type MsgVerAck struct{}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// This is part of the Message interface implementation.
func (msg *MsgVerAck) BtcDecode(r io.Reader, pver uint32) error {
return nil
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgVerAck) BtcEncode(w io.Writer, pver uint32) error {
return nil
@ -40,7 +40,7 @@ func (msg *MsgVerAck) MaxPayloadLength(pver uint32) uint32 {
return 0
}
// NewMsgVerAck returns a new decred verack message that conforms to the
// NewMsgVerAck returns a new Decred verack message that conforms to the
// Message interface.
func NewMsgVerAck() *MsgVerAck {
return &MsgVerAck{}

View File

@ -21,7 +21,7 @@ const MaxUserAgentLen = 256
// DefaultUserAgent for wire in the stack
const DefaultUserAgent = "/dcrwire:0.3.0/"
// MsgVersion implements the Message interface and represents a decred version
// MsgVersion implements the Message interface and represents a Decred version
// message. It is used for a peer to advertise itself as soon as an outbound
// connection is made. The remote peer then uses this information along with
// its own to negotiate. The remote peer must then respond with a version
@ -71,7 +71,7 @@ func (msg *MsgVersion) AddService(service ServiceFlag) {
msg.Services |= service
}
// BtcDecode decodes r using the decred protocol encoding into the receiver.
// BtcDecode decodes r using the Decred protocol encoding into the receiver.
// The version message is special in that the protocol version hasn't been
// negotiated yet. As a result, the pver field is ignored and any fields which
// are added in new versions are optional. This also mean that r must be a
@ -149,7 +149,7 @@ func (msg *MsgVersion) BtcDecode(r io.Reader, pver uint32) error {
return nil
}
// BtcEncode encodes the receiver to w using the decred protocol encoding.
// BtcEncode encodes the receiver to w using the Decred protocol encoding.
// This is part of the Message interface implementation.
func (msg *MsgVersion) BtcEncode(w io.Writer, pver uint32) error {
err := validateUserAgent(msg.UserAgent)
@ -210,7 +210,7 @@ func (msg *MsgVersion) MaxPayloadLength(pver uint32) uint32 {
MaxUserAgentLen
}
// NewMsgVersion returns a new decred version message that conforms to the
// NewMsgVersion returns a new Decred version message that conforms to the
// Message interface using the passed parameters and defaults for the remaining
// fields.
func NewMsgVersion(me *NetAddress, you *NetAddress, nonce uint64,
@ -232,7 +232,7 @@ func NewMsgVersion(me *NetAddress, you *NetAddress, nonce uint64,
}
// NewMsgVersionFromConn is a convenience function that extracts the remote
// and local address from conn and returns a new decred version message that
// and local address from conn and returns a new Decred version message that
// conforms to the Message interface. See NewMsgVersion.
func NewMsgVersionFromConn(conn net.Conn, nonce uint64,
lastBlock int32) (*MsgVersion, error) {

View File

@ -17,7 +17,7 @@ import (
// a TCP address as required.
var ErrInvalidNetAddr = errors.New("provided net.Addr is not a net.TCPAddr")
// maxNetAddressPayload returns the max payload size for a decred NetAddress
// maxNetAddressPayload returns the max payload size for a Decred NetAddress
// based on the protocol version.
func maxNetAddressPayload(pver uint32) uint32 {
// Services 8 bytes + ip 16 bytes + port 2 bytes.
@ -34,7 +34,7 @@ func maxNetAddressPayload(pver uint32) uint32 {
type NetAddress struct {
// Last time the address was seen. This is, unfortunately, encoded as a
// uint32 on the wire and therefore is limited to 2106. This field is
// not present in the decred version message (MsgVersion) nor was it
// not present in the Decred version message (MsgVersion) nor was it
// added until protocol version >= NetAddressTimeVersion.
Timestamp time.Time
@ -103,7 +103,7 @@ func NewNetAddress(addr net.Addr, services ServiceFlag) (*NetAddress, error) {
func readNetAddress(r io.Reader, pver uint32, na *NetAddress, ts bool) error {
var ip [16]byte
// NOTE: The decred protocol uses a uint32 for the timestamp so it will
// 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 {
@ -136,7 +136,7 @@ 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
// 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.
if ts {

View File

@ -36,7 +36,7 @@ const (
FeeFilterVersion uint32 = 5
)
// ServiceFlag identifies services supported by a decred peer.
// ServiceFlag identifies services supported by a Decred peer.
type ServiceFlag uint64
const (
@ -86,15 +86,15 @@ func (f ServiceFlag) String() string {
return s
}
// CurrencyNet represents which decred network a message belongs to.
// CurrencyNet represents which Decred network a message belongs to.
type CurrencyNet uint32
// Constants used to indicate the message decred network. They can also be
// Constants used to indicate the message Decred network. They can also be
// used to seek to the next message when a stream's state is unknown, but
// this package does not provide that functionality since it's generally a
// better idea to simply disconnect clients that are misbehaving over TCP.
const (
// MainNet represents the main decred network.
// MainNet represents the main Decred network.
MainNet CurrencyNet = 0xd9b400f9
// RegTest represents the regression test network.
@ -107,7 +107,7 @@ const (
SimNet CurrencyNet = 0x12141c16
)
// bnStrings is a map of decred networks back to their constant names for
// bnStrings is a map of Decred networks back to their constant names for
// pretty printing.
var bnStrings = map[CurrencyNet]string{
MainNet: "MainNet",

View File

@ -30,7 +30,7 @@ func TestServiceFlagStringer(t *testing.T) {
}
}
// TestCurrencyNetStringer tests the stringized output for decred net types.
// TestCurrencyNetStringer tests the stringized output for Decred net types.
func TestCurrencyNetStringer(t *testing.T) {
tests := []struct {
in CurrencyNet