|
20 | 20 | #include "rpcclient.h" |
21 | 21 | #include "beacon.h" |
22 | 22 | #include "miner.h" |
23 | | -#include "neuralnet/cpid.h" |
24 | 23 | #include "neuralnet/neuralnet.h" |
25 | 24 | #include "neuralnet/researcher.h" |
26 | 25 | #include "neuralnet/superblock.h" |
@@ -2736,7 +2735,7 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex, bool fJustCheck, boo |
2736 | 2735 | // Gridcoin: Store verified magnitude and CPID in block index (7-11-2015) |
2737 | 2736 | if(IsResearchAgeEnabled(pindex->nHeight)) |
2738 | 2737 | { |
2739 | | - pindex->SetCPID(bb.cpid); |
| 2738 | + pindex->SetMiningId(NN::MiningId::Parse(bb.cpid)); |
2740 | 2739 | pindex->nMagnitude = bb.Magnitude; |
2741 | 2740 | pindex->nResearchSubsidy = bb.ResearchSubsidy; |
2742 | 2741 | pindex->nInterestSubsidy = bb.InterestSubsidy; |
@@ -2827,7 +2826,7 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex, bool fJustCheck, boo |
2827 | 2826 |
|
2828 | 2827 | if(!is_claim_valid(nStakeReward, OUT_POR, OUT_INTEREST, nFees)) |
2829 | 2828 | { |
2830 | | - GetLifetimeCPID(pindex->GetCPID()); // Rescan... |
| 2829 | + GetLifetimeCPID(pindex->GetMiningId().ToString()); // Rescan... |
2831 | 2830 | GetProofOfStakeReward(nCoinAge, nFees, bb.cpid, true, 2, nTime, |
2832 | 2831 | pindex, "connectblock_researcher_doublecheck", OUT_POR, OUT_INTEREST, dAccrualAge, dMagnitudeUnit, dAvgMagnitude); |
2833 | 2832 |
|
@@ -3102,9 +3101,9 @@ bool DisconnectBlocksBatch(CTxDB& txdb, list<CTransaction>& vResurrect, unsigned |
3102 | 3101 | if(pindexBest->IsUserCPID()) |
3103 | 3102 | { |
3104 | 3103 | // remeber the cpid to re-read later |
3105 | | - vRereadCPIDs.insert(pindexBest->GetCPID()); |
| 3104 | + vRereadCPIDs.insert(pindexBest->GetMiningId().ToString()); |
3106 | 3105 | // The user has no longer staked this block. |
3107 | | - RemoveCPIDBlockHash(pindexBest->GetCPID(), pindexBest); |
| 3106 | + RemoveCPIDBlockHash(pindexBest->GetMiningId().ToString(), pindexBest); |
3108 | 3107 | } |
3109 | 3108 |
|
3110 | 3109 | // New best block |
@@ -3344,7 +3343,7 @@ bool ReorganizeChain(CTxDB& txdb, unsigned &cnt_dis, unsigned &cnt_con, CBlock & |
3344 | 3343 | } |
3345 | 3344 |
|
3346 | 3345 | if(pindex->IsUserCPID()) // is this needed? |
3347 | | - GetLifetimeCPID(pindex->cpid.GetHex()); |
| 3346 | + GetLifetimeCPID(pindex->GetMiningId().ToString()); |
3348 | 3347 | } |
3349 | 3348 |
|
3350 | 3349 | if (fDebug && (cnt_dis>0 || cnt_con>1)) |
@@ -4700,7 +4699,7 @@ void AddResearchMagnitude(CBlockIndex* pIndex) |
4700 | 4699 |
|
4701 | 4700 | try |
4702 | 4701 | { |
4703 | | - const std::string& cpid = pIndex->GetCPID(); |
| 4702 | + const std::string& cpid = pIndex->GetMiningId().ToString(); |
4704 | 4703 | StructCPID& stMag = GetInitializedStructCPID2(cpid, mvMagnitudesCopy); |
4705 | 4704 | stMag.InterestSubsidy += pIndex->nInterestSubsidy; |
4706 | 4705 | stMag.ResearchSubsidy += pIndex->nResearchSubsidy; |
@@ -4783,7 +4782,7 @@ bool GetEarliestStakeTime(std::string grcaddress, std::string cpid) |
4783 | 4782 | } |
4784 | 4783 | else |
4785 | 4784 | { |
4786 | | - myCPID = pblockindex->GetCPID(); |
| 4785 | + myCPID = pblockindex->GetMiningId().ToString(); |
4787 | 4786 | } |
4788 | 4787 | if (cpid == myCPID && nCPIDTime==0 && IsResearcher(myCPID)) |
4789 | 4788 | { |
@@ -4817,7 +4816,7 @@ void AddRARewardBlock(const CBlockIndex* pindex) |
4817 | 4816 | // this is from LoadBlockIndex |
4818 | 4817 | if (pindex->nResearchSubsidy > 0 && pindex->IsUserCPID()) |
4819 | 4818 | { |
4820 | | - const std::string& cpid = pindex->GetCPID(); |
| 4819 | + const std::string& cpid = pindex->GetMiningId().ToString(); |
4821 | 4820 |
|
4822 | 4821 | StructCPID& stCPID = GetInitializedStructCPID2(cpid,mvResearchAge); |
4823 | 4822 |
|
@@ -4865,7 +4864,7 @@ void RescanLifetimeCPID(StructCPID& stCPID) |
4865 | 4864 | // Ensure that the block is valid |
4866 | 4865 | if(pblockindex == NULL || |
4867 | 4866 | pblockindex->IsInMainChain() == false || |
4868 | | - pblockindex->GetCPID() != stCPID.cpid) |
| 4867 | + pblockindex->GetMiningId().ToString() != stCPID.cpid) |
4869 | 4868 | throw error("RescanLifetimeCPID: Invalid block %s in vRewardBlocs of %s", pblockindex? pblockindex->GetBlockHash().GetHex() :"null", stCPID.cpid ); |
4870 | 4869 |
|
4871 | 4870 | const uint256& uHash = pblockindex->GetBlockHash(); |
|
0 commit comments