File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed
Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,9 @@ func LoadConfig(cfgFile string) error {
9494 panic (err )
9595 }
9696
97+ // Set default values for viper-managed configs
98+ viper .SetDefault ("rpc.blockReceipts.enabled" , true )
99+
97100 if cfgFile != "" {
98101 viper .SetConfigFile (cfgFile )
99102 if err := viper .ReadInConfig (); err != nil {
Original file line number Diff line number Diff line change @@ -181,19 +181,18 @@ func (rpc *Client) checkGetBlockByNumberSupport() error {
181181}
182182
183183func (rpc * Client ) checkGetBlockReceiptsSupport () error {
184- if config .Cfg .RPC .BlockReceipts .Enabled {
185- var getBlockReceiptsResult interface {}
186- receiptsErr := rpc .RPCClient .Call (& getBlockReceiptsResult , "eth_getBlockReceipts" , "latest" )
187- if receiptsErr != nil {
188- log .Warn ().Err (receiptsErr ).Msg ("eth_getBlockReceipts method not supported" )
189- return fmt .Errorf ("eth_getBlockReceipts method not supported: %v" , receiptsErr )
190- } else {
191- rpc .supportsBlockReceipts = true
192- log .Debug ().Msg ("eth_getBlockReceipts method supported" )
193- }
194- } else {
184+ // Always probe to see if the method is supported
185+ var getBlockReceiptsResult interface {}
186+ receiptsErr := rpc .RPCClient .Call (& getBlockReceiptsResult , "eth_getBlockReceipts" , "latest" )
187+
188+ if receiptsErr != nil {
189+ // Method not supported by RPC endpoint
195190 rpc .supportsBlockReceipts = false
196- log .Debug ().Msg ("eth_getBlockReceipts method disabled" )
191+ log .Warn ().Err (receiptsErr ).Msg ("eth_getBlockReceipts method not supported by RPC endpoint" )
192+ } else {
193+ // Method supported and enabled
194+ rpc .supportsBlockReceipts = true
195+ log .Info ().Msg ("eth_getBlockReceipts method enabled" )
197196 }
198197 return nil
199198}
You can’t perform that action at this time.
0 commit comments