Bitcoin Forum
May 15, 2024, 01:08:32 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Does this code work for transaction fees? [NEWB]  (Read 825 times)
menlatin (OP)
Sr. Member
****
Offline Offline

Activity: 366
Merit: 260


View Profile WWW
November 14, 2014, 05:10:38 PM
 #1

I'm a newbie trying to modify wallet code of an altcoin, mimicking dogecoin's transaction fees, but it looks like they've made a lot of other changes in their code.

I think this is the only section i need to modify, along with the updated nMinRelayTxFee and nMinFee

.
.
.
yes? no?

Should this be in a different section?

Code:

/** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */
int64 CTransaction::nMinTxFee = 100000000;
/** Fees smaller than this (in satoshi) are considered zero fee (for relaying) */
int64 CTransaction::nMinRelayTxFee = 100000000;

int64 CTransaction::GetMinFee(unsigned int nBlockSize, bool fAllowFree,
                              enum GetMinFee_mode mode) const
{
    // Base fee is either nMinTxFee or nMinRelayTxFee
        int64 nBaseFee = (mode == GMF_RELAY) ? nMinRelayTxFee : nMinTxFee;

    unsigned int nBytes = ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION);
    unsigned int nNewBlockSize = nBlockSize + nBytes;
    int64 nMinFee = (1 + (int64)nBytes / 1000) * nBaseFee;
   

    if (fAllowFree && mode != GMF_SEND)
    {
          // Free transaction area up to 10,000 bytes
         if (nBytes < 10000)
              nMinFee = 0;
    }

   
    // To limit dust spam, add nBaseFee for each output less than DUST_SOFT_LIMIT 11-14-14
    BOOST_FOREACH(const CTxOut& txout, vout)
        if (txout.nValue < DUST_SOFT_LIMIT)
nMinFee += nBaseFee;
       

    if (!MoneyRange(nMinFee))
        nMinFee = MAX_MONEY;
     
    return nMinFee;
}


menlatin (OP)
Sr. Member
****
Offline Offline

Activity: 366
Merit: 260


View Profile WWW
November 15, 2014, 07:31:59 PM
 #2

Anyone? Should i post this in another section?

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!