fix log.js iterator

fix log.js iterator
This commit is contained in:
zhanxin.xu 2023-10-23 15:12:23 +08:00 committed by GitHub
parent 9b8bcb7257
commit d24dffc0a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -434,7 +434,7 @@ const Log = async (identity, { logId, logHeads, access, entryStorage, headsStora
if (useBuffer) {
const endIndex = buffer.keys.length
const startIndex = endIndex - amount
const startIndex = endIndex > amount ? endIndex - amount : 0
const keys = buffer.keys.slice(startIndex, endIndex)
for (const key of keys) {
const hash = buffer.get(key)