mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-06-27 08:22:31 +00:00
fix: Check for new heads.
This commit is contained in:
parent
8fc5b77c51
commit
4a5c59449b
@ -25,6 +25,8 @@ const Heads = async ({ storage, heads }) => {
|
||||
}
|
||||
const newHeads = findHeads([...currentHeads, head])
|
||||
await set(newHeads)
|
||||
|
||||
return newHeads
|
||||
}
|
||||
|
||||
const iterator = async function * () {
|
||||
|
@ -222,8 +222,14 @@ const Log = async (identity, { logId, logHeads, access, entryStorage, headsStora
|
||||
if (!isValid) {
|
||||
throw new Error(`Could not validate signature for entry "${entry.hash}"`)
|
||||
}
|
||||
|
||||
// Add the new entry to heads (union with current heads)
|
||||
await _heads.add(entry)
|
||||
const newHeads = await _heads.add(entry)
|
||||
|
||||
if (!newHeads) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Add the new entry to the entry storage
|
||||
await _entries.put(entry.hash, entry.bytes)
|
||||
// Add the new entry to the entry index
|
||||
|
Loading…
x
Reference in New Issue
Block a user