[#184] *: Cast to struct `iterator.Value() k/v pair

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
enable-notary-in-public-chains
Pavel Karpy 2021-12-01 20:28:58 +03:00 committed by Alex Vanin
parent 5e604b6f8b
commit 53a6b198d9
2 changed files with 10 additions and 8 deletions

View File

@ -521,10 +521,11 @@ func ListConfig() []record {
it := storage.Find(ctx, configPrefix, storage.None)
for iterator.Next(it) {
pair := iterator.Value(it).([]interface{})
key := pair[0].([]byte)
val := pair[1].([]byte)
r := record{key: key[len(configPrefix):], val: val}
pair := iterator.Value(it).(struct {
key []byte
val []byte
})
r := record{key: pair.key[len(configPrefix):], val: pair.val}
config = append(config, r)
}

View File

@ -482,10 +482,11 @@ func ListConfig() []record {
it := storage.Find(ctx, configPrefix, storage.None)
for iterator.Next(it) {
pair := iterator.Value(it).([]interface{})
key := pair[0].([]byte)
val := pair[1].([]byte)
r := record{key: key[len(configPrefix):], val: val}
pair := iterator.Value(it).(struct {
key []byte
val []byte
})
r := record{key: pair.key[len(configPrefix):], val: pair.val}
config = append(config, r)
}