From 46e06c97320bc61c4d98d3018f59d47ec69863c9 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Sat, 3 Apr 2021 12:18:54 -0400 Subject: [PATCH] state: fix block event indexing reserved key check (#6314) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit copy 🍝 bug when porting similar logic from the tx indexing code. --- state/indexer/block/kv/kv.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/state/indexer/block/kv/kv.go b/state/indexer/block/kv/kv.go index 916c5f8ae..901f0e1d2 100644 --- a/state/indexer/block/kv/kv.go +++ b/state/indexer/block/kv/kv.go @@ -469,9 +469,10 @@ func (idx *BlockerIndexer) indexEvents(batch dbm.Batch, events []abci.Event, typ // index iff the event specified index:true and it's not a reserved event compositeKey := fmt.Sprintf("%s.%s", event.Type, string(attr.Key)) - if compositeKey == types.TxHashKey || compositeKey == types.TxHeightKey { + if compositeKey == types.BlockHeightKey { return fmt.Errorf("event type and attribute key \"%s\" is reserved; please use a different key", compositeKey) } + if attr.GetIndex() { key, err := eventKey(compositeKey, typ, string(attr.Value), height) if err != nil {