Bitcoin Forum
December 10, 2019, 12:44:08 AM *
News: Latest Bitcoin Core release: 0.19.0.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Does this code work for transaction fees? [NEWB]  (Read 740 times)
menlatin
Sr. Member
****
Offline Offline

Activity: 356
Merit: 250


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;
}


aari13 http://www.jalapen.io VOTE FOR YOUR COIN to be added to the Jalapeno Platform and apply for the  JalaPESOS Pre-ICO
1575938648
Hero Member
*
Offline Offline

Posts: 1575938648

View Profile Personal Message (Offline)

Ignore
1575938648
Reply with quote  #2

1575938648
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1575938648
Hero Member
*
Offline Offline

Posts: 1575938648

View Profile Personal Message (Offline)

Ignore
1575938648
Reply with quote  #2

1575938648
Report to moderator
1575938648
Hero Member
*
Offline Offline

Posts: 1575938648

View Profile Personal Message (Offline)

Ignore
1575938648
Reply with quote  #2

1575938648
Report to moderator
menlatin
Sr. Member
****
Offline Offline

Activity: 356
Merit: 250


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

Anyone? Should i post this in another section?

aari13 http://www.jalapen.io VOTE FOR YOUR COIN to be added to the Jalapeno Platform and apply for the  JalaPESOS Pre-ICO
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!