diff --git a/common/config.go b/common/config.go index 1b24ee5..f4d7ec2 100644 --- a/common/config.go +++ b/common/config.go @@ -160,6 +160,7 @@ const ( CfgSubchainMainchainBlockIntervalInSeconds = "subchain.mainchainBlockIntervalInSeconds" CfgSubchainMainchainWitenessStartScanHeight = "subchain.mainchainWitenessStartScanHeight" CfgSubchainSubchainWitenessStartScanHeight = "subchain.subchainWitenessStartScanHeight" + CfgSubchainForceWitnessStartScanHeight = "subchain.forceWitenessStartScanHeight" // CfgSubchainID defines the subchainID CfgSubchainID = "subchain.chainID" @@ -240,6 +241,7 @@ func init() { viper.SetDefault(CfgSubchainEthRpcURL, "http://127.0.0.1:19888") viper.SetDefault(CfgSubchainMainchainWitenessStartScanHeight, -1) viper.SetDefault(CfgSubchainSubchainWitenessStartScanHeight, -1) + viper.SetDefault(CfgSubchainForceWitnessStartScanHeight, false) viper.SetDefault(CfgSubchainID, 360777) } diff --git a/interchain/witness/metachain_witness.go b/interchain/witness/metachain_witness.go index 565e00f..d03b119 100644 --- a/interchain/witness/metachain_witness.go +++ b/interchain/witness/metachain_witness.go @@ -314,7 +314,8 @@ func (mw *MetachainWitness) collectInterChainMessageEventsOnChain(queriedChainID // mw.getBlockScanStartingHeight(queriedChainID) // testing code fromBlock, err := mw.witnessState.getLastQueryedHeightForType(queriedChainID) - if err == store.ErrKeyNotFound { + forceWitnessStartScanHeight := viper.GetBool(scom.CfgSubchainForceWitnessStartScanHeight) + if forceWitnessStartScanHeight || err == store.ErrKeyNotFound { logger.Infof("Seting the initial block scanning height for chain %v", queriedChainID.String()) if queriedChainID.Cmp(mw.mainchainID) == 0 && viper.GetInt(scom.CfgSubchainMainchainWitenessStartScanHeight) >= 0 { // if the start scanning height is specified in the config, use the config value