diff --git a/src/modules/blockchain/blockchain-module-manager.js b/src/modules/blockchain/blockchain-module-manager.js index 11313d347..93388f47d 100644 --- a/src/modules/blockchain/blockchain-module-manager.js +++ b/src/modules/blockchain/blockchain-module-manager.js @@ -339,6 +339,10 @@ class BlockchainModuleManager extends BaseModuleManager { ]); } + async getV81ReleaseEpoch(blockchain) { + return this.callImplementationFunction(blockchain, 'getV81ReleaseEpoch'); + } + async getAssetStorageContractsAddress(blockchain) { return this.callImplementationFunction(blockchain, 'getAssetStorageContractsAddress'); } diff --git a/src/modules/blockchain/implementation/web3-service.js b/src/modules/blockchain/implementation/web3-service.js index 4b1149cce..e96eb0585 100644 --- a/src/modules/blockchain/implementation/web3-service.js +++ b/src/modules/blockchain/implementation/web3-service.js @@ -1300,6 +1300,15 @@ class Web3Service { }); } + async getV81ReleaseEpoch() { + return this.callContractFunction( + this.contracts.ParametersStorage, + 'v81ReleaseEpoch', + [], + CONTRACTS.PARAMETERS_STORAGE, + ); + } + async getAssetStorageContractsAddress() { return Object.keys(this.assetStorageContracts); } diff --git a/src/service/claim-rewards-service.js b/src/service/claim-rewards-service.js index 218e418c9..e1f33ed5d 100644 --- a/src/service/claim-rewards-service.js +++ b/src/service/claim-rewards-service.js @@ -120,6 +120,9 @@ class ClaimRewardsService { // This means node never claimed and delegated before introduction of random sampling // If he staked or claimed before the value would have been set correctly const delegatorAddresses = lastClaimedEpochAddressesMap['0']; + const v81ReleaseEpoch = Number( + (await this.blockchainModuleManager.getV81ReleaseEpoch(blockchainId)).toString(), + ); await Promise.all( delegatorAddresses.map(async (delegatorAddress) => { const hasEverDelegated = await this.blockchainModuleManager.hasEverDelegated( @@ -129,12 +132,12 @@ class ClaimRewardsService { ); // TODO: How will this impact mainnet where this function landed at same time as proofing if (!hasEverDelegated) { - if (lastClaimedEpochAddressesMap[`${currentEpoch - 1}`]) { - lastClaimedEpochAddressesMap[`${currentEpoch - 1}`].push( + if (lastClaimedEpochAddressesMap[`${v81ReleaseEpoch - 1}`]) { + lastClaimedEpochAddressesMap[`${v81ReleaseEpoch - 1}`].push( ...delegatorAddresses, ); } else { - lastClaimedEpochAddressesMap[`${currentEpoch - 1}`] = + lastClaimedEpochAddressesMap[`${v81ReleaseEpoch - 1}`] = delegatorAddresses; } }