Browse Source

Merge branch 'getmemorypool_blockflagstime' of https://github.com/forrestv/bitcoin

0.8
Gavin Andresen 13 years ago
parent
commit
aacefd2795
  1. 6
      src/bitcoinrpc.cpp
  2. 7
      src/main.cpp
  3. 6
      src/main.h

6
src/bitcoinrpc.cpp

@ -1871,7 +1871,10 @@ Value getmemorypool(const Array& params, bool fHelp) @@ -1871,7 +1871,10 @@ Value getmemorypool(const Array& params, bool fHelp)
" \"previousblockhash\" : hash of current highest block\n"
" \"transactions\" : contents of non-coinbase transactions that should be included in the next block\n"
" \"coinbasevalue\" : maximum allowable input to coinbase transaction, including the generation award and transaction fees\n"
" \"coinbaseflags\" : data that should be included in coinbase so support for new features can be judged\n"
" \"time\" : timestamp appropriate for next block\n"
" \"mintime\" : minimum timestamp appropriate for next block\n"
" \"curtime\" : current timestamp\n"
" \"bits\" : compressed target of next block\n"
"If [data] is specified, tries to solve the block and returns true if it was successful.");
@ -1925,7 +1928,10 @@ Value getmemorypool(const Array& params, bool fHelp) @@ -1925,7 +1928,10 @@ Value getmemorypool(const Array& params, bool fHelp)
result.push_back(Pair("previousblockhash", pblock->hashPrevBlock.GetHex()));
result.push_back(Pair("transactions", transactions));
result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue));
result.push_back(Pair("coinbaseflags", HexStr(COINBASE_FLAGS.begin(), COINBASE_FLAGS.end())));
result.push_back(Pair("time", (int64_t)pblock->nTime));
result.push_back(Pair("mintime", (int64_t)pindexPrev->GetMedianTimePast()+1));
result.push_back(Pair("curtime", (int64_t)GetAdjustedTime()));
union {
int32_t nBits;

7
src/main.cpp

@ -3130,12 +3130,7 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& @@ -3130,12 +3130,7 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int&
hashPrevBlock = pblock->hashPrevBlock;
}
++nExtraNonce;
pblock->vtx[0].vin[0].scriptSig = CScript() << pblock->nTime << CBigNum(nExtraNonce);
// Put "/P2SH/" in the coinbase so everybody can tell when
// a majority of miners support it
const char* pszP2SH = "/P2SH/";
pblock->vtx[0].vin[0].scriptSig += CScript() << std::vector<unsigned char>(pszP2SH, pszP2SH+strlen(pszP2SH));
pblock->vtx[0].vin[0].scriptSig = (CScript() << pblock->nTime << CBigNum(nExtraNonce)) + COINBASE_FLAGS;
assert(pblock->vtx[0].vin[0].scriptSig.size() <= 100);
pblock->hashMerkleRoot = pblock->BuildMerkleTree();

6
src/main.h

@ -49,6 +49,12 @@ static const int fHaveUPnP = false; @@ -49,6 +49,12 @@ static const int fHaveUPnP = false;
#endif
// Put "/P2SH/" in the coinbase so everybody can tell when
// a majority of miners support it
static const char* pszP2SH = "/P2SH/";
static const CScript COINBASE_FLAGS = CScript() << std::vector<unsigned char>(pszP2SH, pszP2SH+strlen(pszP2SH));

Loading…
Cancel
Save