Add more message variants.
This commit is contained in:
parent
42412ec2a8
commit
8c2b066885
|
@ -16,17 +16,22 @@
|
|||
/// during serialization).
|
||||
///
|
||||
/// [btc_wiki_protocol]: https://en.bitcoin.it/wiki/Protocol_documentation
|
||||
//
|
||||
// XXX not all messages are filled in yet. Messages written as { /* XXX add
|
||||
// fields */ } are explicitly incomplete and we need to define a mapping between
|
||||
// the serialized message data and the internal representation. Note that this
|
||||
// is different from messages like GetAddr which have no data (and so have no
|
||||
// fields).
|
||||
pub enum Message {
|
||||
|
||||
/// A `version` message.
|
||||
///
|
||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#version)
|
||||
Version {/* fields */},
|
||||
Version {/* XXX add fields */},
|
||||
|
||||
/// A `verack` message.
|
||||
///
|
||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#verack)
|
||||
Verack {/* fields */},
|
||||
Verack {/* XXX add fields */},
|
||||
|
||||
/// A `ping` message.
|
||||
///
|
||||
|
@ -43,6 +48,104 @@ pub enum Message {
|
|||
/// The nonce from the `Ping` message this was in response to.
|
||||
nonce: u64,
|
||||
},
|
||||
|
||||
/// A `reject` message.
|
||||
///
|
||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#reject)
|
||||
Reject {/* XXX add fields */},
|
||||
|
||||
/// An `addr` message.
|
||||
///
|
||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#addr)
|
||||
Addr {/* XXX add fields */},
|
||||
|
||||
/// A `getaddr` message.
|
||||
///
|
||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#getaddr)
|
||||
GetAddr,
|
||||
|
||||
/// A `block` message.
|
||||
///
|
||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#block)
|
||||
Block {/* XXX add fields */},
|
||||
|
||||
/// A `getblocks` message.
|
||||
///
|
||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#getblocks)
|
||||
GetBlocks {/* XXX add fields */},
|
||||
|
||||
/// A `headers` message.
|
||||
///
|
||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#headers)
|
||||
Headers {/* XXX add fields */},
|
||||
|
||||
/// A `getheaders` message.
|
||||
///
|
||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#getheaders)
|
||||
GetHeaders {/* XXX add fields */},
|
||||
|
||||
/// An `inv` message.
|
||||
///
|
||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#inv)
|
||||
// XXX the bitcoin reference above suggests this can be 1.8 MB in bitcoin -- maybe
|
||||
// larger in Zcash, since Zcash objects could be bigger (?) -- does this tilt towards
|
||||
// having serialization be async?
|
||||
Inventory {/* XXX add fields */},
|
||||
|
||||
/// A `getdata` message.
|
||||
///
|
||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#getdata)
|
||||
GetData {/* XXX add fields */},
|
||||
|
||||
/// A `notfound` message.
|
||||
///
|
||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#notfound)
|
||||
NotFound {/* XXX add fields */},
|
||||
|
||||
/// A `tx` message.
|
||||
///
|
||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#tx)
|
||||
Tx {/* XXX add fields */},
|
||||
|
||||
/// A `mempool` message.
|
||||
///
|
||||
/// This was defined in [BIP35], which is included in Zcash.
|
||||
///
|
||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#mempool)
|
||||
/// [BIP35]: https://github.com/bitcoin/bips/blob/master/bip-0035.mediawiki
|
||||
Mempool {/* XXX add fields */},
|
||||
|
||||
/// A `filterload` message.
|
||||
///
|
||||
/// This was defined in [BIP37], which is included in Zcash.
|
||||
///
|
||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#filterload.2C_filteradd.2C_filterclear.2C_merkleblock)
|
||||
/// [BIP37]: https://github.com/bitcoin/bips/blob/master/bip-0037.mediawiki
|
||||
FilterLoad {/* XXX add fields */},
|
||||
|
||||
/// A `filteradd` message.
|
||||
///
|
||||
/// This was defined in [BIP37], which is included in Zcash.
|
||||
///
|
||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#filterload.2C_filteradd.2C_filterclear.2C_merkleblock)
|
||||
/// [BIP37]: https://github.com/bitcoin/bips/blob/master/bip-0037.mediawiki
|
||||
FilterAdd {/* XXX add fields */},
|
||||
|
||||
/// A `filterclear` message.
|
||||
///
|
||||
/// This was defined in [BIP37], which is included in Zcash.
|
||||
///
|
||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#filterload.2C_filteradd.2C_filterclear.2C_merkleblock)
|
||||
/// [BIP37]: https://github.com/bitcoin/bips/blob/master/bip-0037.mediawiki
|
||||
FilterClear {/* XXX add fields */},
|
||||
|
||||
/// A `merkleblock` message.
|
||||
///
|
||||
/// This was defined in [BIP37], which is included in Zcash.
|
||||
///
|
||||
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#filterload.2C_filteradd.2C_filterclear.2C_merkleblock)
|
||||
/// [BIP37]: https://github.com/bitcoin/bips/blob/master/bip-0037.mediawiki
|
||||
MerkleBlock {/* XXX add fields */},
|
||||
}
|
||||
|
||||
// Q: how do we want to implement serialization, exactly? do we want to have
|
||||
|
|
Loading…
Reference in New Issue