Browse Source

Merge pull request #396 from VerusCoin/dev

Dev
pull/402/head v0.9.1-1
Asher Dawes 2 years ago
committed by GitHub
parent
commit
81dac44081
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 27
      src/main.cpp
  2. 2
      src/pbaas/pbaas.cpp

27
src/main.cpp

@ -1405,6 +1405,13 @@ bool ContextualCheckTransaction(
}
if (!CC.contextualprecheck(tx, i, state, nHeight))
{
if (LogAcceptCategory("precheck"))
{
UniValue txJson(UniValue::VOBJ);
uint256 dummyHash;
TxToUniv(tx, dummyHash, txJson);
LogPrintf("%s: precheck failed: output %d on tx: %s\n", __func__, i, txJson.write(1,2).c_str());
}
return state.DoS(10, error(state.GetRejectReason().c_str()), REJECT_INVALID, "bad-txns-failed-precheck");
}
}
@ -3628,8 +3635,20 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
auto verifier = libzcash::ProofVerifier::Strict();
auto disabledVerifier = libzcash::ProofVerifier::Disabled();
int32_t futureblock;
// remove any potential conflicts for inputs in the mempool from auto-created transactions,
// such as imports or exports to prevent us from accepting the block
for (auto &oneTx : block.vtx)
{
std::list<CTransaction> removedTxes;
if (!oneTx.IsCoinBase())
{
mempool.removeConflicts(oneTx, removedTxes);
}
}
// Check it again to verify JoinSplit proofs, and in case a previous version let a bad block in
if (!CheckBlock(&futureblock,pindex->GetHeight(), pindex, block, state, chainparams, fExpensiveChecks ? verifier : disabledVerifier, fCheckPOW, !fJustCheck, !fJustCheck) || futureblock != 0 )
if (!CheckBlock(&futureblock, pindex->GetHeight(), pindex, block, state, chainparams, fExpensiveChecks ? verifier : disabledVerifier, fCheckPOW, !fJustCheck, !fJustCheck) || futureblock != 0 )
{
if (futureblock)
{
@ -5816,8 +5835,10 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
{
sTx = Tx;
ptx = &sTx;
} else if (state.GetRejectReason() != "already have coins" &&
!((missinginputs || state.GetRejectCode() == REJECT_DUPLICATE) && (!fCheckTxInputs || chainActive.Height() < height - 1)))
}
else
if (state.GetRejectReason() != "already have coins" &&
!((missinginputs || state.GetRejectCode() == REJECT_DUPLICATE) && (!fCheckTxInputs || chainActive.Height() < height - 1)))
{
if (LogAcceptCategory("checkblock"))
{

2
src/pbaas/pbaas.cpp

@ -1072,7 +1072,7 @@ bool ValidateReserveDeposit(struct CCcontract_info *cp, Eval* eval, const CTrans
COptCCParams p;
// if we can't find the output we are spending, we fail
if (pCoins->vout.size() <= tx.vin[i].prevout.n)
if (!pCoins || pCoins->vout.size() <= tx.vin[i].prevout.n)
{
return eval->Error(std::string(__func__) + ": cannot get output being spent by input (" + tx.vin[i].ToString() + ") from current view");
}

Loading…
Cancel
Save