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 97727ce107
commit f795948d2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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
| mini-protocol | initiator | responder |
| ------------------- | --------- | --------- |
| block-fetch | done | planned |
| chain-sync | done | planned |
| handshake | done | planned |
| local-state | done | planned |
| tx-submission | planned | minimal |
| local tx monitor | done | planned |
| local-tx-submission | ongoing | planned |
| mini-protocol | initiator | responder |
| ------------------------------------------------- | --------- | --------- |
| block-fetch | done | planned |
| chain-sync | done | planned |
| handshake | done | planned |
| local-state | done | planned |
| [tx-submission](src/txsubmission/README.md) | done | done |
| local tx monitor | done | planned |
| local-tx-submission | ongoing | planned |
## Implementation Details

View file

@ -161,7 +161,7 @@ And wait for a response
You can download those transactions with
```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
@ -175,20 +175,19 @@ All-together, this event loop could look something like this:
```rust
let mut server = txsubmission::Server::new(channel4);
server.wait_for_init()?;
let mut previous_count = 0;
server.acknowledge_and_request_ids(true, previous_count, 16);
server.acknowledge_and_request_ids(true, 0, 16)?;
loop {
match server.receive_next_reply()? {
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) => {
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 => {
break;
}
}
}
```
```