Merge remote-tracking branch 'zcash/master' into rebase
# Conflicts: # README.md # src/Makefile.gtest.include # src/chainparams.cpp # src/init.cpp # src/miner.cpp # src/wallet/wallet.cpp
This commit is contained in:
30
src/main.cpp
30
src/main.cpp
@@ -26,6 +26,7 @@
|
||||
#include "util.h"
|
||||
#include "utilmoneystr.h"
|
||||
#include "validationinterface.h"
|
||||
#include "wallet/asyncrpcoperation_sendmany.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
@@ -70,7 +71,7 @@ uint64_t nPruneTarget = 0;
|
||||
bool fAlerts = DEFAULT_ALERTS;
|
||||
|
||||
/** Fees smaller than this (in satoshi) are considered zero fee (for relaying and mining) */
|
||||
CFeeRate minRelayTxFee = CFeeRate(5000);
|
||||
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
|
||||
|
||||
CTxMemPool mempool(::minRelayTxFee);
|
||||
|
||||
@@ -871,8 +872,9 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state)
|
||||
return false;
|
||||
} else {
|
||||
// Ensure that zk-SNARKs verify
|
||||
auto verifier = libzcash::ProofVerifier::Strict();
|
||||
BOOST_FOREACH(const JSDescription &joinsplit, tx.vjoinsplit) {
|
||||
if (!joinsplit.Verify(*pzcashParams, tx.joinSplitPubKey)) {
|
||||
if (!joinsplit.Verify(*pzcashParams, verifier, tx.joinSplitPubKey)) {
|
||||
return state.DoS(100, error("CheckTransaction(): joinsplit does not verify"),
|
||||
REJECT_INVALID, "bad-txns-joinsplit-verification-failed");
|
||||
}
|
||||
@@ -1211,12 +1213,17 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
CTxMemPoolEntry entry(tx, nFees, GetTime(), dPriority, chainActive.Height(), mempool.HasNoInputsOf(tx));
|
||||
unsigned int nSize = entry.GetTxSize();
|
||||
|
||||
// Don't accept it if it can't get into a block
|
||||
CAmount txMinFee = GetMinRelayFee(tx, nSize, true);
|
||||
if (fLimitFree && nFees < txMinFee)
|
||||
return state.DoS(0, error("AcceptToMemoryPool: not enough fees %s, %d < %d",
|
||||
hash.ToString(), nFees, txMinFee),
|
||||
REJECT_INSUFFICIENTFEE, "insufficient fee");
|
||||
// Accept a tx if it contains joinsplits and has at least the default fee specified by z_sendmany.
|
||||
if (tx.vjoinsplit.size() > 0 && nFees >= ASYNC_RPC_OPERATION_DEFAULT_MINERS_FEE) {
|
||||
// In future we will we have more accurate and dynamic computation of fees for tx with joinsplits.
|
||||
} else {
|
||||
// Don't accept it if it can't get into a block
|
||||
CAmount txMinFee = GetMinRelayFee(tx, nSize, true);
|
||||
if (fLimitFree && nFees < txMinFee)
|
||||
return state.DoS(0, error("AcceptToMemoryPool: not enough fees %s, %d < %d",
|
||||
hash.ToString(), nFees, txMinFee),
|
||||
REJECT_INSUFFICIENTFEE, "insufficient fee");
|
||||
}
|
||||
|
||||
// Require that free transactions have sufficient priority to be mined in the next block.
|
||||
if (GetBoolArg("-relaypriority", false) && nFees < ::minRelayTxFee.GetFee(nSize) && !AllowFree(view.GetPriority(tx, chainActive.Height() + 1))) {
|
||||
@@ -1566,7 +1573,7 @@ void CheckForkWarningConditionsOnNewFork(CBlockIndex* pindexNewForkTip)
|
||||
}
|
||||
|
||||
// We define a condition where we should warn the user about as a fork of at least 7 blocks
|
||||
// with a tip within 72 blocks (+/- 12 hours if no one mines it) of ours
|
||||
// with a tip within 72 blocks (+/- 3 hours if no one mines it) of ours
|
||||
// We use 7 blocks rather arbitrarily as it represents just under 10% of sustained network
|
||||
// hash rate operating on the fork.
|
||||
// or a chain that is entirely longer than ours and invalid (note that this should be detected by both)
|
||||
@@ -3213,7 +3220,10 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
|
||||
|
||||
// Enforce block.nVersion=2 rule that the coinbase starts with serialized block height
|
||||
// if 750 of the last 1,000 blocks are version 2 or greater (51/100 if testnet):
|
||||
if (block.nVersion >= 2)
|
||||
// Since MIN_BLOCK_VERSION = 4 all blocks with nHeight > 0 should satisfy this.
|
||||
// This rule is not applied to the genesis block, which didn't include the height
|
||||
// in the coinbase.
|
||||
if (nHeight > 0)
|
||||
{
|
||||
CScript expect = CScript() << nHeight;
|
||||
if (block.vtx[0].vin[0].scriptSig.size() < expect.size() ||
|
||||
|
||||
Reference in New Issue
Block a user