tx.GetJoinSplitValueOut()

This commit is contained in:
jl777
2018-07-12 00:58:25 -11:00
parent 2618950955
commit ae4dbe22bb
3 changed files with 19 additions and 2 deletions

View File

@@ -1539,7 +1539,7 @@ int64_t komodo_newcoins(int64_t *zfundsp,int32_t nHeight,CBlock *pblock)
for (i=0; i<n; i++)
{
CTransaction vintx,&tx = pblock->vtx[i];
zfunds += (tx.GetJoinSplitValueOut() - tx.GetJoinSplitValueIn());
zfunds += (tx.GetJoinSplitValueIn() - tx.GetJoinSplitValueOut());
if ( (m= tx.vin.size()) > 0 )
{
for (j=0; j<m; j++)

View File

@@ -232,11 +232,26 @@ CAmount CTransaction::GetJoinSplitValueIn() const
{
// NB: vpub_new "gives" money to the value pool just as inputs do
nValue += it->vpub_new;
if (!MoneyRange(it->vpub_new) || !MoneyRange(nValue))
throw std::runtime_error("CTransaction::GetJoinSplitValueIn(): value out of range");
}
return nValue;
}
CAmount CTransaction::GetJoinSplitValueOut() const
{
CAmount nValue = 0;
for (std::vector<JSDescription>::const_iterator it(vjoinsplit.begin()); it != vjoinsplit.end(); ++it)
{
// NB: vpub_new "gives" money to the value pool just as inputs do
nValue += it->vpub_old;
if (!MoneyRange(it->vpub_old) || !MoneyRange(nValue))
throw std::runtime_error("CTransaction::GetJoinSplitValueOut(): value out of range");
}
return nValue;
}

View File

@@ -445,6 +445,8 @@ public:
// Return sum of JoinSplit vpub_new
CAmount GetJoinSplitValueIn() const;
// Return sum of JoinSplit vpub_old
CAmount GetJoinSplitValueOut() const;
// Compute priority, given priority of inputs and (optionally) tx size
double ComputePriority(double dPriorityInputs, unsigned int nTxSize=0) const;