Cheatcatcher tests to remove and change to max sequential POS
This commit is contained in:
@@ -1420,6 +1420,10 @@ int32_t CWallet::VerusStakeTransaction(CBlock *pBlock, CMutableTransaction &txNe
|
||||
else
|
||||
return 0;
|
||||
|
||||
// TODO: REMOVE THIS: THIS MAKES A CHEAT TRANSACTION FOR EVERY STAKE FOR TESTING
|
||||
CMutableTransaction cheat;
|
||||
// UP TO HERE
|
||||
|
||||
// if we are staking with the extended format, add the opreturn data required
|
||||
//
|
||||
if (extendedStake)
|
||||
@@ -1436,10 +1440,31 @@ int32_t CWallet::VerusStakeTransaction(CBlock *pBlock, CMutableTransaction &txNe
|
||||
if ((pSrcIndex = mapBlockIndex[srcBlock]) == 0)
|
||||
return 0;
|
||||
|
||||
// TODO: REMOVE THIS: THIS MAKES A CHEAT TRANSACTION FOR EVERY STAKE FOR TESTING
|
||||
cheat = CMutableTransaction(txNew);
|
||||
cheat.vout[1].scriptPubKey << OP_RETURN
|
||||
<< CStakeParams(pSrcIndex->GetHeight(), tipindex->GetHeight() + 1, pSrcIndex->GetBlockHash(), pk).AsVector();
|
||||
// REMOVE UP TO HERE
|
||||
|
||||
txOut1.scriptPubKey << OP_RETURN
|
||||
<< CStakeParams(pSrcIndex->GetHeight(), tipindex->GetHeight() + 1, tipindex->GetBlockHash(), pk).AsVector();
|
||||
}
|
||||
|
||||
// TODO REMOVE THIS TOO
|
||||
cheat.vout[0].nValue = stakeSource.vout[voutNum].nValue - txfee;
|
||||
cheat.nLockTime = 0;
|
||||
CTransaction cheatConst(cheat);
|
||||
SignatureData cheatSig;
|
||||
if (!ProduceSignature(TransactionSignatureCreator(&keystore, &cheatConst, 0, nValue, SIGHASH_ALL), stakeSource.vout[voutNum].scriptPubKey, cheatSig, consensusBranchId))
|
||||
fprintf(stderr,"failed to create cheat test signature\n");
|
||||
else
|
||||
{
|
||||
uint8_t *ptr;
|
||||
UpdateTransaction(cheat,0,cheatSig);
|
||||
cheatList.Add(CTxHolder(CTransaction(cheat), tipindex->GetHeight() + 1));
|
||||
}
|
||||
// UP TO HERE
|
||||
|
||||
nValue = txNew.vout[0].nValue = stakeSource.vout[voutNum].nValue - txfee;
|
||||
|
||||
txNew.nLockTime = 0;
|
||||
@@ -2767,6 +2792,8 @@ void CWallet::ReacceptWalletTransactions()
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<uint256> vwtxh;
|
||||
|
||||
// Try to add wallet transactions to memory pool
|
||||
BOOST_FOREACH(PAIRTYPE(const int64_t, CWalletTx*)& item, mapSorted)
|
||||
{
|
||||
@@ -2786,11 +2813,14 @@ void CWallet::ReacceptWalletTransactions()
|
||||
if (!wtx.IsCoinBase() && invalid && nDoS > 0)
|
||||
{
|
||||
LogPrintf("erasing transaction\n");
|
||||
//printf("erasing transaction\n");
|
||||
EraseFromWallets(wtx.GetHash());
|
||||
vwtxh.push_back(wtx.GetHash());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto hash : vwtxh)
|
||||
{
|
||||
EraseFromWallet(hash);
|
||||
}
|
||||
}
|
||||
|
||||
bool CWalletTx::RelayWalletTransaction()
|
||||
|
||||
Reference in New Issue
Block a user