Merge pull request #6825
af6edac*: alias -h for --help (Daniel Cousens)131d7f9Change URLs to https in debian/control (Matt Corallo)7ce2c91Update debian/changelog and slight tweak to debian/control (Matt Corallo)4fbfebeCorrect spelling mistakes in doc folder (Mitchell Cash)e42bf16Clarification of unit test build instructions. (Eric Lombrozo)54f9deeUpdate bluematt-key, the old one is long-since revoked (Matt Corallo)bfc6154[Trivial] Fixed typo when referring to a previous section in depends/README.md [skip ci] (Chris Kleeschulte)9e45157build: disable -Wself-assign (Wladimir J. van der Laan)33d6825Bugfix: Allow mining on top of old tip blocks for testnet (fixes testnet-in-a-box use case) (Luke Dashjr)87a797abuild: Remove dependency of bitcoin-cli on secp256k1 (Wladimir J. van der Laan)a33cd5b[trivial] Fix rpc message "help generate" (MarcoFalke)6fd0019Drop "with minimal dependencies" from description (Zak Wilcox)2394f4dSplit bitcoin-tx into its own package (Zak Wilcox)1e672aeInclude bitcoin-tx binary on Debian/Ubuntu (Zak Wilcox)b3eaa30[Qt] Raise debug window when requested (MarcoFalke)01878c9Fix locking in GetTransaction. (Alex Morcos)9b9acc2Fix spelling of Qt (Diego Viola)
This commit is contained in:
76
src/main.cpp
76
src/main.cpp
@@ -1116,47 +1116,45 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock, bool fAllowSlow)
|
||||
{
|
||||
CBlockIndex *pindexSlow = NULL;
|
||||
|
||||
LOCK(cs_main);
|
||||
|
||||
if (mempool.lookup(hash, txOut))
|
||||
{
|
||||
LOCK(cs_main);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (fTxIndex) {
|
||||
CDiskTxPos postx;
|
||||
if (pblocktree->ReadTxIndex(hash, postx)) {
|
||||
CAutoFile file(OpenBlockFile(postx, true), SER_DISK, CLIENT_VERSION);
|
||||
if (file.IsNull())
|
||||
return error("%s: OpenBlockFile failed", __func__);
|
||||
CBlockHeader header;
|
||||
try {
|
||||
file >> header;
|
||||
fseek(file.Get(), postx.nTxOffset, SEEK_CUR);
|
||||
file >> txOut;
|
||||
} catch (const std::exception& e) {
|
||||
return error("%s: Deserialize or I/O error - %s", __func__, e.what());
|
||||
}
|
||||
hashBlock = header.GetHash();
|
||||
if (txOut.GetHash() != hash)
|
||||
return error("%s: txid mismatch", __func__);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fAllowSlow) { // use coin database to locate block that contains transaction, and scan it
|
||||
int nHeight = -1;
|
||||
{
|
||||
if (mempool.lookup(hash, txOut))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fTxIndex) {
|
||||
CDiskTxPos postx;
|
||||
if (pblocktree->ReadTxIndex(hash, postx)) {
|
||||
CAutoFile file(OpenBlockFile(postx, true), SER_DISK, CLIENT_VERSION);
|
||||
if (file.IsNull())
|
||||
return error("%s: OpenBlockFile failed", __func__);
|
||||
CBlockHeader header;
|
||||
try {
|
||||
file >> header;
|
||||
fseek(file.Get(), postx.nTxOffset, SEEK_CUR);
|
||||
file >> txOut;
|
||||
} catch (const std::exception& e) {
|
||||
return error("%s: Deserialize or I/O error - %s", __func__, e.what());
|
||||
}
|
||||
hashBlock = header.GetHash();
|
||||
if (txOut.GetHash() != hash)
|
||||
return error("%s: txid mismatch", __func__);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fAllowSlow) { // use coin database to locate block that contains transaction, and scan it
|
||||
int nHeight = -1;
|
||||
{
|
||||
CCoinsViewCache &view = *pcoinsTip;
|
||||
const CCoins* coins = view.AccessCoins(hash);
|
||||
if (coins)
|
||||
nHeight = coins->nHeight;
|
||||
}
|
||||
if (nHeight > 0)
|
||||
pindexSlow = chainActive[nHeight];
|
||||
CCoinsViewCache &view = *pcoinsTip;
|
||||
const CCoins* coins = view.AccessCoins(hash);
|
||||
if (coins)
|
||||
nHeight = coins->nHeight;
|
||||
}
|
||||
if (nHeight > 0)
|
||||
pindexSlow = chainActive[nHeight];
|
||||
}
|
||||
|
||||
if (pindexSlow) {
|
||||
@@ -1265,7 +1263,7 @@ bool IsInitialBlockDownload()
|
||||
if (lockIBDState)
|
||||
return false;
|
||||
bool state = (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 ||
|
||||
pindexBestHeader->GetBlockTime() < GetTime() - 24 * 60 * 60);
|
||||
pindexBestHeader->GetBlockTime() < GetTime() - chainParams.MaxTipAge());
|
||||
if (!state)
|
||||
lockIBDState = true;
|
||||
return state;
|
||||
|
||||
Reference in New Issue
Block a user