From d24dffc0a8ecf7edd1376c2aa0f09224edabfd44 Mon Sep 17 00:00:00 2001 From: "zhanxin.xu" <90450068+1329576606@users.noreply.github.com> Date: Mon, 23 Oct 2023 15:12:23 +0800 Subject: [PATCH] fix log.js iterator fix log.js iterator --- src/oplog/log.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/oplog/log.js b/src/oplog/log.js index 36cc977..506e414 100644 --- a/src/oplog/log.js +++ b/src/oplog/log.js @@ -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)