Author

Topic: TX_FEE Question - Miners / Stakers (Read 72 times)

staff
Activity: 3458
Merit: 6793
Just writing some code
June 01, 2018, 02:31:46 PM
#2
No, that is not the code that calculates fees. It is for calculating a fee given a fee rate which is only used for creating transactions, not receiving transactions.
newbie
Activity: 3
Merit: 0
June 01, 2018, 01:25:00 PM
#1
Hello Friends,

Are any community members familiar enough with C++ to answer a question regarding the Blockchain Tx_fee?

Is this the fee being calculated here in amount.cpp in the src? if this is not the code calculating the tx_fee each miner/staker/masternode receives from transactions sent, where may I find the correct parameters to adjust the fee?


########################################################
const std::string CURRENCY_UNIT = "CoinSymbolHere";

CFeeRate::CFeeRate(const CAmount& nFeePaid, size_t nSize)
{
    if (nSize > 0)
        nSatoshisPerK = nFeePaid*1000/nSize;
    else
        nSatoshisPerK = 0;
}

CAmount CFeeRate::GetFee(size_t nSize) const
{
    CAmount nFee = nSatoshisPerK*nSize / 1000;

    if (nFee == 0 && nSatoshisPerK > 0)
        nFee = nSatoshisPerK;

    return nFee;
}

std::string CFeeRate::ToString() const
{
    return strprintf("%d.%08d %s/kB", nSatoshisPerK / COIN, nSatoshisPerK % COIN, CURRENCY_UNIT);
}
###########################################################
Jump to: