Skip to content

Commit

Permalink
change internalState.cid to updateCid
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinse12 committed Nov 4, 2024
1 parent 73b6266 commit b44bfa0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/runtime/node/subplebbit/db-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,15 @@ export class DbHandler {
"_usingDefaultChallenge" in internalState
? internalState._usingDefaultChallenge //@ts-expect-error
: remeda.isDeepEqual(this._subplebbit._defaultSubplebbitChallenges, internalState?.settings?.challenges);
const updateCid = ("cid" in internalState && internalState.cid) || "QmYHzA8euDgUpNy3fh7JRwpPwt6jCgF35YTutYkyGGyr8f"; // this is a random cid, should be overridden later by local-subplebbit
const updateCid =
("updateCid" in internalState && internalState.updateCid) || "QmYHzA8euDgUpNy3fh7JRwpPwt6jCgF35YTutYkyGGyr8f"; // this is a random cid, should be overridden later by local-subplebbit
//@ts-expect-error
await this._subplebbit._updateDbInternalState({ posts: undefined, updateCid, protocolVersion, _usingDefaultChallenge });
await this._subplebbit._updateDbInternalState({
posts: undefined,
updateCid,
protocolVersion,
_usingDefaultChallenge
});
}
}
const newDbVersion = await this.getDbVersion();
Expand Down
4 changes: 2 additions & 2 deletions src/subplebbit/rpc-local-subplebbit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class RpcLocalSubplebbit extends RpcRemoteSubplebbit implements RpcIntern
return {
...this.toJSONIpfs(),
...this.toJSONInternalRpcBeforeFirstUpdate(),
cid: this.updateCid
updateCid: this.updateCid
};
}

Expand Down Expand Up @@ -98,7 +98,7 @@ export class RpcLocalSubplebbit extends RpcRemoteSubplebbit implements RpcIntern
} else await super.initRemoteSubplebbitPropsNoMerge(newProps);

await this.initRpcInternalSubplebbitBeforeFirstUpdateNoMerge(newProps);
this.updateCid = newProps.cid;
this.updateCid = newProps.updateCid;
}

protected _setStartedState(newState: RpcLocalSubplebbit["startedState"]) {
Expand Down
2 changes: 1 addition & 1 deletion src/subplebbit/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export interface InternalSubplebbitRecordBeforeFirstUpdateType extends CreateNew
}

export interface InternalSubplebbitRecordAfterFirstUpdateType extends InternalSubplebbitRecordBeforeFirstUpdateType, SubplebbitIpfsType {
cid: string;
updateCid: string;
}

// RPC server transmitting Internal Subplebbit records to clients
Expand Down

0 comments on commit b44bfa0

Please sign in to comment.