Commit Graph

219 Commits

Author SHA1 Message Date
Deirdre Connolly 2739970113 Fill out TransactionHash and rename
Resolves #35
2019-09-27 19:22:34 -07:00
Deirdre Connolly b21b09bf8e Moved stub TxHash into zebra_chain::transaction 2019-09-27 19:22:34 -07:00
Deirdre Connolly 29591df47e Use the BlockHeaderHash from zebra-chain in the Inv message parsing 2019-09-27 19:22:34 -07:00
Henry de Valence 0a85be285d Add addr, getaddr serialization. 2019-09-27 20:41:45 -04:00
Henry de Valence b426630613 Clarify comment in decoder state. 2019-09-27 20:41:45 -04:00
Henry de Valence 422c783a47 Rename Message::Inventory -> Message::Inv
I don't feel super strongly about this change, so I'm happy to drop it,
but it makes the parsing match statements line up nicely and aligns
naming with the naming used in Bitcoin.
2019-09-27 20:41:45 -04:00
Henry de Valence 958fca8e68 Parse inv messages, refactor inventory vectors.
This removes the inventory vector structs from `zebra-chain` (as they
are really part of the network protocol) and refactors them into a
single `InventoryHash` type.  This corresponds to Bitcoin's "inventory
vector" but with a different, better name (it's not a vector, it's just
a typed hash of some other item).
2019-09-27 20:41:45 -04:00
Henry de Valence ab06750db3 zebra-network: move types -> protocol::types
These types are used for protocol messages, so it makes more sense to
keep them scoped with the protocol handling, rather than other
networking logic.
2019-09-27 20:41:45 -04:00
Deirdre Connolly 35f03dc55d Make Message.Block just point at a Block type, in codec call block.zcash_serialize() 2019-09-26 23:41:25 -04:00
Deirdre Connolly 3f2a1b4f2c Move around MerkleTree* structs 2019-09-26 23:41:25 -04:00
Deirdre Connolly 677d53897f Use Vec<u8> for the equihash solution instead of [u8; 1344] for now 2019-09-26 23:41:25 -04:00
Deirdre Connolly cecbb1cc0a Fill out the Block Message type
Should we serialize out `Block` or leave explicit like so? ¯\_(ツ)_/¯
2019-09-26 23:41:25 -04:00
Henry de Valence 48a5054c87 Delete unused variable.
This is no longer required because the body reader methods have access
to the version via the codec state.
2019-09-25 14:59:47 -07:00
Henry de Valence 0196c2c4cd Place header encoding prior to body encoding. 2019-09-25 14:59:47 -07:00
Henry de Valence 94a07b05cc Move HEADER_LEN constant to top of file. 2019-09-25 14:59:47 -07:00
Henry de Valence 28904e01c7 Trace the decoded message in the decoder. 2019-09-25 14:59:47 -07:00
Henry de Valence ea1b60d8e3 Make message body reader fns part of Codec. 2019-09-25 14:59:47 -07:00
Henry de Valence 4e1285b568 Refactor message serialization as a tokio codec.
This provides a significantly cleaner API to consumers, because it
allows using adaptors that convert a TCP stream to a stream of messages,
and potentially allows more efficient message handling.
2019-09-25 14:59:47 -07:00
Henry de Valence 0b1acc50c3 Make a new protocol module with message submodule.
This allows us to organize all of the Bitcoin-Zcash specific parts of
the protocol into a subtree.
2019-09-25 14:59:47 -07:00