From cc823daf44eb917a52e113f617d1416764d6bbb7 Mon Sep 17 00:00:00 2001 From: vyzo Date: Mon, 13 Mar 2023 12:01:04 +0200 Subject: [PATCH] make MsgIndex configurable, disabled by default. --- node/builder_chain.go | 5 ++++- node/config/types.go | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/node/builder_chain.go b/node/builder_chain.go index 20817acff..fcdb26162 100644 --- a/node/builder_chain.go +++ b/node/builder_chain.go @@ -80,7 +80,6 @@ var ChainNode = Options( Override(new(stmgr.Executor), consensus.NewTipSetExecutor(filcns.RewardFunc)), Override(new(consensus.Consensus), filcns.NewFilecoinExpectedConsensus), Override(new(*store.ChainStore), modules.ChainStore), - Override(new(index.MsgIndex), modules.MsgIndex), Override(new(*stmgr.StateManager), modules.StateManager), Override(new(dtypes.ChainBitswap), modules.ChainBitswap), Override(new(dtypes.ChainBlockService), modules.ChainBlockService), // todo: unused @@ -277,6 +276,10 @@ func ConfigFullNode(c interface{}) Option { Override(new(full.EthEventAPI), &full.EthModuleDummy{}), ), ), + + // enable message index for full node when configured by the user, otherwise use dummy. + If(cfg.Index.EnableMsgIndex, Override(new(index.MsgIndex), modules.MsgIndex)), + If(!cfg.Index.EnableMsgIndex, Override(new(index.MsgIndex), modules.DummyMsgIndex)), ) } diff --git a/node/config/types.go b/node/config/types.go index 5b952d35e..51ef327d4 100644 --- a/node/config/types.go +++ b/node/config/types.go @@ -28,6 +28,7 @@ type FullNode struct { Chainstore Chainstore Cluster UserRaftConfig Fevm FevmConfig + Index IndexConfig } // // Common @@ -726,3 +727,8 @@ type Events struct { // Set a timeout for subscription clients // Set upper bound on index size } + +type IndexConfig struct { + // EnableMsgIndex enables indexing of messages on chain. + EnableMsgIndex bool +}