Adjust cheat catcher height
This commit is contained in:
@@ -64,7 +64,7 @@ bool CCheatList::IsCheatInList(const CTransaction &tx, CTransaction *cheatTx)
|
|||||||
LOCK(cs_cheat);
|
LOCK(cs_cheat);
|
||||||
range = indexedCheatCandidates.equal_range(utxo);
|
range = indexedCheatCandidates.equal_range(utxo);
|
||||||
|
|
||||||
printf("IsCheatInList - found candidates: %s\n", range.first == range.second ? "false" : "true");
|
//printf("IsCheatInList - found candidates: %s\n", range.first == range.second ? "false" : "true");
|
||||||
|
|
||||||
for (auto it = range.first; it != range.second; it++)
|
for (auto it = range.first; it != range.second; it++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ class CCheatList
|
|||||||
bool IsHeightOrGreaterInList(uint32_t height)
|
bool IsHeightOrGreaterInList(uint32_t height)
|
||||||
{
|
{
|
||||||
auto range = orderedCheatCandidates.equal_range(height);
|
auto range = orderedCheatCandidates.equal_range(height);
|
||||||
printf("IsHeightOrGreaterInList: %s\n", range.first == orderedCheatCandidates.end() ? "false" : "true");
|
//printf("IsHeightOrGreaterInList: %s\n", range.second == orderedCheatCandidates.end() ? "false" : "true");
|
||||||
return (range.first == orderedCheatCandidates.end());
|
return (range.second == orderedCheatCandidates.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
// add a potential cheat transaction to the list. we do this for all stake transactions from orphaned stakes
|
// add a potential cheat transaction to the list. we do this for all stake transactions from orphaned stakes
|
||||||
|
|||||||
@@ -239,11 +239,12 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
|
|
||||||
// check if we should add cheat transaction
|
// check if we should add cheat transaction
|
||||||
CBlockIndex *ppast;
|
CBlockIndex *ppast;
|
||||||
|
int cheatHeight = nHeight - COINBASE_MATURITY < 1 ? 1 : nHeight - COINBASE_MATURITY;
|
||||||
if (cheatCatcher &&
|
if (cheatCatcher &&
|
||||||
sapling && chainActive.Height() > 100 &&
|
sapling && chainActive.Height() > 100 &&
|
||||||
(ppast = chainActive[nHeight - COINBASE_MATURITY]) &&
|
(ppast = chainActive[cheatHeight]) &&
|
||||||
ppast->IsVerusPOSBlock() &&
|
ppast->IsVerusPOSBlock() &&
|
||||||
cheatList.IsHeightOrGreaterInList(nHeight))
|
cheatList.IsHeightOrGreaterInList(cheatHeight))
|
||||||
{
|
{
|
||||||
// get the block and see if there is a cheat candidate for the stake tx
|
// get the block and see if there is a cheat candidate for the stake tx
|
||||||
CBlock b;
|
CBlock b;
|
||||||
|
|||||||
@@ -3957,7 +3957,7 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey)
|
|||||||
if (!wtxNew.AcceptToMemoryPool(false))
|
if (!wtxNew.AcceptToMemoryPool(false))
|
||||||
{
|
{
|
||||||
fprintf(stderr,"commit failed\n");
|
fprintf(stderr,"commit failed\n");
|
||||||
// This must not fail. The transaction has already been signed and recorded.
|
// This must not fail. The transaction has already been signed and recorded.
|
||||||
LogPrintf("CommitTransaction(): Error: Transaction not valid\n");
|
LogPrintf("CommitTransaction(): Error: Transaction not valid\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user