+
Bitcoin integration/staging tree
Development process
===================
- Developers work in their own trees, then submit pull requests when they think their feature or bug fix is ready.
+ Developers work in their own trees, then submit pull requests when
+ they think their feature or bug fix is ready.
+
+ If it is a simple/trivial/non-controversial change, then one of the
+ bitcoin development team members simply pulls it.
- If it is a simple/trivial/non-controversial change, then one of the bitcoin development team members simply pulls it.
+ If it is a more complicated or potentially controversial
+ change, then the patch submitter will be asked to start a
+ discussion (if they haven't already) on the mailing list:
+ http://sourceforge.net/mailarchive/forum.php?forum_name=bitcoin-development
- If it is a more complicated or potentially controversial change, then the patch submitter will be asked to start a discussion (if they haven't already) on the development forums: http://www.bitcoin.org/smf/index.php?board=6.0
- The patch will be accepted if there is broad consensus that it is a good thing. Developers should expect to rework and resubmit patches if they don't match the project's coding conventions (see coding.txt) or are controversial.
+ The patch will be accepted if there is broad consensus that it is a
+ good thing. Developers should expect to rework and resubmit patches
+ if they don't match the project's coding conventions (see coding.txt)
+ or are controversial.
- The master branch is regularly built and tested (by who? need people willing to be quality assurance testers), and periodically pushed to the subversion repo to become the official, stable, released bitcoin.
+ The master branch is regularly built and tested, but is not guaranteed
+ to be completely stable. Tags are regularly created to indicate new
+ official, stable release versions of Bitcoin. If you would like to
+ help test the Bitcoin core, please contact QA@Bitcoin.org.
+ Feature branches are created when there are major new features being
+ worked on by several people.
- Feature branches are created when there are major new features being worked on by several people.
uint256 hashGenesisBlock("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f");
static CBigNum bnProofOfWorkLimit(~uint256(0) >> 32);
const int nTotalBlocksEstimate = 140700; // Conservative estimate of total nr of blocks on main chain
+int nMaxBlocksOfOtherNodes = 0; // Maximum amount of blocks that other nodes claim to have
const int nInitialBlockThreshold = 120; // Regard blocks up until N-threshold as "initial download"
CBlockIndex* pindexGenesisBlock = NULL;
int nBestHeight = -1;
}
}
+// Return maximum amount of blocks that other nodes claim to have
+int GetMaxBlocksOfOtherNodes()
+{
+ return nMaxBlocksOfOtherNodes;
+}
+
bool IsInitialBlockDownload()
{
if (pindexBest == NULL || nBestHeight < (GetTotalBlocksEstimate()-nInitialBlockThreshold))
// Read txindex
CTxIndex txindex;
bool fFound = true;
- if (fMiner && mapTestPool.count(prevout.hash))
+ if ((fBlock || fMiner) && mapTestPool.count(prevout.hash))
{
// Get txindex from current proposed changes
txindex = mapTestPool[prevout.hash];
txindex.vSpent[prevout.n] = posThisTx;
// Write back
- if (fBlock)
- {
- if (!txdb.UpdateTxIndex(prevout.hash, txindex))
- return error("ConnectInputs() : UpdateTxIndex failed");
- }
- else if (fMiner)
+ if (fBlock || fMiner)
{
mapTestPool[prevout.hash] = txindex;
}
if (fBlock)
{
- // Add transaction to disk index
- if (!txdb.AddTxIndex(*this, posThisTx, pindexBlock->nHeight))
- return error("ConnectInputs() : AddTxPos failed");
+ // Add transaction to changes
+ mapTestPool[GetHash()] = CTxIndex(posThisTx, vout.size());
}
else if (fMiner)
{
//// issue here: it doesn't know the version
unsigned int nTxPos = pindex->nBlockPos + ::GetSerializeSize(CBlock(), SER_DISK) - 1 + GetSizeOfCompactSize(vtx.size());
- map<uint256, CTxIndex> mapUnused;
+ map<uint256, CTxIndex> mapQueuedChanges;
int64 nFees = 0;
BOOST_FOREACH(CTransaction& tx, vtx)
{
CDiskTxPos posThisTx(pindex->nFile, pindex->nBlockPos, nTxPos);
nTxPos += ::GetSerializeSize(tx, SER_DISK);
- if (!tx.ConnectInputs(txdb, mapUnused, posThisTx, pindex, nFees, true, false))
+ if (!tx.ConnectInputs(txdb, mapQueuedChanges, posThisTx, pindex, nFees, true, false))
return false;
}
+ // Write queued txindex changes
+ for (map<uint256, CTxIndex>::iterator mi = mapQueuedChanges.begin(); mi != mapQueuedChanges.end(); ++mi)
+ {
+ if (!txdb.UpdateTxIndex((*mi).first, (*mi).second))
+ return error("ConnectBlock() : UpdateTxIndex failed");
+ }
if (vtx[0].GetValueOut() > GetBlockValue(pindex->nHeight, nFees))
return false;
pfrom->fSuccessfullyConnected = true;
printf("version message: version %d, blocks=%d\n", pfrom->nVersion, pfrom->nStartingHeight);
+ if(pfrom->nStartingHeight > nMaxBlocksOfOtherNodes)
+ {
+ nMaxBlocksOfOtherNodes = pfrom->nStartingHeight;
+ }
}