mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 21:42:47 +01:00
added support for multiple chains
This commit is contained in:
parent
8c4500dfc5
commit
3a88f95aa1
@ -9,7 +9,7 @@
|
|||||||
#define CLIENT_VERSION_MAJOR 0
|
#define CLIENT_VERSION_MAJOR 0
|
||||||
#define CLIENT_VERSION_MINOR 9
|
#define CLIENT_VERSION_MINOR 9
|
||||||
#define CLIENT_VERSION_REVISION 4
|
#define CLIENT_VERSION_REVISION 4
|
||||||
#define CLIENT_VERSION_BUILD 11
|
#define CLIENT_VERSION_BUILD 13
|
||||||
|
|
||||||
// Set to true for release, false for prerelease or test build
|
// Set to true for release, false for prerelease or test build
|
||||||
#define CLIENT_VERSION_IS_RELEASE true
|
#define CLIENT_VERSION_IS_RELEASE true
|
||||||
|
30
src/main.cpp
30
src/main.cpp
@ -2621,7 +2621,7 @@ bool CBlock::CheckBlock(CValidationState &state, bool fCheckPOW, bool fCheckMerk
|
|||||||
{
|
{
|
||||||
LOCK2(cs_main, mempool.cs);
|
LOCK2(cs_main, mempool.cs);
|
||||||
|
|
||||||
CBlockIndex* pindexPrev = pindexBest;
|
CBlockIndex* pindexPrev = NULL;
|
||||||
|
|
||||||
CBlock blockTmp;
|
CBlock blockTmp;
|
||||||
int votingRecordsBlockPrev = 0;
|
int votingRecordsBlockPrev = 0;
|
||||||
@ -2633,16 +2633,28 @@ bool CBlock::CheckBlock(CValidationState &state, bool fCheckPOW, bool fCheckMerk
|
|||||||
int64 masternodePaymentAmount = vtx[0].GetValueOut()/5;
|
int64 masternodePaymentAmount = vtx[0].GetValueOut()/5;
|
||||||
bool fIsInitialDownload = IsInitialBlockDownload();
|
bool fIsInitialDownload = IsInitialBlockDownload();
|
||||||
|
|
||||||
|
CBlock blockLast;
|
||||||
|
|
||||||
|
// Work back to the first block in the orphan chain
|
||||||
|
if (mapBlockIndex.count(hashPrevBlock)){
|
||||||
|
printf("CheckBlock() : loading prev block %s\n", hashPrevBlock.ToString().c_str());
|
||||||
|
pindexPrev = mapBlockIndex[hashPrevBlock];
|
||||||
|
blockLast.ReadFromDisk(pindexPrev);
|
||||||
|
} else if (mapOrphanBlocks.count(hashPrevBlock)){
|
||||||
|
printf("CheckBlock() : loading prev orphan block %s\n", hashPrevBlock.ToString().c_str());
|
||||||
|
blockLast = *mapOrphanBlocks[hashPrevBlock];
|
||||||
|
} else {
|
||||||
|
state.DoS(100, error("CheckBlock() : Couldn't load previous block"));
|
||||||
|
}
|
||||||
|
|
||||||
if (pindexPrev != NULL && fCheckVotes && !fIsInitialDownload){
|
if (pindexPrev != NULL && fCheckVotes && !fIsInitialDownload){
|
||||||
CBlock blockLast;
|
{
|
||||||
if(blockLast.ReadFromDisk(pindexPrev)){
|
if(blockLast.GetHash() != pindexPrev->GetBlockHash()){
|
||||||
if(hashBestChain != pindexPrev->GetBlockHash()){
|
printf ("CheckBlock() : blockLast.GetHash() != pindexPrev->GetBlockHash() : %s != %s\n", blockLast.GetHash().ToString().c_str(), pindexPrev->GetBlockHash().ToString().c_str());
|
||||||
printf ("CheckBlock() : hashBestChain != pindexPrev->GetBlockHash() : %s != %s\n", hashBestChain.ToString().c_str(), pindexPrev->GetBlockHash().ToString().c_str());
|
return state.DoS(100, error("CheckBlock() : blockLast.GetHash() != pindexPrev->GetBlockHash()"));
|
||||||
return state.DoS(100, error("CheckBlock() : hashBestChain != pindexPrev->GetBlockHash()"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf ("CheckBlock() : nHeight : %d\n", pindexPrev->nHeight);
|
printf ("CheckBlock() : nHeight : %d\n", pindexPrev->nHeight);
|
||||||
printf ("CheckBlock() : hashBestChain : %s\n", hashBestChain.ToString().c_str());
|
|
||||||
printf ("CheckBlock() : pindexPrev->GetBlockHash() : %s\n", pindexPrev->GetBlockHash().ToString().c_str());
|
printf ("CheckBlock() : pindexPrev->GetBlockHash() : %s\n", pindexPrev->GetBlockHash().ToString().c_str());
|
||||||
|
|
||||||
votingRecordsBlockPrev = blockLast.vmn.size();
|
votingRecordsBlockPrev = blockLast.vmn.size();
|
||||||
@ -2702,7 +2714,7 @@ bool CBlock::CheckBlock(CValidationState &state, bool fCheckPOW, bool fCheckMerk
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(mv2.GetPubKey().size() != 25)
|
if(mv2.GetPubKey().size() != 25)
|
||||||
return state.DoS(0, error("CheckBlock() : pubkey wrong size"));
|
return state.DoS(100, error("CheckBlock() : pubkey wrong size"));
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
if(!foundThisBlock && mv2.blockHeight == pindexPrev->nHeight+1) {
|
if(!foundThisBlock && mv2.blockHeight == pindexPrev->nHeight+1) {
|
||||||
@ -2716,7 +2728,7 @@ bool CBlock::CheckBlock(CValidationState &state, bool fCheckPOW, bool fCheckMerk
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!found)
|
if(!found)
|
||||||
return state.DoS(0, error("CheckBlock() : Vote not found in previous block"));
|
return state.DoS(100, error("CheckBlock() : Vote not found in previous block"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user