adder collator updates (#1904)

* Fix adder collator README

* Add trivial logging to show that collator collates

* Update parachain/test-parachains/adder/collator/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Sergei Shulepov
2020-11-02 21:14:33 +01:00
committed by GitHub
parent bcec9f9a99
commit bb71fccdc1
2 changed files with 8 additions and 2 deletions
@@ -3,7 +3,7 @@
First start two validators that will run for the relay chain:
```sh
cargo run --features=real-overseer --release -- -d alice --chain rococo-local --validator --alice --port 50551
cargo run --features=real-overseer --release -- -d bob --chain rococo-local --validator --alice --port 50552
cargo run --features=real-overseer --release -- -d bob --chain rococo-local --validator --bob --port 50552
```
Next start the collator that will collate for the adder parachain:
@@ -100,12 +100,18 @@ impl Collator {
) -> Box<dyn Fn(Hash, &ValidationData) -> Pin<Box<dyn Future<Output = Option<Collation>> + Send>> + Send + Sync> {
let state = self.state.clone();
Box::new(move |_, validation_data| {
Box::new(move |relay_parent, validation_data| {
let parent = HeadData::decode(&mut &validation_data.persisted.parent_head.0[..])
.expect("Decodes parent head");
let (block_data, head_data) = state.lock().unwrap().advance(parent);
log::info!(
"created a new collation on relay-parent({}): {:?}",
relay_parent,
block_data,
);
let collation = Collation {
upward_messages: Vec::new(),
new_validation_code: None,