Commit Graph

198 Commits

Author SHA1 Message Date
Deirdre Connolly 6d3d4c4f64 s/GetData/NotFound/ in read_notfound 2020-02-04 18:04:53 -05:00
Deirdre Connolly 1ca55846eb Little test to exercise sha256dWriter::flush() 2020-02-04 18:04:53 -05:00
Deirdre Connolly beb72080cb Delete out of date comment on incomplete Message variants 2020-01-30 13:39:13 -05:00
Deirdre Connolly 53a7af82a0 Add back a missing quotemark
Co-Authored-By: Henry de Valence <hdevalence@hdevalence.ca>
2020-01-28 03:48:23 -05:00
Deirdre Connolly 71d5571e39 Add roundtrip proptest for LockTime serialization/deserialization
Relates to #150
2020-01-28 03:48:23 -05:00
Deirdre Connolly d8ebeea08c Add proptest regressions file 2020-01-28 03:48:23 -05:00
Deirdre Connolly c2411f4315 Add a little proptest around Magic's Debug impl 2020-01-28 03:48:23 -05:00
Deirdre Connolly 9709b54c57 Fix proptest-regressions locations after reorganizations of files 2020-01-28 03:48:23 -05:00
Henry de Valence bea7b195ce Remove vestigial should_be_private module. 2020-01-16 19:27:08 -05:00
Henry de Valence 7cc44f4fa9 Move server.rs to connection.rs and change imports. 2020-01-16 13:20:03 -05:00
Henry de Valence 77ad61331c Rename `peer::Server` to `peer::Connection`.
This doesn't change the file path or edit imports so that the diff is easier to review.
2020-01-16 13:20:03 -05:00
Deirdre Connolly a3b09c3690
Target crates.io 0.3 versions of tower and tower-load (#172) 2020-01-14 17:18:14 -05:00
Henry de Valence 92ddf0542f Provide impl Zcash[De]Serialize for Vec<T: Zcash[De]Serialize>.
This replaces the read_list function and makes the code significantly cleaner.

The only downside is that it loses exact preallocation, but this is probably not a big deal.
2019-12-31 02:46:39 -05:00
Henry de Valence 2965187b91 Upgrade tokio, futures, hyper to released versions. 2019-12-13 17:42:15 -05:00
Deirdre Connolly 82e246d87b
Merge pull request #135 from ZcashFoundation/130
On receipt of a Filter(Load|Add|Clear) message, disconnect from peer
2019-12-05 14:06:05 -05:00
Deirdre Connolly d559a3fa52 Return an error result if the filterload msg size is out of bounds 2019-12-05 13:48:42 -05:00
Deirdre Connolly cbd95dfc1f Pass body_len to read_filterload instead of calculating it ourself
This lets us still be generic over the reader trait and we aren't recomputing  again.

Co-Authored-By: Henry de Valence <hdevalence@hdevalence.ca>
2019-12-05 13:48:42 -05:00
Deirdre Connolly 3fbfffeb44 Remove superfluous zcash_(de)serialize impls 2019-12-05 13:48:42 -05:00
Deirdre Connolly 9a0c2198aa Parse out exact/max possible lengths for filterload filters
Add some unit tests that make sure we obey max values.
2019-12-05 13:48:42 -05:00
Deirdre Connolly 78f0b8aab0 Remove NODE_BLOOM service bit
We do not support bloom filters.
2019-12-05 13:48:42 -05:00
Deirdre Connolly 3c26092b01 Read max of 520 bytes for data fields when parsing filteradd messages 2019-12-05 13:48:42 -05:00
Deirdre Connolly 1b8b4d0fac Encode and decode Filter* messages
Also remove stubs related to MerkleBlock and the catchall case for unknown types since we
are finally matching all variants of the Message enum.
2019-12-05 13:48:42 -05:00
Deirdre Connolly 72def27b78 Add FilterLoad, FilterAdd, FilterClear message variants
Also remove MerkleBlock stub, we are no longer supporting it (zcashd doesn't either).
2019-12-05 13:48:42 -05:00
Deirdre Connolly f5aa5f3794 Add Tweak and Filter types 2019-12-05 13:48:42 -05:00
Henry de Valence 36cd6d6e06 cargo fmt 2019-11-27 23:53:36 -05:00
Henry de Valence f58aaac1ae Privately re-export ErrorSlot, ClientRequest in peer.
This means that all sub-modules of `peer` can import everything they need from
the `peer` module itself, without having to be aware of the internal structure
of their sibling modules.
2019-11-27 23:53:36 -05:00
Henry de Valence ad6525574b Rename PeerConnector -> peer::Connector 2019-11-27 23:53:36 -05:00
Henry de Valence 778e49b127 Rename PeerHandshake -> peer::Handshake 2019-11-27 23:53:36 -05:00
Henry de Valence 9ff0fd90dc Rename ServerState -> State.
There's no need to write `Server` every time because it's only used inside of
the server code, and when the handshake service constructs a Server.
2019-11-27 23:53:36 -05:00
Henry de Valence d1b3e8fe6b Rename PeerServer -> peer::Server 2019-11-27 23:53:36 -05:00
Henry de Valence 77191e62f6 Remove outdated fixup note. 2019-11-27 23:53:36 -05:00
Henry de Valence da78603d3a Rename `PeerClient` to `peer::Client`. 2019-11-27 23:53:36 -05:00
Henry de Valence 4fbc8270a2 Move PeerSet initialization into a submodule. 2019-11-27 05:06:01 -05:00
Henry de Valence 6db852fab2 Refactor protocol into internal, external modules.
This commit just moves things around and patches import paths.
2019-11-27 05:06:01 -05:00
Deirdre Connolly 8a9a5ba29b Revert "Add some simple proptests using the Arbitray trait on Requests and Responses, gated to test only"
This reverts commit 5a123acf56.
2019-11-26 19:35:49 -05:00
Deirdre Connolly 6f52fc7773 Add 'Other' opcode matching when parsing Reject messages 2019-11-26 19:35:49 -05:00
Deirdre Connolly dd042cf4d8 Add some simple proptests using the Arbitray trait on Requests and Responses, gated to test only 2019-11-26 19:35:49 -05:00
Deirdre Connolly 6168cb51d7 Prefixed currently unused error variable with underscore 2019-11-26 19:35:49 -05:00
Deirdre Connolly d78ead4a1a Removed unused trait import 2019-11-26 19:35:49 -05:00
Deirdre Connolly b9c27e5683 Handle Response::Error and send Message::Reject generated from a PeerError::Rejected 2019-11-26 19:35:49 -05:00
Deirdre Connolly f5f1fe9bbc Handle incoming Reject messages when we expect a response 2019-11-26 19:35:49 -05:00
Deirdre Connolly efd37300b9 Impl From trait for Responses from generic Error impls
Also include new Response::Error variant.
2019-11-26 19:35:49 -05:00
Deirdre Connolly 9cdef4acf0 Implement From trait for generic Error impls
Also add 'Other' RejectCode variant.
2019-11-26 19:35:49 -05:00
Deirdre Connolly 49c5265d41 Add Rejected variant to PeerError enum, for now 2019-11-26 19:35:49 -05:00
Deirdre Connolly bae9347f6e Rustfmt 2019-11-26 19:35:49 -05:00
Deirdre Connolly ed77aaacd9 Read and write Reject messages
Also change  field type to  as it's unclear if it actually has
to match the set of enum variants we care about.
2019-11-26 19:35:49 -05:00
Deirdre Connolly 189d89a7fc Handle 'mempool' messages as 'GetMempool' requests
With a 'Transactions' response that gets turned into an 'Inv(Vec<InventoryHash::Tx>)' message.

We don't yet handle a response from our peer for a 'mempool', which will have to be
a more generic 'Inv' type because we might receive transaction hashes we don't know about yet.

Pertains to #26
2019-11-18 15:55:25 -05:00
Deirdre Connolly 98079c9d77 Support Mempool message
This does not yet push requests into services that actually respond with transaction
hashes in our node's mempool, which doesn't exist yet.

Pertains to #26
2019-11-18 15:55:25 -05:00
Henry de Valence e63f8b51b1 Fix default port setting. 2019-11-13 18:47:44 -05:00
Henry de Valence 2ac77ab704 fmt 2019-11-13 18:43:18 -05:00