Merge branch 'dev' into reduce_memory

This commit is contained in:
Duke
2023-10-16 06:04:56 -04:00
32 changed files with 859 additions and 839 deletions

View File

@@ -1340,22 +1340,6 @@ bool ContextualCheckTransaction(int32_t slowflag,const CBlock *block, CBlockInde
}
if (!(tx.IsMint() || tx.vjoinsplit.empty()))
{
BOOST_STATIC_ASSERT(crypto_sign_PUBLICKEYBYTES == 32);
// We rely on libsodium to check that the signature is canonical.
// https://github.com/jedisct1/libsodium/commit/62911edb7ff2275cccd74bf1c8aefcc4d76924e0
if (crypto_sign_verify_detached(&tx.joinSplitSig[0],
dataToBeSigned.begin(), 32,
tx.joinSplitPubKey.begin()
) != 0) {
return state.DoS(isInitBlockDownload() ? 0 : 100,
error("CheckTransaction(): invalid joinsplit signature"),
REJECT_INVALID, "bad-txns-invalid-joinsplit-signature");
}
}
if (tx.IsCoinBase())
{
if (!ContextualCheckCoinbaseTransaction(slowflag,block,previndex,tx, nHeight,validateprices))
@@ -1363,6 +1347,11 @@ bool ContextualCheckTransaction(int32_t slowflag,const CBlock *block, CBlockInde
REJECT_INVALID, "bad-txns-invalid-script-data-for-coinbase-time-lock");
}
// Avoid ztx validation during IBD if height is less than latest checkpoint
if (fCheckpointsEnabled && (nHeight < Checkpoints::GetTotalBlocksEstimate(Params().Checkpoints())) ) {
return true;
}
if (!tx.vShieldedSpend.empty() ||
!tx.vShieldedOutput.empty())
{
@@ -4999,7 +4988,6 @@ bool CheckBlockHeader(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,
return true;
}
int32_t hush_check_deposit(int32_t height,const CBlock& block,uint32_t prevtime);
int32_t hush_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height);
bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const CBlock& block, CValidationState& state,
@@ -5121,7 +5109,9 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
// changing at run-time, from Consensus::Params being a const struct
unsigned int nNextWork = GetNextWorkRequired(pindexPrev, &block, consensusParams);
LogPrintf("%s: nbits ,%d,%lu,%lu,%d\n",__func__, nHeight, nNextWork, block.nBits, nNextWork - block.nBits );
if (fDebug) {
LogPrintf("%s: nbits ,%d,%lu,%lu,%d\n",__func__, nHeight, nNextWork, block.nBits, nNextWork - block.nBits );
}
if (block.nBits != nNextWork) {
// Enforce correct nbits at DAA fork height, before that, ignore
if (nHeight > daaForkHeight) {