Skip to content

add a flag to disable/enable tx indexer#175

Closed
tak1827 wants to merge 1 commit intomainfrom
feat/disable-txindexer
Closed

add a flag to disable/enable tx indexer#175
tak1827 wants to merge 1 commit intomainfrom
feat/disable-txindexer

Conversation

@tak1827
Copy link
Contributor

@tak1827 tak1827 commented Nov 11, 2025

TxIndexerをDefaultでDisableにした。
パフォーマンスが落ちるらしいから
RPCとか向けにFlagでEnableにできるようにした。

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new flag --history.disabletxindexer to allow disabling the transaction indexer by default for performance optimization, particularly benefiting validators and full nodes. The flag defaults to true (disabled), and can be explicitly enabled for RPC and explorer nodes that require transaction lookup capabilities.

Key Changes:

  • Added DisableTxIndexerFlag that defaults to true to disable tx indexing by default
  • Implemented conflict resolution logic to override the disable flag when transaction history flags are explicitly set
  • Registered the new flag in the main application flags list

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
cmd/utils/flags.go Defines the new DisableTxIndexerFlag and implements logic to handle the flag with conflict resolution for transaction history settings
cmd/geth/main.go Registers the new flag in the application's flag list

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

} else if ctx.IsSet(TxLookupLimitFlag.Name) {
log.Warn("The flag --txlookuplimit is deprecated and will be removed, please use --history.transactions")
if cfg.DisableTxIndexer {
log.Warn("Disabling transaction indexing is not allowed when --txlookuplimit is set")
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning message could be more helpful by providing actionable guidance. Consider revising to:

log.Warn("Transaction indexing cannot be disabled when --txlookuplimit is set. Keeping transaction indexer enabled.")

This makes it clearer what the actual outcome is (indexer stays enabled) rather than just stating what is "not allowed".

Suggested change
log.Warn("Disabling transaction indexing is not allowed when --txlookuplimit is set")
log.Warn("Transaction indexing cannot be disabled when --txlookuplimit is set. Keeping transaction indexer enabled.")

Copilot uses AI. Check for mistakes.
Comment on lines +2022 to +2023
if ctx.IsSet(DisableTxIndexerFlag.Name) {
cfg.DisableTxIndexer = ctx.Bool(DisableTxIndexerFlag.Name)
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The ctx.IsSet() check prevents the default value of the flag from being applied. Since DisableTxIndexerFlag.Value is true (default), users who don't explicitly set the flag will not get the intended default behavior (tx indexer disabled).

The logic should be changed to:

cfg.DisableTxIndexer = ctx.Bool(DisableTxIndexerFlag.Name)
if cfg.DisableTxIndexer {
    cfg.TransactionHistory = 0
}

This way, the flag's default value (true) will be properly applied even when the flag is not explicitly set, ensuring the tx indexer is disabled by default as intended.

Suggested change
if ctx.IsSet(DisableTxIndexerFlag.Name) {
cfg.DisableTxIndexer = ctx.Bool(DisableTxIndexerFlag.Name)
cfg.DisableTxIndexer = ctx.Bool(DisableTxIndexerFlag.Name)
if cfg.DisableTxIndexer {

Copilot uses AI. Check for mistakes.
}
if ctx.IsSet(TransactionHistoryFlag.Name) {
if cfg.DisableTxIndexer {
log.Warn("Disabling transaction indexing is not allowed when --history.transactions is set")
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning message could be more helpful by providing actionable guidance. Consider revising to:

log.Warn("Transaction indexing cannot be disabled when --history.transactions is set. Keeping transaction indexer enabled.")

This makes it clearer what the actual outcome is (indexer stays enabled) rather than just stating what is "not allowed".

Suggested change
log.Warn("Disabling transaction indexing is not allowed when --history.transactions is set")
log.Warn("Transaction indexing cannot be disabled when --history.transactions is set. Keeping transaction indexer enabled.")

Copilot uses AI. Check for mistakes.
Base automatically changed from feat/merge-bsc-v1.6.0-alpha to main November 27, 2025 02:44
@tak1827
Copy link
Contributor Author

tak1827 commented Dec 18, 2025

やっぱりいらないかも。

@tak1827 tak1827 closed this Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant