Skip to content

Commit

Permalink
check that we have all catchup nodes locally (#162)
Browse files Browse the repository at this point in the history
* assert that we have all nodes locally

* throw instead of asserting

* emit warning and clear state if catchup fails

* safetyCatch err in open

* crash when block is not available locally
  • Loading branch information
chm-diederichs authored Jun 24, 2024
1 parent 218d4ce commit b81aa36
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,10 @@ module.exports = class Autobase extends ReadyResource {

if (length > w.end) w.end = length

const block = await w.writer.core.get(length - 1)
// we should have all nodes locally
const block = await w.writer.core.get(length - 1, { wait: false })

assert(block !== null, 'Catchup failed: local block not available')

for (const dep of block.node.heads) {
nodes.push(dep)
Expand Down

0 comments on commit b81aa36

Please sign in to comment.