From 275284b822c6aa4dfea55591dc39652cde6bfa7c Mon Sep 17 00:00:00 2001
From: librelois <c@elo.tf>
Date: Sun, 23 Jan 2022 14:12:26 +0100
Subject: [PATCH] fix(node):force offchain worker & offchain indexing if role
 is authority

---
 node/src/command.rs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/node/src/command.rs b/node/src/command.rs
index 3d16d9cab..0c1339030 100644
--- a/node/src/command.rs
+++ b/node/src/command.rs
@@ -245,7 +245,13 @@ pub fn run() -> sc_cli::Result<()> {
         }
         None => {
             let runner = cli.create_runner(&cli.run)?;
-            runner.run_node_until_exit(|config| async move {
+            runner.run_node_until_exit(|mut config| async move {
+                // Force offchain worker and offchain indexing if we have the role Authority
+                if config.role.is_authority() {
+                    config.offchain_worker.enabled = true;
+                    config.offchain_worker.indexing_enabled = true;
+                }
+
                 match config.chain_spec.runtime_type() {
                     #[cfg(feature = "g1")]
                     RuntimeType::G1 => {
-- 
GitLab