Additional null pindex checks

This commit is contained in:
miketout
2018-10-14 01:31:58 -07:00
parent e82ee7e3cc
commit 41e9e058e0
3 changed files with 61 additions and 45 deletions

View File

@@ -1420,10 +1420,6 @@ int32_t CWallet::VerusStakeTransaction(CBlock *pBlock, CMutableTransaction &txNe
else
return 0;
// !! DISABLE THIS FOR RELEASE: THIS MAKES A CHEAT TRANSACTION FOR EVERY STAKE FOR TESTING
//CMutableTransaction cheat;
// !! DOWN TO HERE
// if we are staking with the extended format, add the opreturn data required
if (extendedStake)
{
@@ -1440,29 +1436,30 @@ int32_t CWallet::VerusStakeTransaction(CBlock *pBlock, CMutableTransaction &txNe
return 0;
// !! DISABLE THIS FOR RELEASE: 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();
CMutableTransaction cheat;
cheat = CMutableTransaction(txNew);
cheat.vout[1].scriptPubKey << OP_RETURN
<< CStakeParams(pSrcIndex->GetHeight(), tipindex->GetHeight() + 1, pSrcIndex->GetBlockHash(), pk).AsVector();
// !! DOWN TO HERE
txOut1.scriptPubKey << OP_RETURN
<< CStakeParams(pSrcIndex->GetHeight(), tipindex->GetHeight() + 1, tipindex->GetBlockHash(), pk).AsVector();
}
// !! DISABLE THIS FOR RELEASE: REMOVE THIS TOO
//nValue = 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));
//}
// !! DOWN TO HERE
// !! DISABLE THIS FOR RELEASE: REMOVE THIS TOO
nValue = 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));
}
// !! DOWN TO HERE
}
nValue = txNew.vout[0].nValue = stakeSource.vout[voutNum].nValue - txfee;