From 5d268ba14a530d4917b6afa7f75facd50093ef9c Mon Sep 17 00:00:00 2001 From: Hugo Trentesaux <hugo@trentesaux.fr> Date: Mon, 19 Jun 2023 16:12:51 +0200 Subject: [PATCH] add manual sealing --- doc/example.md | 4 +++- src/commands/blockchain.rs | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/example.md b/doc/example.md index 0a6f9f8..51cf095 100644 --- a/doc/example.md +++ b/doc/example.md @@ -41,11 +41,13 @@ gcli ud claim gcli account transfer 5000 5E4i8vcNjnrDp21Sbnp32WHm2gz8YP3GGFwmdpfg5bHd8Whb ``` -If you want to submit extrinsics without tracking progress: +For testing purpose it can be useful to submit extrinsic without waiting for result and create block manually. ```sh # only submit extrinsic to network and do not listen to result gcli --no-wait account transfer 1234 5FeggKqw2AbnGZF9Y9WPM2QTgzENS3Hit94Ewgmzdg5a3LNa +# create block manually (with manual sealing) +gcli blockchain create-block ``` ## Indexer commands diff --git a/src/commands/blockchain.rs b/src/commands/blockchain.rs index 7befecd..f64a34c 100644 --- a/src/commands/blockchain.rs +++ b/src/commands/blockchain.rs @@ -18,6 +18,9 @@ pub enum Subcommand { /// Check current block #[default] CurrentBlock, + /// Create one block manually (manual sealing) + #[clap(hide = true)] + CreateBlock, } /// handle blockchain commands @@ -46,6 +49,12 @@ pub async fn handle_command(data: Data, command: Subcommand) -> anyhow::Result<( .unwrap() ); } + Subcommand::CreateBlock => { + data.client() + .rpc() + .request("engine_createBlock", subxt::rpc::rpc_params![true, true]) // create empty block and finalize + .await?; // FIXME this gives a serialization error + } } Ok(()) } -- GitLab