ipfs / ipfs/helia

Restoring pinned data from BlockstoreIDB

Open
#172 2 comments 0 reactions 0 assignees View on GitHub
kind/bug need/analysis need/maintainers-input
Dominant language
TypeScript
Stars
1.3k
Forks
159
Avg merge
2h 11m
Merged PRs (30d)
16

Description

Hey everyone,

I'm having issues restoring the stored data using BlockstoreIDB.
When creating my node I'm initializing the Blockstore like so:

```
let localSafedBlockstore = window.localStorage.getItem("blockstore");

if (!localSafedBlockstore) {
localSafedBlockstore = "blockstore-" + window.crypto.randomUUID();
window.localStorage.setItem("blockstore", localSafedBlockstore);
}

const blockstore = new IDBBlockstore(localSafedBlockstore);
await blockstore.open();
```

When I look into the IndexedDB in my Browser, everything is created as expected using `helia.pins.add(cid)`.
However, when i restart my node, the contents of IDB is not pinned again so others nodes do not know about it.
Do I have to repin the data again when restarting the node? Or do I have to intialize the blockstore in a special way when restarting the node?

EDIT: I tried to repin the data when restarting the node but it doesn't change anything.
```
for await (const item of helia.blockstore.getAll()) {
const cid = await fs.addBytes(item.block);
helia.pins.add(cid);
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.