aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorMark Friedenbach <mark@friedenbach.org>2014-04-22 15:46:19 -0700
committerMark Friedenbach <mark@blockstream.io>2014-09-26 15:42:04 -0700
commita372168e77a8a195613a02983f2589252698bf0f (patch)
treeb300a5f7aa007645c6ba2bd708e7a962fab2894b /src/main.cpp
parent64cfaf891fe539b36f6be37dac6c28a712d70b96 (diff)
Use a typedef for monetary values
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 60e2a56795..234b343983 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -781,7 +781,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state)
REJECT_INVALID, "bad-txns-oversize");
// Check for negative or overflow output values
- int64_t nValueOut = 0;
+ CAmount nValueOut = 0;
BOOST_FOREACH(const CTxOut& txout, tx.vout)
{
if (txout.nValue < 0)
@@ -823,19 +823,19 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state)
return true;
}
-int64_t GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree)
+CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree)
{
{
LOCK(mempool.cs);
uint256 hash = tx.GetHash();
double dPriorityDelta = 0;
- int64_t nFeeDelta = 0;
+ CAmount nFeeDelta = 0;
mempool.ApplyDeltas(hash, dPriorityDelta, nFeeDelta);
if (dPriorityDelta > 0 || nFeeDelta > 0)
return 0;
}
- int64_t nMinFee = ::minRelayTxFee.GetFee(nBytes);
+ CAmount nMinFee = ::minRelayTxFee.GetFee(nBytes);
if (fAllowFree)
{
@@ -898,7 +898,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
CCoinsView dummy;
CCoinsViewCache view(dummy);
- int64_t nValueIn = 0;
+ CAmount nValueIn = 0;
{
LOCK(pool.cs);
CCoinsViewMemPool viewMemPool(*pcoinsTip, pool);
@@ -950,15 +950,15 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
hash.ToString(), nSigOps, MAX_TX_SIGOPS),
REJECT_NONSTANDARD, "bad-txns-too-many-sigops");
- int64_t nValueOut = tx.GetValueOut();
- int64_t nFees = nValueIn-nValueOut;
+ CAmount nValueOut = tx.GetValueOut();
+ CAmount nFees = nValueIn-nValueOut;
double dPriority = view.GetPriority(tx, chainActive.Height());
CTxMemPoolEntry entry(tx, nFees, GetTime(), dPriority, chainActive.Height());
unsigned int nSize = entry.GetTxSize();
// Don't accept it if it can't get into a block
- int64_t txMinFee = GetMinRelayFee(tx, nSize, true);
+ 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),
@@ -1178,7 +1178,7 @@ void static PruneOrphanBlocks()
mapOrphanBlocks.erase(hash);
}
-int64_t GetBlockValue(int nHeight, int64_t nFees)
+CAmount GetBlockValue(int nHeight, const CAmount& nFees)
{
int64_t nSubsidy = 50 * COIN;
int halvings = nHeight / Params().SubsidyHalvingInterval();
@@ -1389,8 +1389,8 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsVi
// This is also true for mempool checks.
CBlockIndex *pindexPrev = mapBlockIndex.find(inputs.GetBestBlock())->second;
int nSpendHeight = pindexPrev->nHeight + 1;
- int64_t nValueIn = 0;
- int64_t nFees = 0;
+ CAmount nValueIn = 0;
+ CAmount nFees = 0;
for (unsigned int i = 0; i < tx.vin.size(); i++)
{
const COutPoint &prevout = tx.vin[i].prevout;
@@ -1418,7 +1418,7 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsVi
REJECT_INVALID, "bad-txns-in-belowout");
// Tally transaction fees
- int64_t nTxFee = nValueIn - tx.GetValueOut();
+ CAmount nTxFee = nValueIn - tx.GetValueOut();
if (nTxFee < 0)
return state.DoS(100, error("CheckInputs() : %s nTxFee < 0", tx.GetHash().ToString()),
REJECT_INVALID, "bad-txns-fee-negative");
@@ -1658,7 +1658,7 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C
CCheckQueueControl<CScriptCheck> control(fScriptChecks && nScriptCheckThreads ? &scriptcheckqueue : NULL);
int64_t nTimeStart = GetTimeMicros();
- int64_t nFees = 0;
+ CAmount nFees = 0;
int nInputs = 0;
unsigned int nSigOps = 0;
CDiskTxPos pos(pindex->GetBlockPos(), GetSizeOfCompactSize(block.vtx.size()));