mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-21 07:24:36 +00:00
add missing element (tag.Value) to keyForTag
encoded as %s. not sure this will work with raw bytes
This commit is contained in:
committed by
Ethan Buchman
parent
e7747f7d66
commit
bb2bdbc0e1
@@ -377,7 +377,7 @@ func extractValueFromKey(key []byte) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func keyForTag(tag cmn.KVPair, result *types.TxResult) []byte {
|
func keyForTag(tag cmn.KVPair, result *types.TxResult) []byte {
|
||||||
return []byte(fmt.Sprintf("%s/%d/%d", tag.Key, result.Height, result.Index))
|
return []byte(fmt.Sprintf("%s/%s/%d/%d", tag.Key, tag.Value, result.Height, result.Index))
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ func TestTxSearch(t *testing.T) {
|
|||||||
indexer := NewTxIndex(db.NewMemDB(), IndexTags(allowedTags))
|
indexer := NewTxIndex(db.NewMemDB(), IndexTags(allowedTags))
|
||||||
|
|
||||||
txResult := txResultWithTags([]cmn.KVPair{
|
txResult := txResultWithTags([]cmn.KVPair{
|
||||||
{Key: []byte("account.number"), Value: []byte{1}},
|
{Key: []byte("account.number"), Value: []byte("1")},
|
||||||
{Key: []byte("account.owner"), Value: []byte("Ivan")},
|
{Key: []byte("account.owner"), Value: []byte("Ivan")},
|
||||||
{Key: []byte("not_allowed"), Value: []byte("Vlad")},
|
{Key: []byte("not_allowed"), Value: []byte("Vlad")},
|
||||||
})
|
})
|
||||||
@@ -108,8 +108,8 @@ func TestTxSearchOneTxWithMultipleSameTagsButDifferentValues(t *testing.T) {
|
|||||||
indexer := NewTxIndex(db.NewMemDB(), IndexTags(allowedTags))
|
indexer := NewTxIndex(db.NewMemDB(), IndexTags(allowedTags))
|
||||||
|
|
||||||
txResult := txResultWithTags([]cmn.KVPair{
|
txResult := txResultWithTags([]cmn.KVPair{
|
||||||
{Key: []byte("account.number"), Value: []byte{1}},
|
{Key: []byte("account.number"), Value: []byte("1")},
|
||||||
{Key: []byte("account.number"), Value: []byte{2}},
|
{Key: []byte("account.number"), Value: []byte("2")},
|
||||||
})
|
})
|
||||||
|
|
||||||
err := indexer.Index(txResult)
|
err := indexer.Index(txResult)
|
||||||
@@ -127,7 +127,7 @@ func TestIndexAllTags(t *testing.T) {
|
|||||||
|
|
||||||
txResult := txResultWithTags([]cmn.KVPair{
|
txResult := txResultWithTags([]cmn.KVPair{
|
||||||
cmn.KVPair{[]byte("account.owner"), []byte("Ivan")},
|
cmn.KVPair{[]byte("account.owner"), []byte("Ivan")},
|
||||||
cmn.KVPair{[]byte("account.number"), []byte{1}},
|
cmn.KVPair{[]byte("account.number"), []byte("1")},
|
||||||
})
|
})
|
||||||
|
|
||||||
err := indexer.Index(txResult)
|
err := indexer.Index(txResult)
|
||||||
|
|||||||
Reference in New Issue
Block a user