@ -31,8 +31,8 @@ CTxMemPool mempool;
unsigned int nTransactionsUpdated = 0 ;
unsigned int nTransactionsUpdated = 0 ;
map < uint256 , CBlockIndex * > mapBlockIndex ;
map < uint256 , CBlockIndex * > mapBlockIndex ;
uint256 hashGenesisBlock ( " 0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f " ) ;
uint256 hashGenesisBlock ( " 0x12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2 " ) ;
static CBigNum bnProofOfWorkLimit ( ~ uint256 ( 0 ) > > 3 2) ;
static CBigNum bnProofOfWorkLimit ( ~ uint256 ( 0 ) > > 20 ) ; // Litecoin: starting difficulty is 1 / 2^12
CBlockIndex * pindexGenesisBlock = NULL ;
CBlockIndex * pindexGenesisBlock = NULL ;
int nBestHeight = - 1 ;
int nBestHeight = - 1 ;
uint256 nBestChainWork = 0 ;
uint256 nBestChainWork = 0 ;
@ -1072,14 +1072,14 @@ int64 static GetBlockValue(int nHeight, int64 nFees)
{
{
int64 nSubsidy = 50 * COIN ;
int64 nSubsidy = 50 * COIN ;
// Subsidy is cut in half every 21 0000 blocks, which will occur approximately every 4 years
// Subsidy is cut in half every 84 0000 blocks, which will occur approximately every 4 years
nSubsidy > > = ( nHeight / 21 0000) ;
nSubsidy > > = ( nHeight / 84 0000) ; // Litecoin: 840k blocks in ~4 years
return nSubsidy + nFees ;
return nSubsidy + nFees ;
}
}
static const int64 nTargetTimespan = 14 * 24 * 60 * 60 ; // two week s
static const int64 nTargetTimespan = 3.5 * 24 * 60 * 60 ; // Litecoin: 3.5 day s
static const int64 nTargetSpacing = 10 * 60 ;
static const int64 nTargetSpacing = 2.5 * 60 ; // Litecoin: 2.5 minutes
static const int64 nInterval = nTargetTimespan / nTargetSpacing ;
static const int64 nInterval = nTargetTimespan / nTargetSpacing ;
//
//
@ -2710,11 +2710,11 @@ bool LoadBlockIndex()
{
{
if ( fTestNet )
if ( fTestNet )
{
{
pchMessageStart [ 0 ] = 0x0b ;
pchMessageStart [ 0 ] = 0xfc ;
pchMessageStart [ 1 ] = 0x1 1 ;
pchMessageStart [ 1 ] = 0xc 1 ;
pchMessageStart [ 2 ] = 0x09 ;
pchMessageStart [ 2 ] = 0xb7 ;
pchMessageStart [ 3 ] = 0x07 ;
pchMessageStart [ 3 ] = 0xdc ;
hashGenesisBlock = uint256 ( " 000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943 " ) ;
hashGenesisBlock = uint256 ( " 0xf5ae71e26c74beacc88382716aced69cddf3dffff24f384e1808905e0188f68f " ) ;
}
}
//
//
@ -2740,33 +2740,33 @@ bool InitBlockIndex() {
// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
if ( ! fReindex ) {
if ( ! fReindex ) {
// Genesis Block:
// Genesis Block:
// CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=20832368 93, vtx=1)
// CBlock(hash=12a765e31ffd4059bada, PoW=0000050c34a64b415b6b, ver=1, hashPrevBlock=00000000000000000000, hashMerkleRoot=97ddfbbae6, nTime=1317972665, nBits=1e0ffff0, nNonce=20845244 93, vtx=1)
// CTransaction(hash=4a5e1e , ver=1, vin.size=1, vout.size=1, nLockTime=0)
// CTransaction(hash=97ddfbbae6 , ver=1, vin.size=1, vout.size=1, nLockTime=0)
// CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73 )
// CTxIn(COutPoint(0000000000, -1), coinbase 04ffff001d0104404e592054696d65732030352f4f63742f32303131205374657665204a6f62732c204170706c65e280997320566973696f6e6172792c2044696573206174203536 )
// CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B )
// CTxOut(nValue=50.00000000, scriptPubKey=040184710fa689ad5023690c80f3a4 )
// vMerkleTree: 4a5e1e
// vMerkleTree: 97ddfbbae6
// Genesis block
// Genesis block
const char * pszTimestamp = " The Times 03/Jan/2009 Chancellor on brink of second bailout for banks " ;
const char * pszTimestamp = " NY Times 05/Oct/2011 Steve Jobs, Apple’s Visionary, Dies at 56 " ;
CTransaction txNew ;
CTransaction txNew ;
txNew . vin . resize ( 1 ) ;
txNew . vin . resize ( 1 ) ;
txNew . vout . resize ( 1 ) ;
txNew . vout . resize ( 1 ) ;
txNew . vin [ 0 ] . scriptSig = CScript ( ) < < 486604799 < < CBigNum ( 4 ) < < vector < unsigned char > ( ( const unsigned char * ) pszTimestamp , ( const unsigned char * ) pszTimestamp + strlen ( pszTimestamp ) ) ;
txNew . vin [ 0 ] . scriptSig = CScript ( ) < < 486604799 < < CBigNum ( 4 ) < < vector < unsigned char > ( ( const unsigned char * ) pszTimestamp , ( const unsigned char * ) pszTimestamp + strlen ( pszTimestamp ) ) ;
txNew . vout [ 0 ] . nValue = 50 * COIN ;
txNew . vout [ 0 ] . nValue = 50 * COIN ;
txNew . vout [ 0 ] . scriptPubKey = CScript ( ) < < ParseHex ( " 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f " ) < < OP_CHECKSIG ;
txNew . vout [ 0 ] . scriptPubKey = CScript ( ) < < ParseHex ( " 040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9 " ) < < OP_CHECKSIG ;
CBlock block ;
CBlock block ;
block . vtx . push_back ( txNew ) ;
block . vtx . push_back ( txNew ) ;
block . hashPrevBlock = 0 ;
block . hashPrevBlock = 0 ;
block . hashMerkleRoot = block . BuildMerkleTree ( ) ;
block . hashMerkleRoot = block . BuildMerkleTree ( ) ;
block . nVersion = 1 ;
block . nVersion = 1 ;
block . nTime = 123100650 5 ;
block . nTime = 131797266 5 ;
block . nBits = 0x1d00ffff ;
block . nBits = 0x1e0ffff0 ;
block . nNonce = 20832368 93 ;
block . nNonce = 20845244 93 ;
if ( fTestNet )
if ( fTestNet )
{
{
block . nTime = 1296688602 ;
block . nTime = 1317798646 ;
block . nNonce = 414098458 ;
block . nNonce = 385270584 ;
}
}
//// debug print
//// debug print
@ -2774,7 +2774,7 @@ bool InitBlockIndex() {
printf ( " %s \n " , hash . ToString ( ) . c_str ( ) ) ;
printf ( " %s \n " , hash . ToString ( ) . c_str ( ) ) ;
printf ( " %s \n " , hashGenesisBlock . ToString ( ) . c_str ( ) ) ;
printf ( " %s \n " , hashGenesisBlock . ToString ( ) . c_str ( ) ) ;
printf ( " %s \n " , block . hashMerkleRoot . ToString ( ) . c_str ( ) ) ;
printf ( " %s \n " , block . hashMerkleRoot . ToString ( ) . c_str ( ) ) ;
assert ( block . hashMerkleRoot = = uint256 ( " 0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b " ) ) ;
assert ( block . hashMerkleRoot = = uint256 ( " 0x97ddfbbae6be97fd6cdf3e7ca13232a3afff2353e29badfab7f73011edd4ced9 " ) ) ;
block . print ( ) ;
block . print ( ) ;
assert ( hash = = hashGenesisBlock ) ;
assert ( hash = = hashGenesisBlock ) ;
@ -3047,7 +3047,7 @@ bool static AlreadyHave(const CInv& inv)
// The message start string is designed to be unlikely to occur in normal data.
// The message start string is designed to be unlikely to occur in normal data.
// The characters are rarely used upper ASCII, not valid as UTF-8, and produce
// The characters are rarely used upper ASCII, not valid as UTF-8, and produce
// a large 4-byte int at any alignment.
// a large 4-byte int at any alignment.
unsigned char pchMessageStart [ 4 ] = { 0xf9 , 0xbe , 0xb4 , 0xd9 } ;
unsigned char pchMessageStart [ 4 ] = { 0xfb , 0xc0 , 0xb6 , 0xdb } ; // Litecoin: increase each by adding 2 to bitcoin's value.
void static ProcessGetData ( CNode * pfrom )
void static ProcessGetData ( CNode * pfrom )
@ -4297,7 +4297,7 @@ CBlockTemplate* CreateNewBlock(CReserveKey& reservekey)
// Prioritize by fee once past the priority size or we run out of high-priority
// Prioritize by fee once past the priority size or we run out of high-priority
// transactions:
// transactions:
if ( ! fSortedByFee & &
if ( ! fSortedByFee & &
( ( nBlockSize + nTxSize > = nBlockPrioritySize ) | | ( dPriority < COIN * 144 / 250 ) ) )
( ( nBlockSize + nTxSize > = nBlockPrioritySize ) | | ( dPriority < COIN * 576 / 250 ) ) )
{
{
fSortedByFee = true ;
fSortedByFee = true ;
comparer = TxPriorityCompare ( fSortedByFee ) ;
comparer = TxPriorityCompare ( fSortedByFee ) ;