mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-19 06:31:57 +00:00
don't return false positives when searching for a prefix of a tag value (#2919)
Fixes #2908
This commit is contained in:
committed by
Ethan Buchman
parent
bef39f3346
commit
92dc5fc77a
@@ -37,6 +37,7 @@ program](https://hackerone.com/tendermint).
|
|||||||
- [blockchain] \#2731 Retry both blocks if either is bad to avoid getting stuck during fast sync (@goolAdapter)
|
- [blockchain] \#2731 Retry both blocks if either is bad to avoid getting stuck during fast sync (@goolAdapter)
|
||||||
- [log] \#2868 fix module=main setting overriding all others
|
- [log] \#2868 fix module=main setting overriding all others
|
||||||
- [rpc] \#2808 RPC validators calls IncrementAccum if necessary
|
- [rpc] \#2808 RPC validators calls IncrementAccum if necessary
|
||||||
|
- [kv indexer] \#2908 don't return false positives when searching for a prefix of a tag value
|
||||||
- [kv indexer] \#2775 order results by index if height is the same
|
- [kv indexer] \#2775 order results by index if height is the same
|
||||||
- [rpc] \#2759 fix tx.height range queries
|
- [rpc] \#2759 fix tx.height range queries
|
||||||
- [rpc] \#2811 Allow integer IDs in JSON-RPC requests
|
- [rpc] \#2811 Allow integer IDs in JSON-RPC requests
|
||||||
@@ -412,9 +412,9 @@ LOOP:
|
|||||||
func startKey(c query.Condition, height int64) []byte {
|
func startKey(c query.Condition, height int64) []byte {
|
||||||
var key string
|
var key string
|
||||||
if height > 0 {
|
if height > 0 {
|
||||||
key = fmt.Sprintf("%s/%v/%d", c.Tag, c.Operand, height)
|
key = fmt.Sprintf("%s/%v/%d/", c.Tag, c.Operand, height)
|
||||||
} else {
|
} else {
|
||||||
key = fmt.Sprintf("%s/%v", c.Tag, c.Operand)
|
key = fmt.Sprintf("%s/%v/", c.Tag, c.Operand)
|
||||||
}
|
}
|
||||||
return []byte(key)
|
return []byte(key)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ func TestTxSearch(t *testing.T) {
|
|||||||
{"account.number = 1 AND account.owner = 'Ivan'", 1},
|
{"account.number = 1 AND account.owner = 'Ivan'", 1},
|
||||||
// search by exact match (two tags)
|
// search by exact match (two tags)
|
||||||
{"account.number = 1 AND account.owner = 'Vlad'", 0},
|
{"account.number = 1 AND account.owner = 'Vlad'", 0},
|
||||||
|
// search using a prefix of the stored value
|
||||||
|
{"account.owner = 'Iv'", 0},
|
||||||
// search by range
|
// search by range
|
||||||
{"account.number >= 1 AND account.number <= 5", 1},
|
{"account.number >= 1 AND account.number <= 5", 1},
|
||||||
// search by range (lower bound)
|
// search by range (lower bound)
|
||||||
|
|||||||
Reference in New Issue
Block a user