Skip to content

Conversation

@julienmalard
Copy link
Contributor

@julienmalard julienmalard commented Nov 4, 2025

This pull request fixes an error caused by libp2p node disconnection between the reception of a database entry and the persistence of the same entry in the IPFS blockstore.

This is caused by the following chain of events:

  1. The database receives the entry and calls joinEntryon the log.
  2. The log calls oplogStore.addVerified.
  3. addVerified then calls await _entries.persist(hash) on the IPFS blockstore. If, by now, the underlying libp2p nodes are disconnected, the call to persist on the IPFS blockstore will hang, even if the OrbitDB node has already received the full entry, because this entry has not yet been added to the local IPFS node and the call to pin will attempt to retrieve the entry by its hash from the wider IPFS network, where it is no longer available.

This pull request fixes the issue with two changes:

  1. In log.js, oplogStore.addHead is now called before oplogStore.addVerified
  2. In oplog-store.js, addHead now explicitly adds the new head to the _entries storage.

julienmalard added a commit to reseau-constellation/ipa that referenced this pull request Nov 14, 2025
@haydenyoung
Copy link
Member

@haadcode This looks good to me. Ready to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants