docs: Small crate readme tweaks

* Fix a few small typos in the txsubmission readme

* Link to txsubmission readme from crate readme

* Other small tweaks
This commit is contained in:
Pi Lanningham 2023-02-05 06:13:06 -05:00 committed by GitHub
parent 8e45f13373
commit d869169e68
2 changed files with 14 additions and 15 deletions

View file

@ -12,15 +12,15 @@ The following architectural decisions were made for this particular Rust impleme
## Development Status ## Development Status
| mini-protocol | initiator | responder | | mini-protocol | initiator | responder |
| ------------------- | --------- | --------- | | ------------------------------------------------- | --------- | --------- |
| block-fetch | done | planned | | block-fetch | done | planned |
| chain-sync | done | planned | | chain-sync | done | planned |
| handshake | done | planned | | handshake | done | planned |
| local-state | done | planned | | local-state | done | planned |
| tx-submission | planned | minimal | | [tx-submission](src/txsubmission/README.md) | done | done |
| local tx monitor | done | planned | | local tx monitor | done | planned |
| local-tx-submission | ongoing | planned | | local-tx-submission | ongoing | planned |
## Implementation Details ## Implementation Details

View file

@ -161,7 +161,7 @@ And wait for a response
You can download those transactions with You can download those transactions with
```rust ```rust
server.request_txs(ids.iter().map(|tx_and_size| tx_and_size.0).collect()); server.request_txs(ids.iter().map(|tx_and_size| tx_and_size.0.clone()).collect());
``` ```
After you receive some transaction Ids, if you request more you should acknowledge the ones you received After you receive some transaction Ids, if you request more you should acknowledge the ones you received
@ -175,16 +175,15 @@ All-together, this event loop could look something like this:
```rust ```rust
let mut server = txsubmission::Server::new(channel4); let mut server = txsubmission::Server::new(channel4);
server.wait_for_init()?; server.wait_for_init()?;
let mut previous_count = 0; server.acknowledge_and_request_ids(true, 0, 16)?;
server.acknowledge_and_request_ids(true, previous_count, 16);
loop { loop {
match server.receive_next_reply()? { match server.receive_next_reply()? {
Reply::TxIds(ids_and_sizes) => { Reply::TxIds(ids_and_sizes) => {
server.request_txs(ids_and_sizes.iter().map(|tx| tx.0).collect())?; server.request_txs(ids_and_sizes.iter().map(|tx| tx.0.clone()).collect())?;
}, },
Reply::Txs(txs) => { Reply::Txs(txs) => {
tx_channel.send(txs); tx_channel.send(txs);
server.acknowledge_and_request_ids(true, txs.len(), 16)?; server.acknowledge_and_request_ids(true, txs.len() as usize, 16)?;
}, },
Reply::Done => { Reply::Done => {
break; break;