Put messages in request/response order

And fix a comment typo
This commit is contained in:
teor 2020-11-17 05:57:57 +10:00
parent 57637560b9
commit ca4e792f47
1 changed files with 27 additions and 27 deletions

View File

@ -121,20 +121,15 @@ pub enum Message {
data: Option<[u8; 32]>, data: Option<[u8; 32]>,
}, },
/// An `addr` message.
///
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#addr)
Addr(Vec<MetaAddr>),
/// A `getaddr` message. /// A `getaddr` message.
/// ///
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#getaddr) /// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#getaddr)
GetAddr, GetAddr,
/// A `block` message. /// An `addr` message.
/// ///
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#block) /// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#addr)
Block(Arc<Block>), Addr(Vec<MetaAddr>),
/// A `getblocks` message. /// A `getblocks` message.
/// ///
@ -155,16 +150,14 @@ pub enum Message {
stop: Option<block::Hash>, stop: Option<block::Hash>,
}, },
/// A `headers` message. /// An `inv` message.
/// ///
/// Returns block headers in response to a getheaders packet. /// Allows a node to advertise its knowledge of one or more
/// objects. It can be received unsolicited, or in reply to
/// `getblocks`.
/// ///
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#headers) /// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#inv)
// Note that the block headers in this packet include a Inv(Vec<InventoryHash>),
// transaction count (a var_int, so there can be more than 81
// bytes per header) as opposed to the block headers that are
// hashed by miners.
Headers(Vec<block::Header>),
/// A `getheaders` message. /// A `getheaders` message.
/// ///
@ -173,7 +166,7 @@ pub enum Message {
/// of its best chain and determine the blocks following the intersection /// of its best chain and determine the blocks following the intersection
/// point. /// point.
/// ///
/// The peer responds with an `headers` packet with the hashes of subsequent blocks. /// The peer responds with an `headers` packet with the headers of subsequent blocks.
/// If supplied, the `stop` parameter specifies the last header to request. /// If supplied, the `stop` parameter specifies the last header to request.
/// Otherwise, the maximum number of block headers (160) are sent. /// Otherwise, the maximum number of block headers (160) are sent.
/// ///
@ -185,14 +178,16 @@ pub enum Message {
stop: Option<block::Hash>, stop: Option<block::Hash>,
}, },
/// An `inv` message. /// A `headers` message.
/// ///
/// Allows a node to advertise its knowledge of one or more /// Returns block headers in response to a getheaders packet.
/// objects. It can be received unsolicited, or in reply to
/// `getblocks`.
/// ///
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#inv) /// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#headers)
Inv(Vec<InventoryHash>), // Note that the block headers in this packet include a
// transaction count (a var_int, so there can be more than 81
// bytes per header) as opposed to the block headers that are
// hashed by miners.
Headers(Vec<block::Header>),
/// A `getdata` message. /// A `getdata` message.
/// ///
@ -203,17 +198,22 @@ pub enum Message {
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#getdata) /// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#getdata)
GetData(Vec<InventoryHash>), GetData(Vec<InventoryHash>),
/// A `notfound` message. /// A `block` message.
/// ///
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#notfound) /// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#block)
// See note above on `Inventory`. Block(Arc<Block>),
NotFound(Vec<InventoryHash>),
/// A `tx` message. /// A `tx` message.
/// ///
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#tx) /// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#tx)
Tx(Arc<Transaction>), Tx(Arc<Transaction>),
/// A `notfound` message.
///
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#notfound)
// See note above on `Inventory`.
NotFound(Vec<InventoryHash>),
/// A `mempool` message. /// A `mempool` message.
/// ///
/// This was defined in [BIP35], which is included in Zcash. /// This was defined in [BIP35], which is included in Zcash.