File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -163,7 +163,10 @@ func (pi *prefixIterator) Key() (key []byte) {
163163 }
164164
165165 key = pi .iter .Key ()
166- key = stripPrefix (key , pi .prefix )
166+ key , ok := bytes .CutPrefix (key , pi .prefix )
167+ if ! ok {
168+ panic ("should not happen" )
169+ }
167170
168171 return
169172}
@@ -192,15 +195,6 @@ func (pi *prefixIterator) Error() error {
192195 return nil
193196}
194197
195- // stripPrefix is copied from github.com/cometbft/cometbft/libs/db/prefix_db.go
196- func stripPrefix (key , prefix []byte ) []byte {
197- if len (key ) < len (prefix ) || ! bytes .Equal (key [:len (prefix )], prefix ) {
198- panic ("should not happen" )
199- }
200-
201- return key [len (prefix ):]
202- }
203-
204198// cpIncr wraps the bytes in types.PrefixEndBytes
205199func cpIncr (bz []byte ) []byte {
206200 return types .PrefixEndBytes (bz )
You can’t perform that action at this time.
0 commit comments