diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 60381891d..49f6ddffc 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -2149,7 +2149,7 @@ func (bc *Blockchain) GetStorageItem(id int32, key []byte) state.StorageItem { return bc.dao.GetStorageItem(id, key) } -// SeekStorage performs seek operation over contract storage. +// SeekStorage performs seek operation over contract storage. Prefix is trimmed in the resulting pair's key. func (bc *Blockchain) SeekStorage(id int32, prefix []byte, cont func(k, v []byte) bool) { bc.dao.Seek(id, storage.SeekRange{Prefix: prefix}, cont) } diff --git a/pkg/core/dao/dao.go b/pkg/core/dao/dao.go index 45bf2c1d4..61c24c3e8 100644 --- a/pkg/core/dao/dao.go +++ b/pkg/core/dao/dao.go @@ -380,7 +380,8 @@ func (dao *Simple) DeleteStorageItem(id int32, key []byte) { // Seek executes f for all storage items matching the given `rng` (matching the given prefix and // starting from the point specified). If the key or the value is to be used outside of f, they -// may not be copied. Seek continues iterating until false is returned from f. +// may not be copied. Seek continues iterating until false is returned from f. A requested prefix +// (if any non-empty) is trimmed before passing to f. func (dao *Simple) Seek(id int32, rng storage.SeekRange, f func(k, v []byte) bool) { rng.Prefix = slice.Copy(dao.makeStorageItemKey(id, rng.Prefix)) // f() can use dao too. dao.Store.Seek(rng, func(k, v []byte) bool { diff --git a/pkg/services/rpcsrv/server.go b/pkg/services/rpcsrv/server.go index bb54fc4a3..4ef84cd1e 100644 --- a/pkg/services/rpcsrv/server.go +++ b/pkg/services/rpcsrv/server.go @@ -114,7 +114,7 @@ type ( } // ContractStorageSeeker is the interface `findstorage*` handlers need to be able to - // seek over contract storage. + // seek over contract storage. Prefix is trimmed in the resulting pair's key. ContractStorageSeeker interface { SeekStorage(id int32, prefix []byte, cont func(k, v []byte) bool) }