lisk-framework
Version:
Lisk blockchain application platform
27 lines • 1.51 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SidechainInteroperabilityInternalMethod = void 0;
const base_interoperability_internal_methods_1 = require("../base_interoperability_internal_methods");
const chain_account_1 = require("../stores/chain_account");
const terminated_state_1 = require("../stores/terminated_state");
const own_chain_account_1 = require("../stores/own_chain_account");
const constants_1 = require("../constants");
class SidechainInteroperabilityInternalMethod extends base_interoperability_internal_methods_1.BaseInteroperabilityInternalMethod {
async isLive(context, chainID) {
const ownChainAccount = await this.stores.get(own_chain_account_1.OwnChainAccountStore).get(context, constants_1.EMPTY_BYTES);
if (chainID.equals(ownChainAccount.chainID)) {
return true;
}
const chainAccountExists = await this.stores.get(chain_account_1.ChainAccountStore).has(context, chainID);
if (chainAccountExists) {
const chainAccount = await this.stores.get(chain_account_1.ChainAccountStore).get(context, chainID);
if (chainAccount.status === 2) {
return false;
}
}
const terminated = await this.stores.get(terminated_state_1.TerminatedStateStore).has(context, chainID);
return !terminated;
}
}
exports.SidechainInteroperabilityInternalMethod = SidechainInteroperabilityInternalMethod;
//# sourceMappingURL=internal_method.js.map