Go to file
Henry de Valence 3f150eb16e
network: implement transaction request handling. (#1016)
This commit makes several related changes to the network code:

- adds a `TransactionsByHash(HashSet<transaction::Hash>)` request and
  `Transactions(Vec<Arc<Transaction>>)` response pair that allows
  fetching transactions from a remote peer;

- adds a `PushTransaction(Arc<Transaction>)` request that pushes an
  unsolicited transaction to a remote peer;

- adds an `AdvertiseTransactions(HashSet<transaction::Hash>)` request
  that advertises transactions by hash to a remote peer;

- adds an `AdvertiseBlock(block::Hash)` request that advertises a block
  by hash to a remote peer;

Then, it modifies the connection state machine so that outbound
requests to remote peers are handled properly:

- `TransactionsByHash` generates a `getdata` message and collects the
  results, like the existing `BlocksByHash` request.

- `PushTransaction` generates a `tx` message, and returns `Nil` immediately.

- `AdvertiseTransactions` and `AdvertiseBlock` generate an `inv`
  message, and return `Nil` immediately.

Next, it modifies the connection state machine so that messages
from remote peers generate requests to the inbound service:

- `getdata` messages generate `BlocksByHash` or `TransactionsByHash`
  requests, depending on the content of the message;

- `tx` messages generate `PushTransaction` requests;

- `inv` messages generate `AdvertiseBlock` or `AdvertiseTransactions`
  requests.

Finally, it refactors the request routing logic for the peer set to
handle advertisement messages, providing three routing methods:

- `route_p2c`, which uses p2c as normal (default);
- `route_inv`, which uses the inventory registry and falls back to p2c
  (used for `BlocksByHash` or `TransactionsByHash`);
- `route_all`, which broadcasts a request to all ready peers (used for
  `AdvertiseBlock` and `AdvertiseTransactions`).
2020-09-08 10:16:29 -07:00
.github Move coverage step to common workflow for PRs and pushes to main (#984) 2020-09-01 13:47:34 -07:00
book Rename old references to BlockHeaderHash and BlockHeight (#1002) 2020-09-04 15:40:48 -07:00
design Update data-flow.md 2020-08-04 22:44:39 -07:00
tower-batch zebra-state: Add support for temporary sled databases (#939) 2020-08-31 18:32:55 +10:00
tower-fallback build(deps): bump pin-project from 0.4.22 to 0.4.23 2020-07-28 17:27:25 -04:00
zebra-chain network: add Network::default_port(). 2020-09-07 11:13:15 -07:00
zebra-client Align crate versions and user-agent with NU numbers. 2020-07-24 11:46:37 -07:00
zebra-consensus Rename old references to BlockHeaderHash and BlockHeight (#1002) 2020-09-04 15:40:48 -07:00
zebra-network network: implement transaction request handling. (#1016) 2020-09-08 10:16:29 -07:00
zebra-rpc Align crate versions and user-agent with NU numbers. 2020-07-24 11:46:37 -07:00
zebra-script fix: Remove redundant ConsensusBranchId constants 2020-08-20 14:52:09 -04:00
zebra-state Rename old references to BlockHeaderHash and BlockHeight (#1002) 2020-09-04 15:40:48 -07:00
zebra-test Remove in-memory state service (#974) 2020-09-01 12:39:04 -07:00
zebra-utils Add log filters which provide block info 2020-09-02 12:12:58 -04:00
zebrad Add test for metrics and tracing endpoints (#1000) 2020-09-07 17:05:23 -07:00
.firebaserc Try building internal docs. 2020-02-10 18:12:43 -08:00
.gitignore Add .cargo to the gitignore file 2020-08-28 20:14:12 -04:00
CONTRIBUTING.md Add issue and PR templates, document RFC process 2020-08-31 00:58:50 -04:00
Cargo.lock build(deps): bump indexmap from 1.5.2 to 1.6.0 2020-09-07 07:56:39 -04:00
Cargo.toml Refactor tracing components (#834) 2020-08-06 10:29:31 -07:00
Dockerfile Explicitly pass our config to the start command 2020-09-04 01:02:32 -04:00
LICENSE-APACHE Add copyright marks on each license 2019-11-14 11:50:49 -08:00
LICENSE-MIT Add copyright marks on each license 2019-11-14 11:50:49 -08:00
README.md Reorganize the book. (#843) 2020-08-06 15:39:54 -07:00
clippy.toml Apply clippy fixes 2020-02-05 12:42:32 -08:00
cloudbuild.yaml Fix CD workflow using cloudbuild.yaml (#637) 2020-07-10 07:37:54 -04:00
codecov.yml Turn off the CodeCov PR comment, metrics available in the checks results which link to codecov.io 2020-07-24 18:18:46 -04:00
firebase.json Configure redirect for firebase hosting 2020-01-16 18:38:16 -05:00
katex-header.html Add KaTeX to rendered docs. (#832) 2020-08-05 17:34:30 -07:00
prometheus.yaml Tell Prometheus to scrape more aggressively 2020-02-14 20:14:05 -05:00

README.md

Zebra logotype


codecov License

Hello! I am Zebra, an ongoing Rust implementation of a Zcash node.

Zebra is a work in progress. It is developed as a collection of zebra-* libraries implementing the different components of a Zcash node (networking, chain structures, consensus rules, etc), and a zebrad binary which uses them.

Most of our work so far has gone into zebra-network, building a new networking stack for Zcash, zebra-chain, building foundational data structures, zebra-consensus, implementing consensus rules, and zebra-state, providing chain state.

Zebra Website.

Rendered docs from the main branch.

Join us on Discord.

License

Zebra is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT.