This implements a new voting agenda for the testnet and simnet networks for increasing the maximum block size from 1MiB to 1.25MB. The following is an overview of the changes: - Bump the maximum protocol block size limit to 1.25MB - Bump the protocol version to 4 - Add wire tests for v3 protocol sizes and update tests for latest - Update all wire values that are defined in terms of the max block size to respect the protocol version - Update the MaxSigOpsPerBlock constant to maintain existing value regardless of the raised max protocol block size - Decouple the maximum tx size from the block size by creating a chain parameter for it with the current sizes so it is not a part of the hard fork vote - Add definition for new version 4 stake vote along with agenda to vote on block size to the testnet and simnet networks - Convert the MaximumBlockSize chain parameter to a slice in order to hold the different possible sizes - Adds a new function that returns the maximum block size based upon the result of the vote - Change the existing context-free block size check to enforce the max protocol size and introduce a context-specific check which enforces a restricted size based upon the network consensus parameters and the result of the vote - Set the max allowed size in generated block templates based upon the network params and result of the vote - Generate version 4 blocks and reject version 3 blocks after a super majority has been reached |
||
|---|---|---|
| .. | ||
| 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 | ||
| invvect_test.go | ||
| invvect.go | ||
| message_test.go | ||
| message.go | ||
| msgaddr_test.go | ||
| msgaddr.go | ||
| msgalert_test.go | ||
| msgalert.go | ||
| msgblock_test.go | ||
| msgblock.go | ||
| msgfilteradd_test.go | ||
| msgfilteradd.go | ||
| msgfilterclear_test.go | ||
| msgfilterclear.go | ||
| msgfilterload_test.go | ||
| msgfilterload.go | ||
| msggetaddr_test.go | ||
| msggetaddr.go | ||
| msggetblocks_test.go | ||
| msggetblocks.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 | ||
| msgmerkleblock_test.go | ||
| msgmerkleblock.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
[]
(https://travis-ci.org/decred/dcrd) ![ISC License]
(http://img.shields.io/badge/license-ISC-blue.svg)
[
]
(http://godoc.org/github.com/decred/dcrd/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.