diff options
| author | Wladimir J. van der Laan <[email protected]> | 2016-07-19 12:09:11 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2016-07-19 12:09:15 +0200 |
| commit | ca7550e128a3fa56baa129fc89d8000ba16a8ae5 (patch) | |
| tree | 931520ad5742b9a758a4bd9143fdfe96f180ab79 /src/policy | |
| parent | doc: Clean out release notes (diff) | |
| parent | Rename "block cost" to "block weight" (diff) | |
| download | discoin-ca7550e128a3fa56baa129fc89d8000ba16a8ae5.tar.xz discoin-ca7550e128a3fa56baa129fc89d8000ba16a8ae5.zip | |
Merge #8363: Rename "block cost" to "block weight"
2c06bae Rename "block cost" to "block weight" (Suhas Daftuar)
Diffstat (limited to 'src/policy')
| -rw-r--r-- | src/policy/policy.cpp | 10 | ||||
| -rw-r--r-- | src/policy/policy.h | 12 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp index f2148bfe1..8617db00c 100644 --- a/src/policy/policy.cpp +++ b/src/policy/policy.cpp @@ -64,8 +64,8 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason) // almost as much to process as they cost the sender in fees, because // computing signature hashes is O(ninputs*txsize). Limiting transactions // to MAX_STANDARD_TX_SIZE mitigates CPU exhaustion attacks. - unsigned int sz = GetTransactionCost(tx); - if (sz >= MAX_STANDARD_TX_COST) { + unsigned int sz = GetTransactionWeight(tx); + if (sz >= MAX_STANDARD_TX_WEIGHT) { reason = "tx-size"; return false; } @@ -151,12 +151,12 @@ bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs) return true; } -int64_t GetVirtualTransactionSize(int64_t nCost) +int64_t GetVirtualTransactionSize(int64_t nWeight) { - return (nCost + WITNESS_SCALE_FACTOR - 1) / WITNESS_SCALE_FACTOR; + return (nWeight + WITNESS_SCALE_FACTOR - 1) / WITNESS_SCALE_FACTOR; } int64_t GetVirtualTransactionSize(const CTransaction& tx) { - return GetVirtualTransactionSize(GetTransactionCost(tx)); + return GetVirtualTransactionSize(GetTransactionWeight(tx)); } diff --git a/src/policy/policy.h b/src/policy/policy.h index 29a8cc57c..f5f8652fb 100644 --- a/src/policy/policy.h +++ b/src/policy/policy.h @@ -18,10 +18,10 @@ class CCoinsViewCache; static const unsigned int DEFAULT_BLOCK_MAX_SIZE = 750000; /** Default for -blockprioritysize, maximum space for zero/low-fee transactions **/ static const unsigned int DEFAULT_BLOCK_PRIORITY_SIZE = 0; -/** Default for -blockmaxcost, which control the range of block costs the mining code will create **/ -static const unsigned int DEFAULT_BLOCK_MAX_COST = 3000000; -/** The maximum size for transactions we're willing to relay/mine */ -static const unsigned int MAX_STANDARD_TX_COST = 400000; +/** Default for -blockmaxweight, which controls the range of block weights the mining code will create **/ +static const unsigned int DEFAULT_BLOCK_MAX_WEIGHT = 3000000; +/** The maximum weight for transactions we're willing to relay/mine */ +static const unsigned int MAX_STANDARD_TX_WEIGHT = 400000; /** Maximum number of signature check operations in an IsStandard() P2SH script */ static const unsigned int MAX_P2SH_SIGOPS = 15; /** The maximum number of sigops we're willing to relay/mine in a single tx */ @@ -66,8 +66,8 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason); */ bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs); -/** Compute the virtual transaction size (cost reinterpreted as bytes). */ -int64_t GetVirtualTransactionSize(int64_t nCost); +/** Compute the virtual transaction size (weight reinterpreted as bytes). */ +int64_t GetVirtualTransactionSize(int64_t nWeight); int64_t GetVirtualTransactionSize(const CTransaction& tx); #endif // BITCOIN_POLICY_POLICY_H |