Skip to content

Commit

Permalink
Fix to ensure peers persist genesis state
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed Dec 1, 2024
1 parent 4a544db commit dc70382
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions convex-peer/src/main/java/convex/peer/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,11 @@ public Peer persistPeerData() throws IOException {
AMap<ACell,ACell> newRootData = currentRootData.assoc(rootKey, peerData);

newRootData=store.setRootData(newRootData).getValue();

// ensure specific values are persisted, might be needed for lookup
store.storeTopRef(peer.getGenesisState().getRef(), Ref.PERSISTED, null);
store.storeTopRef(peer.getBelief().getRef(), Ref.PERSISTED, null);

peerData=(AMap<Keyword, ACell>) newRootData.get(rootKey);
log.debug( "Stored peer data with hash: {}", peerData.getHash().toHexString());
return Peer.fromData(getKeyPair(), peerData);
Expand Down

0 comments on commit dc70382

Please sign in to comment.