8000 (txi *TxIndex) Search returns tocal_count 0 if tx is found by hash · Issue #5219 · cometbft/cometbft · GitHub 8000
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
(txi *TxIndex) Search returns tocal_count 0 if tx is found by hash #5219
Open
@webmaster128

Description

@webmaster128

Bug Report

Setup

CometBFT version (use cometbft version or git rev-parse --verify HEAD if installed from source):
v1.0.1 (through DockerHub cometbft/cometbft:v1.x)

Have you tried the latest version: no

ABCI app (name for built-in, URL for self-written if it's publicly available):
PROXY_APP=kvstore

Environment:

  • OS (e.g. from /etc/os-release):
  • Install tools:
  • Others:

node command runtime flags:

Config

kv indexer enabled

What happened?

A tx seach with 1 result has tocal_count of 1

What did you expect to happen?

I get a tx result but a total_count of 0:

{
  txs: [
    {
      hash: 'B2580F8F02A7EACFE866E644527AA234840369DD32C0AA62E0B0D943C2653407',
      height: '4522',
      index: 0,
      tx_result: [Object],
      tx: 'UXJrcGx4aGw3R0E4PWsyOTVuUURCYzdJSQ=='
    }
  ],
  total_count: '0'
}

How to reproduce it

Logs

dump_consensus_state output

Anything else we need to know

I would say there is clearly a bug in the result count argument in this code. I would assume this is the fix:

diff --git a/state/txindex/kv/kv.go b/state/txindex/kv/kv.go
index c5f06486e..04795f1f5 100644
--- a/state/txindex/kv/kv.go
+++ b/state/txindex/kv/kv.go
@@ -476,7 +476,7 @@ func (txi *TxIndex) Search(ctx context.Context, q *query.Query, pagSettings txin
                case res == nil:
                        return []*abci.TxResult{}, 0, nil
                default:
-                       return []*abci.TxResult{res}, 0, nil
+                       return []*abci.TxResult{res}, 1, nil
                }
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageThis issue/PR has not yet been triaged by the team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0