Closed sitetester closed 9 months ago
if (stateRoot) { if (isExist) { const chainAccount = await chainSubstore.get(this.context, chainID); chainAccount.status = CHAIN_TERMINATED; await chainSubstore.set(this.context as StoreGetter, chainID, chainAccount); const outboxRootSubstore = this.stores.get(OutboxRootStore); await outboxRootSubstore.del(this.context as StoreGetter, chainID); } terminatedState = { stateRoot, mainchainStateRoot: EMPTY_BYTES, initialized: true, }; } else if (isExist) { const chainAccount = await chainSubstore.get(this.context, chainID); chainAccount.status = CHAIN_TERMINATED; await chainSubstore.set(this.context as StoreGetter, chainID, chainAccount); const outboxRootSubstore = this.stores.get(OutboxRootStore); await outboxRootSubstore.del(this.context as StoreGetter, chainID); terminatedState = { stateRoot: chainAccount.lastCertificate.stateRoot, mainchainStateRoot: EMPTY_BYTES, initialized: true, }; }
Here following code block is duplicated, should be moved to outside of ifs
if
const chainAccount = await chainSubstore.get(this.context, chainID); chainAccount.status = CHAIN_TERMINATED; await chainSubstore.set(this.context as StoreGetter, chainID, chainAccount); const outboxRootSubstore = this.stores.get(OutboxRootStore); await outboxRootSubstore.del(this.context as StoreGetter, chainID);
Please describe why it is needed
Closing this issue for no activity
Description
Here following code block is duplicated, should be moved to outside of
if
sMotivation
Please describe why it is needed
Additional Information