This resurrects the regression test network that was removed before initial launch although it really should not have been. The simulation test network and the regression test network do not serve the same purpose. Specifically, the regression test network is intended for unit tests, RPC server tests, and consensus tests. On the other hand, the simulation test network is intended for private use within a group of individuals doing simulation testing and full integration tests between different applications such as wallets, voting service providers, mining pools, block explorers, and other services that build on Decred. Keeping the concerns separate will allow the simulation test network to be modified in ways such as activating consensus changes that have been successfully voted into mainnet without also needing to vote them in on the simulation test network while still preserving the ability for the unit tests to properly test the voting semantics and handling to help prevent regressions. In addition to resurrecting the regression test network, this also fully fleshes out new values for the various addresses prefixes (Rk, Rs, Re, etc), HD key prefixes (rprv, rpub), and treasury multisig details. As a part of resurrecting the network, a new CLI flag `--regnet` is added to allow the RPC test harness connect to a running instance, the areas of the code which involve votes have been modified to allow the votes to apply to the new network, and tests have been added to the relevant modules. This bumps the affected module versions as follows: - github.com/decred/dcrd/wire@v1.2.0 - github.com/decred/dcrd/chaincfg@v1.2.0 - github.com/decred/dcrd/dcrutil@v1.2.0 - github.com/decred/dcrd/hdkeychain@v1.1.1 The blockchain module is also affected, but since its version has already been bumped since the last release tag, it is not bumped again. Finally, this does not include switching unit tests or the RPC test harness over the new network since that will be done in a separate commit. |
||
|---|---|---|
| .. | ||
| bench_test.go | ||
| blockheader_test.go | ||
| blockheader.go | ||
| common_test.go | ||
| common.go | ||
| doc.go | ||
| error.go | ||
| fakeconn_test.go | ||
| fakemessage_test.go | ||
| fixedIO_test.go | ||
| go.mod | ||
| go.sum | ||
| invvect_test.go | ||
| invvect.go | ||
| message_test.go | ||
| message.go | ||
| msgaddr_test.go | ||
| msgaddr.go | ||
| msgblock_test.go | ||
| msgblock.go | ||
| msgcfheaders.go | ||
| msgcfilter.go | ||
| msgcftypes.go | ||
| msgfeefilter_test.go | ||
| msgfeefilter.go | ||
| msggetaddr_test.go | ||
| msggetaddr.go | ||
| msggetblocks_test.go | ||
| msggetblocks.go | ||
| msggetcfheaders.go | ||
| msggetcfilter.go | ||
| msggetcftypes.go | ||
| msggetdata_test.go | ||
| msggetdata.go | ||
| msggetheaders_test.go | ||
| msggetheaders.go | ||
| msggetminingstate.go | ||
| msgheaders_test.go | ||
| msgheaders.go | ||
| msginv_test.go | ||
| msginv.go | ||
| msgmempool_test.go | ||
| msgmempool.go | ||
| msgminingstate_test.go | ||
| msgminingstate.go | ||
| msgnotfound_test.go | ||
| msgnotfound.go | ||
| msgping_test.go | ||
| msgping.go | ||
| msgpong_test.go | ||
| msgpong.go | ||
| msgreject_test.go | ||
| msgreject.go | ||
| msgsendheaders_test.go | ||
| msgsendheaders.go | ||
| msgtx_test.go | ||
| msgtx.go | ||
| msgverack_test.go | ||
| msgverack.go | ||
| msgversion_test.go | ||
| msgversion.go | ||
| netaddress_test.go | ||
| netaddress.go | ||
| protocol_test.go | ||
| protocol.go | ||
| README.md | ||
wire
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 protocol level.
Installation and Updating
$ go get -u github.com/decred/dcrd/wire
Decred Message Overview
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
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 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 themselves with the specifics.
Reading Messages Example
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:
// Use the most recent protocol version supported by the package and the
// 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
// are a wire.Message, a []byte which contains the unmarshalled
// raw payload, and a possible error.
msg, rawPayload, err := wire.ReadMessage(conn, pver, dcrnet)
if err != nil {
// Log and handle the error
}
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
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
from a remote peer is:
// Use the most recent protocol version supported by the package and the
// main Decred network.
pver := wire.ProtocolVersion
dcrnet := wire.MainNet
// 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
// error.
err := wire.WriteMessage(conn, msg, pver, dcrnet)
if err != nil {
// Log and handle the error
}
License
Package wire is licensed under the copyfree ISC License.