From b44bfa053da24b03b8ba99910b94a78e1dde1812 Mon Sep 17 00:00:00 2001 From: Rinse Date: Mon, 4 Nov 2024 14:06:58 +0000 Subject: [PATCH] change internalState.cid to updateCid --- src/runtime/node/subplebbit/db-handler.ts | 10 ++++++++-- src/subplebbit/rpc-local-subplebbit.ts | 4 ++-- src/subplebbit/types.ts | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/runtime/node/subplebbit/db-handler.ts b/src/runtime/node/subplebbit/db-handler.ts index ba808102..a5d13aa9 100644 --- a/src/runtime/node/subplebbit/db-handler.ts +++ b/src/runtime/node/subplebbit/db-handler.ts @@ -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(); diff --git a/src/subplebbit/rpc-local-subplebbit.ts b/src/subplebbit/rpc-local-subplebbit.ts index 5178e3bb..28c64d8e 100644 --- a/src/subplebbit/rpc-local-subplebbit.ts +++ b/src/subplebbit/rpc-local-subplebbit.ts @@ -67,7 +67,7 @@ export class RpcLocalSubplebbit extends RpcRemoteSubplebbit implements RpcIntern return { ...this.toJSONIpfs(), ...this.toJSONInternalRpcBeforeFirstUpdate(), - cid: this.updateCid + updateCid: this.updateCid }; } @@ -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"]) { diff --git a/src/subplebbit/types.ts b/src/subplebbit/types.ts index 4436c52d..dcac23a2 100644 --- a/src/subplebbit/types.ts +++ b/src/subplebbit/types.ts @@ -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