Bitcoin Forum
September 27, 2018, 10:58:58 PM *
News: ♦♦ New info! Bitcoin Core users absolutely must upgrade to previously-announced 0.16.3 [Torrent]. All Bitcoin users should temporarily trust confirmations slightly less. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Where is the limit check ? [ANSWERED, VERIFIED]  (Read 1064 times)
ArsenShnurkov
Legendary
*
Offline Offline

Activity: 1386
Merit: 1000



View Profile
March 18, 2011, 04:43:50 PM
 #1

I am looking into CTransaction::CheckTransaction function and doesn't see the check for transaction inputs.

Testing scenario:
1) Malicious node generates and signs the block after MAX_MONEY coins was generated,
2) Malicious node includes new transaction for money generation in that block.

3) Why a correct node will not accept new coins ?

This transaction will be checked with code:

if (IsCoinBase())
    {
        if (vin[0].scriptSig.size() < 2 || vin[0].scriptSig.size() > 100)
            return error("CTransaction::CheckTransaction() : coinbase script size");
    }

And this code doesn't check total amount of money

function
bool CBlock::CheckBlock() const
doesn't contain such checks either

Please explain, how the code prevents new coins after MAX_MONEY was generated.

UPD: Found similar topics:
http://bitcointalk.org/index.php?topic=681.0
http://bitcointalk.org/index.php?topic=2252.0
now I am checking them
1538089138
Hero Member
*
Offline Offline

Posts: 1538089138

View Profile Personal Message (Offline)

Ignore
1538089138
Reply with quote  #2

1538089138
Report to moderator
Make a difference with your Ether.
Donate Ether for the greater good.
SPRING.WETRUST.IO
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1538089138
Hero Member
*
Offline Offline

Posts: 1538089138

View Profile Personal Message (Offline)

Ignore
1538089138
Reply with quote  #2

1538089138
Report to moderator
1538089138
Hero Member
*
Offline Offline

Posts: 1538089138

View Profile Personal Message (Offline)

Ignore
1538089138
Reply with quote  #2

1538089138
Report to moderator
Mike Hearn
Legendary
*
expert
Offline Offline

Activity: 1526
Merit: 1006


View Profile
March 18, 2011, 06:06:55 PM
 #2

See line 1421 of main.cpp in CBlock::ConnectBlock

Code:
    if (vtx[0].GetValueOut() > GetBlockValue(pindex->nHeight, nFees))
        return false;

GetBlockValue is defined as

Code:
int64 GetBlockValue(int nHeight, int64 nFees)
{
    int64 nSubsidy = 50 * COIN;

    // Subsidy is cut in half every 4 years
    nSubsidy >>= (nHeight / 210000);

    return nSubsidy + nFees;
}
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!