From 2284a6ede534a7157ed572d33513ceb832c78ded Mon Sep 17 00:00:00 2001 From: Greg-Griffith Date: Tue, 25 Jun 2019 02:29:40 +0900 Subject: [PATCH 1/8] Refactor locking part1 (#218) * move undo block disc access to blockstorage, require proper locks * remove unnecessary cs_main locks from the wallet * move pcoinstip pblockdb to globals, require cs_main locks to use them * rework some cs_main lock uses * move rsm sync code into sync.cpp/.h * update cs_mapblockindex to use rsm locking macros * add missing librsm include to bench * remove cs_main lock assertions when cs_main isnt needed * make sure setBlockIndexCandidates is guarded by cs_main --- src/Makefile.am | 2 - src/Makefile.bench.include | 1 + src/blockstorage/blockstorage.cpp | 59 ++++++++++++++ src/blockstorage/blockstorage.h | 10 +++ src/chain/chainman.cpp | 14 ++-- src/chain/chainman.h | 24 ++---- src/chain/tx.cpp | 46 ++++++----- src/globals.cpp | 16 ++++ src/init.cpp | 28 +++---- src/kernel.cpp | 2 +- src/main.cpp | 49 +++++------- src/main.h | 7 +- src/net/messages.cpp | 25 +++--- src/processblock.cpp | 77 +++--------------- src/processblock.h | 1 - src/rpc/rpcblockchain.cpp | 23 +++--- src/rpc/rpcmining.cpp | 4 +- src/rpc/rpcrawtransaction.cpp | 10 +-- src/rpc/rpcwallet.cpp | 2 +- src/sync.cpp | 28 +++++++ src/sync.h | 41 ++++++++++ src/sync_rsm.cpp | 129 ------------------------------ src/sync_rsm.h | 67 ---------------- src/test/test_bitcoin.cpp | 8 +- src/undo.h | 1 + src/verifydb.cpp | 11 ++- src/wallet/wallet.cpp | 44 +++++----- 27 files changed, 301 insertions(+), 428 deletions(-) delete mode 100644 src/sync_rsm.cpp delete mode 100644 src/sync_rsm.h diff --git a/src/Makefile.am b/src/Makefile.am index 096d0d55..1a745dd2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -135,7 +135,6 @@ BITCOIN_CORE_H = \ support/cleanse.h \ support/pagelocker.h \ sync.h \ - sync_rsm.h \ threadgroup.h \ threadsafety.h \ timedata.h \ @@ -176,7 +175,6 @@ libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIC_FLAGS) $(PIE_FLAGS) libbitcoin_server_a_SOURCES = \ globals.cpp \ sync.cpp \ - sync_rsm.cpp \ net/addrdb.cpp \ net/addrman.cpp \ blockgeneration/blockgeneration.cpp \ diff --git a/src/Makefile.bench.include b/src/Makefile.bench.include index 73653e9d..07b7fb3b 100644 --- a/src/Makefile.bench.include +++ b/src/Makefile.bench.include @@ -21,6 +21,7 @@ bench_bench_bitcoin_LDADD = \ $(LIBLEVELDB) \ $(LIBLEVELDB_SSE42) \ $(LIBMEMENV) \ + $(LIBRSM) \ $(LIBSECP256K1) if ENABLE_ZMQ diff --git a/src/blockstorage/blockstorage.cpp b/src/blockstorage/blockstorage.cpp index f03dc57f..21f9500b 100644 --- a/src/blockstorage/blockstorage.cpp +++ b/src/blockstorage/blockstorage.cpp @@ -107,3 +107,62 @@ bool ReadBlockFromDisk(CBlock &block, const CBlockIndex *pindex, const Consensus } return true; } + +bool UndoWriteToDisk(const CBlockUndo &blockundo, + CDiskBlockPos &pos, + const uint256 &hashBlock, + const CMessageHeader::MessageMagic &messageStart) EXCLUSIVE_LOCKS_REQUIRED(cs_blockstorage) +{ + // Open history file to append + CAutoFile fileout(OpenUndoFile(pos), SER_DISK, CLIENT_VERSION); + if (fileout.IsNull()) + return error("%s: OpenUndoFile failed", __func__); + + // Write index header + unsigned int nSize = GetSerializeSize(fileout, blockundo); + fileout << FLATDATA(messageStart) << nSize; + + // Write undo data + long fileOutPos = ftell(fileout.Get()); + if (fileOutPos < 0) + return error("%s: ftell failed", __func__); + pos.nPos = (unsigned int)fileOutPos; + fileout << blockundo; + + // calculate & write checksum + CHashWriter hasher(SER_GETHASH, PROTOCOL_VERSION); + hasher << hashBlock; + hasher << blockundo; + fileout << hasher.GetHash(); + + return true; +} + +bool UndoReadFromDisk(CBlockUndo &blockundo, const CDiskBlockPos &pos, const uint256 &hashBlock) + EXCLUSIVE_LOCKS_REQUIRED(cs_blockstorage) +{ + // Open history file to read + CAutoFile filein(OpenUndoFile(pos, true), SER_DISK, CLIENT_VERSION); + if (filein.IsNull()) + return error("%s: OpenBlockFile failed", __func__); + + // Read block + uint256 hashChecksum; + CHashVerifier verifier(&filein); + try + { + verifier << hashBlock; + verifier >> blockundo; + filein >> hashChecksum; + } + catch (const std::exception &e) + { + return error("%s: Deserialize or I/O error - %s", __func__, e.what()); + } + + // Verify checksum + if (hashChecksum != verifier.GetHash()) + return error("%s: Checksum mismatch", __func__); + + return true; +} diff --git a/src/blockstorage/blockstorage.h b/src/blockstorage/blockstorage.h index cc4a06e4..0fa22f80 100644 --- a/src/blockstorage/blockstorage.h +++ b/src/blockstorage/blockstorage.h @@ -7,6 +7,7 @@ #include "fs.h" #include "net/protocol.h" #include "sync.h" +#include "undo.h" extern CCriticalSection cs_blockstorage; @@ -19,10 +20,19 @@ FILE *OpenUndoFile(const CDiskBlockPos &pos, bool fReadOnly = false); /** Functions for disk access for blocks */ bool WriteBlockToDisk(const CBlock &block, CDiskBlockPos &pos, const CMessageHeader::MessageMagic &messageStart) EXCLUSIVE_LOCKS_REQUIRED(cs_blockstorage); + bool ReadBlockFromDisk(CBlock &block, const CDiskBlockPos &pos, const Consensus::Params &consensusParams) EXCLUSIVE_LOCKS_REQUIRED(cs_blockstorage); + bool ReadBlockFromDisk(CBlock &block, const CBlockIndex *pindex, const Consensus::Params &consensusParams) EXCLUSIVE_LOCKS_REQUIRED(cs_blockstorage); +bool UndoWriteToDisk(const CBlockUndo &blockundo, + CDiskBlockPos &pos, + const uint256 &hashBlock, + const CMessageHeader::MessageMagic &messageStart) EXCLUSIVE_LOCKS_REQUIRED(cs_blockstorage); + +bool UndoReadFromDisk(CBlockUndo &blockundo, const CDiskBlockPos &pos, const uint256 &hashBlock) + EXCLUSIVE_LOCKS_REQUIRED(cs_blockstorage); #endif diff --git a/src/chain/chainman.cpp b/src/chain/chainman.cpp index c4de3c45..4a20ec3c 100644 --- a/src/chain/chainman.cpp +++ b/src/chain/chainman.cpp @@ -34,7 +34,7 @@ CBlockIndex *CChainManager::LookupBlockIndex(const uint256 &hash) { - READLOCK(cs_mapBlockIndex); + RECURSIVEREADLOCK(cs_mapBlockIndex); BlockMap::iterator mi = mapBlockIndex.find(hash); if (mi == mapBlockIndex.end()) return nullptr; @@ -44,7 +44,7 @@ CBlockIndex *CChainManager::LookupBlockIndex(const uint256 &hash) CBlockIndex *CChainManager::AddToBlockIndex(const CBlockHeader &block) { - WRITELOCK(cs_mapBlockIndex); + RECURSIVEWRITELOCK(cs_mapBlockIndex); // Check for duplicate uint256 hash = block.GetHash(); BlockMap::iterator it = mapBlockIndex.find(hash); @@ -79,7 +79,7 @@ CBlockIndex *CChainManager::AddToBlockIndex(const CBlockHeader &block) CBlockIndex *CChainManager::FindForkInGlobalIndex(const CChain &chain, const CBlockLocator &locator) { - READLOCK(cs_mapBlockIndex); + RECURSIVEREADLOCK(cs_mapBlockIndex); // Find the first block the caller has in the main chain for (auto const &hash : locator.vHave) { @@ -96,7 +96,7 @@ CBlockIndex *CChainManager::FindForkInGlobalIndex(const CChain &chain, const CBl bool CChainManager::IsInitialBlockDownload() { - READLOCK(cs_mapBlockIndex); + RECURSIVEREADLOCK(cs_mapBlockIndex); const CNetworkTemplate &chainParams = pnetMan->getActivePaymentNetwork(); if (fImporting || fReindex) return true; @@ -116,7 +116,7 @@ CBlockIndex *CChainManager::InsertBlockIndex(uint256 hash) { if (hash.IsNull()) return NULL; - WRITELOCK(cs_mapBlockIndex); + RECURSIVEWRITELOCK(cs_mapBlockIndex); // Return existing BlockMap::iterator mi = mapBlockIndex.find(hash); @@ -207,7 +207,7 @@ bool CChainManager::LoadBlockIndexDB() } LOCK(cs_main); - WRITELOCK(cs_mapBlockIndex); + RECURSIVEWRITELOCK(cs_mapBlockIndex); LogPrintf("LoadBlockIndexGuts %15dms\n", GetTimeMillis() - nStart); @@ -487,7 +487,7 @@ void CChainManager::UnloadBlockIndex() recentRejects.reset(nullptr); { - WRITELOCK(cs_mapBlockIndex); + RECURSIVEWRITELOCK(cs_mapBlockIndex); for (auto &entry : mapBlockIndex) { delete entry.second; diff --git a/src/chain/chainman.h b/src/chain/chainman.h index 5637b160..ce8fe9ba 100644 --- a/src/chain/chainman.h +++ b/src/chain/chainman.h @@ -37,22 +37,16 @@ typedef std::unordered_map BlockMap; class CChainManager { public: - CSharedCriticalSection cs_mapBlockIndex; + CRecursiveSharedCriticalSection cs_mapBlockIndex; /** map containing all block indexs ever seen for this chain */ BlockMap mapBlockIndex GUARDED_BY(cs_mapBlockIndex); - /** The currently-connected chain of blocks (protected by cs_main). */ + /** The currently-connected chain of blocks (protected by cs_mapBlockIndex). */ CChain chainActive; /** Best header we've seen so far (used for getheaders queries' starting points). */ - CBlockIndex *pindexBestHeader; - - /** Global variable that points to the active CCoinsView (protected by cs_main) */ - std::unique_ptr pcoinsTip; - - /** Global variable that points to the active block tree (protected by cs_main) */ - std::unique_ptr pblocktree; + CBlockIndex *pindexBestHeader GUARDED_BY(cs_mapBlockIndex); private: bool LoadBlockIndexDB(); @@ -62,9 +56,7 @@ class CChainManager { mapBlockIndex.clear(); chainActive = CChain(); - pindexBestHeader = NULL; - pcoinsTip.reset(); - pblocktree.reset(); + pindexBestHeader = nullptr; } ~CChainManager() @@ -72,21 +64,19 @@ class CChainManager // block headers BlockMap::iterator it1 = mapBlockIndex.begin(); for (; it1 != mapBlockIndex.end(); it1++) + { delete (*it1).second; + } mapBlockIndex.clear(); delete pindexBestHeader; - pcoinsTip.reset(); - pblocktree.reset(); } void operator=(const CChainManager &oldMan) { - WRITELOCK(cs_mapBlockIndex); + RECURSIVEWRITELOCK(cs_mapBlockIndex); mapBlockIndex = oldMan.mapBlockIndex; chainActive = oldMan.chainActive; pindexBestHeader = oldMan.pindexBestHeader; - pcoinsTip.reset(oldMan.pcoinsTip.get()); - pblocktree.reset(oldMan.pblocktree.get()); } /** Look up the block index entry for a given block hash. returns nullptr if it does not exist */ diff --git a/src/chain/tx.cpp b/src/chain/tx.cpp index 855e2857..f111539a 100644 --- a/src/chain/tx.cpp +++ b/src/chain/tx.cpp @@ -250,7 +250,7 @@ uint64_t CTransaction::GetCoinAge(uint64_t nCoinAge, bool byValue) const for (const CTxIn &txin : vin) { CDiskTxPos txindex; - if (!pnetMan->getChainActive()->pblocktree->ReadTxIndex(txin.prevout.hash, txindex)) + if (!pblocktree->ReadTxIndex(txin.prevout.hash, txindex)) continue; // previous transaction not in main chain // Read block header @@ -306,7 +306,7 @@ bool CTransaction::GetCoinAge(uint64_t &nCoinAge) const for (const CTxIn &txin : vin) { CDiskTxPos txindex; - if (!pnetMan->getChainActive()->pblocktree->ReadTxIndex(txin.prevout.hash, txindex)) + if (!pblocktree->ReadTxIndex(txin.prevout.hash, txindex)) continue; // previous transaction not in main chain // Read block header @@ -360,41 +360,43 @@ bool GetTransaction(const uint256 &hash, { CBlockIndex *pindexSlow = nullptr; - LOCK(cs_main); - if (mempool.lookup(hash, txOut)) { return true; } CDiskTxPos postx; - if (pnetMan->getChainActive()->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) + LOCK(cs_main); + if (pblocktree->ReadTxIndex(hash, postx)) { - return error("%s: Deserialize or I/O error - %s", __func__, e.what()); + 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; } - 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 { - CoinAccessor coin(*(pnetMan->getChainActive()->pcoinsTip), hash); + CoinAccessor coin(*(pcoinsTip), hash); if (!coin->IsSpent()) { + RECURSIVEREADLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); pindexSlow = pnetMan->getChainActive()->chainActive[coin->nHeight]; } } diff --git a/src/globals.cpp b/src/globals.cpp index 21c3d7ec..3ea8217e 100644 --- a/src/globals.cpp +++ b/src/globals.cpp @@ -2,7 +2,10 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include "coins.h" +#include "main.h" #include "sync.h" +#include "txdb.h" /** @@ -12,3 +15,16 @@ CCriticalSection cs_main; CCriticalSection cs_orphans; CCriticalSection cs_blockstorage; + +/** Global variable that points to the active CCoinsView */ +std::unique_ptr pcoinsTip GUARDED_BY(cs_main); + +/** Global variable that points to the active block tree */ +std::unique_ptr pblocktree GUARDED_BY(cs_main); + +/** + * The set of all CBlockIndex entries with BLOCK_VALID_TRANSACTIONS (for itself and all ancestors) and + * as good as our current tip or better. Entries may be failed, though, and pruning nodes may be + * missing the data for the block. + */ +std::set setBlockIndexCandidates GUARDED_BY(cs_main); diff --git a/src/init.cpp b/src/init.cpp index c914429f..da0a0276 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -208,11 +208,11 @@ void Shutdown(thread_group &threadGroup) { LOCK(cs_main); - if (pnetMan->getChainActive()->pcoinsTip != nullptr) + if (pcoinsTip != nullptr) { // Flush state and clear cache completely to release as much memory as possible before continuing. FlushStateToDisk(); - pnetMan->getChainActive()->pcoinsTip->Clear(); + pcoinsTip->Clear(); } } @@ -251,18 +251,18 @@ void Shutdown(thread_group &threadGroup) { LOCK(cs_main); - if (pnetMan->getChainActive()->pcoinsTip != nullptr) + if (pcoinsTip != nullptr) { FlushStateToDisk(); } - pnetMan->getChainActive()->pcoinsTip.reset(); - pnetMan->getChainActive()->pcoinsTip = nullptr; + pcoinsTip.reset(); + pcoinsTip = nullptr; pcoinscatcher.reset(); pcoinscatcher = nullptr; pcoinsdbview.reset(); pcoinsdbview = nullptr; - pnetMan->getChainActive()->pblocktree.reset(); - pnetMan->getChainActive()->pblocktree = nullptr; + pblocktree.reset(); + pblocktree = nullptr; } if (pwalletMain) @@ -713,7 +713,7 @@ void ThreadImport(std::vector vImportFiles) pnetMan->getChainActive()->LoadExternalBlockFile(chainparams, file, &pos); nFile++; } - pnetMan->getChainActive()->pblocktree->WriteReindexing(false); + pblocktree->WriteReindexing(false); fReindex = false; LogPrintf("Reindexing finished\n"); // To avoid ending up in a situation without genesis block, re-try initializing (no-op if reindexing worked): @@ -1461,19 +1461,19 @@ bool AppInit2(thread_group &threadGroup) try { pnetMan->getChainActive()->UnloadBlockIndex(); - pnetMan->getChainActive()->pcoinsTip.reset(); + pcoinsTip.reset(); pcoinsdbview.reset(); pcoinscatcher.reset(); - pnetMan->getChainActive()->pblocktree.reset(); + pblocktree.reset(); - pnetMan->getChainActive()->pblocktree.reset(new CBlockTreeDB(nBlockTreeDBCache, false, fReindex)); + pblocktree.reset(new CBlockTreeDB(nBlockTreeDBCache, false, fReindex)); pcoinsdbview.reset(new CCoinsViewDB(nCoinDBCache, false, fReset)); pcoinscatcher.reset(new CCoinsViewErrorCatcher(pcoinsdbview.get())); - pnetMan->getChainActive()->pcoinsTip.reset(new CCoinsViewCache(pcoinscatcher.get())); + pcoinsTip.reset(new CCoinsViewCache(pcoinscatcher.get())); if (fReindex) { - pnetMan->getChainActive()->pblocktree->WriteReindexing(true); + pblocktree->WriteReindexing(true); } else { @@ -1493,7 +1493,7 @@ bool AppInit2(thread_group &threadGroup) // If the loaded chain has a wrong genesis, bail out immediately // (we're likely using a testnet datadir, or the other way around). { - READLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); + RECURSIVEREADLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); if (!pnetMan->getChainActive()->mapBlockIndex.empty() && pnetMan->getChainActive()->mapBlockIndex.count(chainparams.GetConsensus().hashGenesisBlock) == 0) diff --git a/src/kernel.cpp b/src/kernel.cpp index e4366785..fd3ec153 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -299,7 +299,7 @@ bool CheckProofOfStake(int nHeight, const CTransaction &tx, uint256 &hashProofOf } CDiskTxPos txindex; - pnetMan->getChainActive()->pblocktree->ReadTxIndex(txPrev.GetHash(), txindex); + pblocktree->ReadTxIndex(txPrev.GetHash(), txindex); if (nHeight < 1505775) { if (!CheckStakeKernelHash( diff --git a/src/main.cpp b/src/main.cpp index 1f41bae6..a4e5037b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -109,13 +109,6 @@ const std::string strMessageMagic = "ECC Signed Message:\n"; CBlockIndex *pindexBestInvalid; -/** - * The set of all CBlockIndex entries with BLOCK_VALID_TRANSACTIONS (for itself and all ancestors) and - * as good as our current tip or better. Entries may be failed, though, and pruning nodes may be - * missing the data for the block. - */ -std::set setBlockIndexCandidates; - /** All pairs A->B, where A (or one of its ancestors) misses transactions, but B has transactions. * Pruned nodes may have entries where B is missing data. */ @@ -185,8 +178,6 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime) bool CheckFinalTx(const CTransaction &tx, int flags) { - AssertLockHeld(cs_main); - // By convention a negative value for flags indicates that the // current network-enforced consensus rules should be used. In // a future soft-fork scenario that would mean checking which @@ -310,7 +301,6 @@ bool SequenceLocks(const CTransaction &tx, int flags, std::vector *prevHeig bool TestLockPointValidity(const LockPoints *lp) { - AssertLockHeld(cs_main); assert(lp); // If there are relative lock times then the maxInputBlock will be set // If there are no relative lock times, the LockPoints don't depend on the chain @@ -318,6 +308,7 @@ bool TestLockPointValidity(const LockPoints *lp) { // Check whether chainActive is an extension of the block at which the LockPoints // calculation was valid. If not LockPoints are no longer valid + RECURSIVEREADLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); if (!pnetMan->getChainActive()->chainActive.Contains(lp->maxInputBlock)) { return false; @@ -354,7 +345,7 @@ bool CheckSequenceLocks(const CTransaction &tx, int flags, LockPoints *lp, bool else { // pcoinsTip contains the UTXO set for chainActive.Tip() - CCoinsViewMemPool viewMemPool(pnetMan->getChainActive()->pcoinsTip.get(), mempool); + CCoinsViewMemPool viewMemPool(pcoinsTip.get(), mempool); std::vector prevheights; prevheights.resize(tx.vin.size()); for (size_t txinIndex = 0; txinIndex < tx.vin.size(); txinIndex++) @@ -445,7 +436,7 @@ void LimitMempoolSize(CTxMemPool &pool, size_t limit, unsigned long age) int expired = pool.Expire(GetTime() - age, vCoinsToUncache); for (const COutPoint &txin : vCoinsToUncache) { - pnetMan->getChainActive()->pcoinsTip->Uncache(txin); + pcoinsTip->Uncache(txin); } if (expired != 0) LogPrint("mempool", "Expired %i transactions from the memory pool\n", expired); @@ -454,7 +445,7 @@ void LimitMempoolSize(CTxMemPool &pool, size_t limit, unsigned long age) pool.TrimToSize(limit, &vNoSpendsRemaining); for (const COutPoint &removed : vNoSpendsRemaining) { - pnetMan->getChainActive()->pcoinsTip->Uncache(removed); + pcoinsTip->Uncache(removed); } } @@ -532,7 +523,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool &pool, LockPoints lp; { WRITELOCK(pool.cs); - CCoinsViewMemPool viewMemPool(pnetMan->getChainActive()->pcoinsTip.get(), pool); + CCoinsViewMemPool viewMemPool(pcoinsTip.get(), pool); view.SetBackend(viewMemPool); // do all inputs exist? @@ -550,7 +541,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool &pool, // We still want to keep orphantx coins in the event the orphantx is finally accepted into the // mempool or shows up in a block that is mined. Therefore if pfMissingInputs returns true then // any coins in vCoinsToUncache will NOT be uncached. - if (!pnetMan->getChainActive()->pcoinsTip->HaveCoinInCache(txin.prevout)) + if (!pcoinsTip->HaveCoinInCache(txin.prevout)) { vCoinsToUncache.push_back(txin.prevout); } @@ -816,7 +807,7 @@ bool AcceptToMemoryPool(CTxMemPool &pool, { for (const COutPoint &remove : vCoinsToUncache) { - pnetMan->getChainActive()->pcoinsTip->Uncache(remove); + pcoinsTip->Uncache(remove); } } return res; @@ -1065,7 +1056,7 @@ bool FlushStateToDisk(CValidationState &state, FlushStateMode mode) { nLastSetChain = nNow; } - size_t cacheSize = pnetMan->getChainActive()->pcoinsTip->DynamicMemoryUsage(); + size_t cacheSize = pcoinsTip->DynamicMemoryUsage(); static int64_t nSizeAfterLastFlush = 0; // The cache is close to the limit. Try to flush and trim. bool fCacheCritical = ((mode == FLUSH_STATE_IF_NEEDED) && (cacheSize > nCoinCacheUsage * 0.995)) || @@ -1104,7 +1095,7 @@ bool FlushStateToDisk(CValidationState &state, FlushStateMode mode) vBlocks.push_back(*it); setDirtyBlockIndex.erase(it++); } - if (!pnetMan->getChainActive()->pblocktree->WriteBatchSync(vFiles, nLastBlockFile, vBlocks)) + if (!pblocktree->WriteBatchSync(vFiles, nLastBlockFile, vBlocks)) { return AbortNode(state, "Files to write to block index database"); } @@ -1119,12 +1110,12 @@ bool FlushStateToDisk(CValidationState &state, FlushStateMode mode) // twice (once in the log, and once in the tables). This is already // an overestimation, as most will delete an existing entry or // overwrite one. Still, use a conservative safety factor of 2. - if (!CheckDiskSpace(48 * 2 * 2 * pnetMan->getChainActive()->pcoinsTip->GetCacheSize())) + if (!CheckDiskSpace(48 * 2 * 2 * pcoinsTip->GetCacheSize())) { return state.Error("out of disk space"); } // Flush the chainstate (which may refer to block index entries). - if (!pnetMan->getChainActive()->pcoinsTip->Flush()) + if (!pcoinsTip->Flush()) { return AbortNode(state, "Failed to write to coin database"); } @@ -1135,8 +1126,8 @@ bool FlushStateToDisk(CValidationState &state, FlushStateMode mode) { nTrimSize = nCoinCacheUsage - nMaxCacheIncreaseSinceLastFlush; } - pnetMan->getChainActive()->pcoinsTip->Trim(nTrimSize); - nSizeAfterLastFlush = pnetMan->getChainActive()->pcoinsTip->DynamicMemoryUsage(); + pcoinsTip->Trim(nTrimSize); + nSizeAfterLastFlush = pcoinsTip->DynamicMemoryUsage(); } if (fDoFullFlush || ((mode == FLUSH_STATE_ALWAYS || mode == FLUSH_STATE_PERIODIC) && nNow > nLastSetChain + (int64_t)DATABASE_WRITE_INTERVAL * 1000000)) @@ -1151,7 +1142,7 @@ bool FlushStateToDisk(CValidationState &state, FlushStateMode mode) // an error is reported if the new and old values do not match. if (fPeriodicFlush) { - pnetMan->getChainActive()->pcoinsTip->ResetCachedCoinUsage(); + pcoinsTip->ResetCachedCoinUsage(); } return true; } @@ -1182,7 +1173,7 @@ void PruneBlockIndexCandidates() bool InvalidateBlock(CValidationState &state, const Consensus::Params &consensusParams, CBlockIndex *pindex) { - WRITELOCK(pnetMan->getChainActive()->cs_mapBlockIndex); + RECURSIVEWRITELOCK(pnetMan->getChainActive()->cs_mapBlockIndex); // Mark the block itself as invalid. pindex->nStatus |= BLOCK_FAILED_VALID; setDirtyBlockIndex.insert(pindex); @@ -1198,8 +1189,8 @@ bool InvalidateBlock(CValidationState &state, const Consensus::Params &consensus // unconditionally valid already, so force disconnect away from it. if (!DisconnectTip(state, consensusParams)) { - mempool.removeForReorg(pnetMan->getChainActive()->pcoinsTip.get(), - pnetMan->getChainActive()->chainActive.Tip()->nHeight + 1, STANDARD_LOCKTIME_VERIFY_FLAGS); + mempool.removeForReorg(pcoinsTip.get(), pnetMan->getChainActive()->chainActive.Tip()->nHeight + 1, + STANDARD_LOCKTIME_VERIFY_FLAGS); return false; } } @@ -1219,15 +1210,15 @@ bool InvalidateBlock(CValidationState &state, const Consensus::Params &consensus } InvalidChainFound(pindex); - mempool.removeForReorg(pnetMan->getChainActive()->pcoinsTip.get(), - pnetMan->getChainActive()->chainActive.Tip()->nHeight + 1, STANDARD_LOCKTIME_VERIFY_FLAGS); + mempool.removeForReorg( + pcoinsTip.get(), pnetMan->getChainActive()->chainActive.Tip()->nHeight + 1, STANDARD_LOCKTIME_VERIFY_FLAGS); return true; } bool ReconsiderBlock(CValidationState &state, CBlockIndex *pindex) { int nHeight = pindex->nHeight; - WRITELOCK(pnetMan->getChainActive()->cs_mapBlockIndex); + RECURSIVEWRITELOCK(pnetMan->getChainActive()->cs_mapBlockIndex); // Remove the invalidity flag from this block if (!pindex->IsValid()) { diff --git a/src/main.h b/src/main.h index d632e7c0..ef3a7335 100644 --- a/src/main.h +++ b/src/main.h @@ -160,6 +160,11 @@ extern bool fCheckpointsEnabled; extern size_t nCoinCacheUsage; extern CFeeRate minRelayTxFee; +/** Global variable that points to the active CCoinsView */ +extern std::unique_ptr pcoinsTip GUARDED_BY(cs_main); +/** Global variable that points to the active block tree */ +extern std::unique_ptr pblocktree GUARDED_BY(cs_main); + struct COrphanTx { CTransaction tx; @@ -430,7 +435,7 @@ bool ContextualCheckBlock(const CBlock &block, CValidationState &state, CBlockIn /* Calculate the amount of disk space the block & undo files currently use */ uint64_t CalculateCurrentUsage(); -extern std::set setBlockIndexCandidates; +extern std::set setBlockIndexCandidates GUARDED_BY(cs_main); class CBlockFileInfo { diff --git a/src/net/messages.cpp b/src/net/messages.cpp index 4f196bda..9d179b56 100644 --- a/src/net/messages.cpp +++ b/src/net/messages.cpp @@ -191,8 +191,7 @@ void FinalizeNode(NodeId nodeid, bool &fUpdateConnectionTime) } } -// TODO might require cs_main -bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) +bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { CNodeStateAccessor state(nodestateman, nodeid); if (state.IsNull()) @@ -247,10 +246,8 @@ static void Misbehaving(CNode *node, int howmuch, const std::string &reason) Misbehaving(node->GetId(), howmuch, reason); } - -// Requires cs_main. // Returns a bool indicating whether we requested this block. -bool MarkBlockAsReceived(const uint256 &hash) +bool MarkBlockAsReceived(const uint256 &hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { std::map::iterator> >::iterator itInFlight = mapBlocksInFlight.find(hash); @@ -300,8 +297,7 @@ const CBlockIndex *LastCommonAncestor(const CBlockIndex *pa, const CBlockIndex * return pa; } -// Requires cs_main -bool CanDirectFetch(const Consensus::Params &consensusParams) +bool CanDirectFetch(const Consensus::Params &consensusParams) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { int64_t targetSpacing = consensusParams.nTargetSpacing; if (pnetMan->getChainActive()->chainActive.Tip()->GetMedianTimePast() > SERVICE_UPGRADE_HARDFORK) @@ -454,11 +450,10 @@ unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans) EXCLUSIVE_LOCKS_REQUIRE return nEvicted; } -// Requires cs_main. void MarkBlockAsInFlight(NodeId nodeid, const uint256 &hash, const Consensus::Params &consensusParams, - const CBlockIndex *pindex = nullptr) + const CBlockIndex *pindex = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { CNodeStateAccessor state(nodestateman, nodeid); assert(state.IsNull() == false); @@ -620,8 +615,7 @@ void FindNextBlocksToDownload(NodeId nodeid, } } -// Requires cs_main -bool PeerHasHeader(CNodeState *state, const CBlockIndex *pindex) +bool PeerHasHeader(CNodeState *state, const CBlockIndex *pindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { if (state->pindexBestKnownBlock && pindex == state->pindexBestKnownBlock->GetAncestor(pindex->nHeight)) { @@ -758,11 +752,10 @@ bool AlreadyHave(const CInv &inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main) LOCK(cs_orphans); return recentRejects->contains(inv.hash) || mempool.exists(inv.hash) || mapOrphanTransactions.count(inv.hash) || // Best effort: only try output 0 and 1 - pnetMan->getChainActive()->pcoinsTip->HaveCoinInCache(COutPoint(inv.hash, 0)) || - pnetMan->getChainActive()->pcoinsTip->HaveCoinInCache(COutPoint(inv.hash, 1)); + pcoinsTip->HaveCoinInCache(COutPoint(inv.hash, 0)) || pcoinsTip->HaveCoinInCache(COutPoint(inv.hash, 1)); } case MSG_BLOCK: - READLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); + RECURSIVEREADLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); return pnetMan->getChainActive()->mapBlockIndex.count(inv.hash); } // Don't know what it is, just say we already got one @@ -1516,7 +1509,7 @@ bool static ProcessMessage(CNode *pfrom, if (!AlreadyHave(inv) && AcceptToMemoryPool(mempool, state, ptx, true, &fMissingInputs)) { - mempool.check(pnetMan->getChainActive()->pcoinsTip.get()); + mempool.check(pcoinsTip.get()); RelayTransaction(tx, connman); for (size_t i = 0; i < tx.vout.size(); i++) { @@ -1595,7 +1588,7 @@ bool static ProcessMessage(CNode *pfrom, recentRejects->insert(orphanId); } } - mempool.check(pnetMan->getChainActive()->pcoinsTip.get()); + mempool.check(pcoinsTip.get()); } } diff --git a/src/processblock.cpp b/src/processblock.cpp index f32518a4..1f9a1775 100644 --- a/src/processblock.cpp +++ b/src/processblock.cpp @@ -171,7 +171,7 @@ bool ProcessNewBlock(CValidationState &state, } // Store to disk - CBlockIndex *pindex = NULL; + CBlockIndex *pindex = nullptr; bool ret = AcceptBlock(pblock, state, chainparams, &pindex, fRequested, dbp); CheckBlockIndex(chainparams.GetConsensus()); if (!ret) @@ -207,8 +207,7 @@ void UpdateTip(CBlockIndex *pindexNew) log(pnetMan->getChainActive()->chainActive.Tip()->nChainWork.getdouble()) / log(2.0), (unsigned long)(pnetMan->getChainActive()->chainActive.Tip()->nChainTx), DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pnetMan->getChainActive()->chainActive.Tip()->GetBlockTime()), - pnetMan->getChainActive()->pcoinsTip->DynamicMemoryUsage() * (1.0 / (1 << 20)), - pnetMan->getChainActive()->pcoinsTip->GetCacheSize()); + pcoinsTip->DynamicMemoryUsage() * (1.0 / (1 << 20)), pcoinsTip->GetCacheSize()); cvBlockChange.notify_all(); } @@ -230,7 +229,7 @@ bool DisconnectTip(CValidationState &state, const Consensus::Params &consensusPa // Apply the block atomically to the chain state. int64_t nStart = GetTimeMicros(); { - CCoinsViewCache view(pnetMan->getChainActive()->pcoinsTip.get()); + CCoinsViewCache view(pcoinsTip.get()); if (DisconnectBlock(block, pindexDelete, view) != DISCONNECT_OK) { return error("DisconnectTip(): DisconnectBlock %s failed", pindexDelete->GetBlockHash().ToString()); @@ -315,7 +314,7 @@ bool ConnectTip(CValidationState &state, LogPrint( "bench", " - Load block from disk: %.2fms [%.2fs]\n", (nTime2 - nTime1) * 0.001, nTimeReadFromDisk * 0.000001); { - CCoinsViewCache view(pnetMan->getChainActive()->pcoinsTip.get()); + CCoinsViewCache view(pcoinsTip.get()); bool rv = ConnectBlock(*pblock, state, pindexNew, view); if (!rv) { @@ -587,12 +586,12 @@ bool ActivateBestChainStep(CValidationState &state, if (fBlocksDisconnected) { - mempool.removeForReorg(pnetMan->getChainActive()->pcoinsTip.get(), - pnetMan->getChainActive()->chainActive.Tip()->nHeight + 1, STANDARD_LOCKTIME_VERIFY_FLAGS); + mempool.removeForReorg( + pcoinsTip.get(), pnetMan->getChainActive()->chainActive.Tip()->nHeight + 1, STANDARD_LOCKTIME_VERIFY_FLAGS); LimitMempoolSize(mempool, gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000, gArgs.GetArg("-mempoolexpiry", DEFAULT_MEMPOOL_EXPIRY) * 60 * 60); } - mempool.check(pnetMan->getChainActive()->pcoinsTip.get()); + mempool.check(pcoinsTip.get()); // Callbacks/notifications for a new best chain. if (fInvalidFound) { @@ -663,7 +662,7 @@ void CheckBlockIndex(const Consensus::Params &consensusParams) } LOCK(cs_main); - READLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); + RECURSIVEREADLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); // During a reindex, we read the genesis block and call CheckBlockIndex before ActivateBestChain, // so we have the genesis block in mapBlockIndex but no active chain. (A few of the tests when @@ -1035,64 +1034,6 @@ bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigne return true; } -bool UndoWriteToDisk(const CBlockUndo &blockundo, - CDiskBlockPos &pos, - const uint256 &hashBlock, - const CMessageHeader::MessageMagic &messageStart) -{ - // Open history file to append - CAutoFile fileout(OpenUndoFile(pos), SER_DISK, CLIENT_VERSION); - if (fileout.IsNull()) - return error("%s: OpenUndoFile failed", __func__); - - // Write index header - unsigned int nSize = GetSerializeSize(fileout, blockundo); - fileout << FLATDATA(messageStart) << nSize; - - // Write undo data - long fileOutPos = ftell(fileout.Get()); - if (fileOutPos < 0) - return error("%s: ftell failed", __func__); - pos.nPos = (unsigned int)fileOutPos; - fileout << blockundo; - - // calculate & write checksum - CHashWriter hasher(SER_GETHASH, PROTOCOL_VERSION); - hasher << hashBlock; - hasher << blockundo; - fileout << hasher.GetHash(); - - return true; -} - -bool UndoReadFromDisk(CBlockUndo &blockundo, const CDiskBlockPos &pos, const uint256 &hashBlock) -{ - // Open history file to read - CAutoFile filein(OpenUndoFile(pos, true), SER_DISK, CLIENT_VERSION); - if (filein.IsNull()) - return error("%s: OpenBlockFile failed", __func__); - - // Read block - uint256 hashChecksum; - CHashVerifier verifier(&filein); - try - { - verifier << hashBlock; - verifier >> blockundo; - filein >> hashChecksum; - } - catch (const std::exception &e) - { - return error("%s: Deserialize or I/O error - %s", __func__, e.what()); - } - - // Verify checksum - if (hashChecksum != verifier.GetHash()) - return error("%s: Checksum mismatch", __func__); - - return true; -} - static CCheckQueue scriptcheckqueue(128); void ThreadScriptCheck() @@ -1405,7 +1346,7 @@ bool ConnectBlock(const CBlock &block, setDirtyBlockIndex.insert(pindex); } - if (!pnetMan->getChainActive()->pblocktree->WriteTxIndex(vPos)) + if (!pblocktree->WriteTxIndex(vPos)) { return AbortNode(state, "Failed to write transaction index"); } diff --git a/src/processblock.h b/src/processblock.h index b62020f7..cc5df753 100644 --- a/src/processblock.h +++ b/src/processblock.h @@ -64,7 +64,6 @@ bool ProcessNewBlock(CValidationState &state, bool DisconnectTip(CValidationState &state, const Consensus::Params &consensusParams); void InvalidChainFound(CBlockIndex *pindexNew); void InvalidBlockFound(CBlockIndex *pindex, const CValidationState &state); -bool UndoReadFromDisk(CBlockUndo &blockundo, const CDiskBlockPos &pos, const uint256 &hashBlock); /** Run an instance of the script checking thread */ void ThreadScriptCheck(); diff --git a/src/rpc/rpcblockchain.cpp b/src/rpc/rpcblockchain.cpp index 674c8e2b..0822afc9 100644 --- a/src/rpc/rpcblockchain.cpp +++ b/src/rpc/rpcblockchain.cpp @@ -611,7 +611,7 @@ UniValue gettxout(const UniValue ¶ms, bool fHelp) if (fMempool) { READLOCK(mempool.cs); - CCoinsViewMemPool view(pnetMan->getChainActive()->pcoinsTip.get(), mempool); + CCoinsViewMemPool view(pcoinsTip.get(), mempool); if (!view.GetCoin(out, coin) || mempool.isSpent(out)) { return NullUniValue; @@ -619,14 +619,13 @@ UniValue gettxout(const UniValue ¶ms, bool fHelp) } else { - if (!pnetMan->getChainActive()->pcoinsTip->GetCoin(out, coin)) + if (!pcoinsTip->GetCoin(out, coin)) { return NullUniValue; } } - CBlockIndex *pindex = - pnetMan->getChainActive()->LookupBlockIndex(pnetMan->getChainActive()->pcoinsTip->GetBestBlock()); + CBlockIndex *pindex = pnetMan->getChainActive()->LookupBlockIndex(pcoinsTip->GetBestBlock()); ret.push_back(Pair("bestblock", pindex->GetBlockHash().GetHex())); if ((unsigned int)coin.nHeight == MEMPOOL_HEIGHT) ret.push_back(Pair("confirmations", 0)); @@ -665,8 +664,7 @@ UniValue verifychain(const UniValue ¶ms, bool fHelp) if (params.size() > 1) nCheckDepth = params[1].get_int(); - return CVerifyDB().VerifyDB( - pnetMan->getActivePaymentNetwork(), pnetMan->getChainActive()->pcoinsTip.get(), nCheckLevel, nCheckDepth); + return CVerifyDB().VerifyDB(pnetMan->getActivePaymentNetwork(), pcoinsTip.get(), nCheckLevel, nCheckDepth); } /** Implementation of IsSuperMajority with better feedback */ @@ -811,7 +809,7 @@ static std::set GetChainTips() std::set setOrphans; std::set setPrevs; - READLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); + RECURSIVEREADLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); for (const std::pair &item : pnetMan->getChainActive()->mapBlockIndex) { if (!pnetMan->getChainActive()->chainActive.Contains(item.second)) @@ -973,14 +971,11 @@ UniValue invalidateblock(const UniValue ¶ms, bool fHelp) uint256 hash(uint256S(strHash)); CValidationState state; - { - CBlockIndex *pblockindex = pnetMan->getChainActive()->LookupBlockIndex(hash); - if (!pblockindex) - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); + CBlockIndex *pblockindex = pnetMan->getChainActive()->LookupBlockIndex(hash); + if (!pblockindex) + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); - LOCK(cs_main); - InvalidateBlock(state, pnetMan->getActivePaymentNetwork()->GetConsensus(), pblockindex); - } + InvalidateBlock(state, pnetMan->getActivePaymentNetwork()->GetConsensus(), pblockindex); if (state.IsValid()) { diff --git a/src/rpc/rpcmining.cpp b/src/rpc/rpcmining.cpp index 7003fa95..f6b3a3f2 100644 --- a/src/rpc/rpcmining.cpp +++ b/src/rpc/rpcmining.cpp @@ -672,7 +672,7 @@ UniValue getblocktemplate(const UniValue ¶ms, bool fHelp) !CheckIndexAgainstCheckpoint( pindexPrev, state, pnetMan->getActivePaymentNetwork(), block.GetHash())) return error("%s: CheckIndexAgainstCheckpoint(): %s", __func__, state.GetRejectReason().c_str()); - CCoinsViewCache viewNew(pnetMan->getChainActive()->pcoinsTip.get()); + CCoinsViewCache viewNew(pcoinsTip.get()); CBlockIndex indexDummy(block); indexDummy.pprev = pindexPrev; indexDummy.nHeight = pindexPrev->nHeight + 1; @@ -999,7 +999,7 @@ UniValue getposblocktemplate(const UniValue ¶ms, bool fHelp) !CheckIndexAgainstCheckpoint( pindexPrev, state, pnetMan->getActivePaymentNetwork(), block.GetHash())) return error("%s: CheckIndexAgainstCheckpoint(): %s", __func__, state.GetRejectReason().c_str()); - CCoinsViewCache viewNew(pnetMan->getChainActive()->pcoinsTip.get()); + CCoinsViewCache viewNew(pcoinsTip.get()); CBlockIndex indexDummy(block); indexDummy.pprev = pindexPrev; indexDummy.nHeight = pindexPrev->nHeight + 1; diff --git a/src/rpc/rpcrawtransaction.cpp b/src/rpc/rpcrawtransaction.cpp index 7526e70f..272e7cf4 100644 --- a/src/rpc/rpcrawtransaction.cpp +++ b/src/rpc/rpcrawtransaction.cpp @@ -265,7 +265,7 @@ UniValue gettxoutproof(const UniValue ¶ms, bool fHelp) uint256 hashBlock; if (params.size() > 1) { - READLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); + RECURSIVEREADLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); hashBlock = uint256S(params[1].get_str()); if (!pnetMan->getChainActive()->mapBlockIndex.count(hashBlock)) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); @@ -274,7 +274,7 @@ UniValue gettxoutproof(const UniValue ¶ms, bool fHelp) else { LOCK(cs_main); - CoinAccessor coin(*pnetMan->getChainActive()->pcoinsTip, oneTxid); + CoinAccessor coin(*pcoinsTip, oneTxid); if (coin && !coin->IsSpent() && coin->nHeight > 0 && coin->nHeight <= pnetMan->getChainActive()->chainActive.Height()) { @@ -288,7 +288,7 @@ UniValue gettxoutproof(const UniValue ¶ms, bool fHelp) if (!GetTransaction(oneTxid, tx, pnetMan->getActivePaymentNetwork()->GetConsensus(), hashBlock, false) || hashBlock.IsNull()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not yet in block"); - READLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); + RECURSIVEREADLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); if (!pnetMan->getChainActive()->mapBlockIndex.count(hashBlock)) throw JSONRPCError(RPC_INTERNAL_ERROR, "Transaction index corrupt"); pblockindex = pnetMan->getChainActive()->mapBlockIndex[hashBlock]; @@ -685,7 +685,7 @@ UniValue signrawtransaction(const UniValue ¶ms, bool fHelp) CCoinsViewCache view(&viewDummy); { READLOCK(mempool.cs); - CCoinsViewCache &viewChain = *pnetMan->getChainActive()->pcoinsTip; + CCoinsViewCache &viewChain = *pcoinsTip; CCoinsViewMemPool viewMempool(&viewChain, mempool); view.SetBackend(viewMempool); // temporarily switch cache backend to db+mempool view @@ -883,7 +883,7 @@ UniValue sendrawtransaction(const UniValue ¶ms, bool fHelp) if (params.size() > 1) fOverrideFees = params[1].get_bool(); - CCoinsViewCache &view = *pnetMan->getChainActive()->pcoinsTip; + CCoinsViewCache &view = *pcoinsTip; bool fHaveChain = false; for (size_t o = 0; !fHaveChain && o < tx->vout.size(); o++) { diff --git a/src/rpc/rpcwallet.cpp b/src/rpc/rpcwallet.cpp index 3490690d..a75a7ddd 100644 --- a/src/rpc/rpcwallet.cpp +++ b/src/rpc/rpcwallet.cpp @@ -80,7 +80,7 @@ void WalletTxToJSON(const CWalletTx &wtx, UniValue &entry) } if (confirms > 0) { - READLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); + RECURSIVEREADLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); entry.push_back(Pair("blockhash", wtx.hashBlock.GetHex())); entry.push_back(Pair("blockindex", wtx.nIndex)); entry.push_back(Pair("blocktime", pnetMan->getChainActive()->mapBlockIndex[wtx.hashBlock]->GetBlockTime())); diff --git a/src/sync.cpp b/src/sync.cpp index 2ad54f9c..61cb412b 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -391,4 +391,32 @@ void DeleteLock(void *cs) } } +#ifdef DEBUG_LOCKORDER +CRecursiveSharedCriticalSection::CRecursiveSharedCriticalSection() : name(nullptr) {} +CRecursiveSharedCriticalSection::CRecursiveSharedCriticalSection(const char *n) : name(n) +{ +// print the address of named critical sections so they can be found in the mutrace output +#ifdef ENABLE_MUTRACE + if (name) + { + LogPrintf("CRecursiveSharedCriticalSection %s at %p\n", name, this); + fflush(stdout); + } +#endif +} + +CRecursiveSharedCriticalSection::~CRecursiveSharedCriticalSection() +{ +#ifdef ENABLE_MUTRACE + if (name) + { + LogPrintf("Destructing CRecursiveSharedCriticalSection %s\n", name); + fflush(stdout); + } +#endif + DeleteLock((void *)this); +} +#endif + + #endif /* DEBUG_LOCKORDER */ diff --git a/src/sync.h b/src/sync.h index 12fa4e02..17d935c6 100644 --- a/src/sync.h +++ b/src/sync.h @@ -7,6 +7,7 @@ #ifndef BITCOIN_SYNC_H #define BITCOIN_SYNC_H +#include "recursive_shared_mutex.h" #include "threadsafety.h" #include "util/util.h" #include "util/utiltime.h" @@ -109,6 +110,36 @@ class CCriticalSection : public AnnotatedMixin #define CRITSEC(zzname) CCriticalSection zzname(#zzname) #endif +#ifndef DEBUG_LOCKORDER +typedef recursive_shared_mutex CRecursiveSharedCriticalSection; +/** Define a named, shared critical section that is named in debug builds. + Named critical sections are useful in conjunction with a lock analyzer to discover bottlenecks. */ +#define RSCRITSEC(x) CRecursiveSharedCriticalSection x +#else + +/** A shared critical section allows multiple entities to recursively take the critical section in a "shared" mode, + but only one entity to recursively take the critical section exclusively. + A RecursiveSharedCriticalSection IS recursive. +*/ +class CRecursiveSharedCriticalSection : public recursive_shared_mutex +{ +public: + const char *name; + CRecursiveSharedCriticalSection(); + CRecursiveSharedCriticalSection(const char *n); + ~CRecursiveSharedCriticalSection(); + // shared lock functions + void lock_shared() SHARED_LOCK_FUNCTION() { recursive_shared_mutex::lock_shared(); } + bool try_lock_shared() SHARED_TRYLOCK_FUNCTION(true) { return recursive_shared_mutex::try_lock_shared(); } + void unlock_shared() UNLOCK_FUNCTION() { recursive_shared_mutex::unlock_shared(); } + // exclusive lock functions + void lock() EXCLUSIVE_LOCK_FUNCTION() { recursive_shared_mutex::lock(); } + bool try_lock() EXCLUSIVE_TRYLOCK_FUNCTION(true) { return recursive_shared_mutex::try_lock(); } + void unlock() UNLOCK_FUNCTION() { recursive_shared_mutex::unlock(); } +}; +#define RSCRITSEC(zzname) CRecursiveSharedCriticalSection zzname(#zzname) +#endif + #ifndef DEBUG_LOCKORDER typedef AnnotatedMixin CSharedCriticalSection; /** Define a named, shared critical section that is named in debug builds. @@ -468,6 +499,16 @@ class SCOPED_LOCKABLE CMutexReadLock operator bool() { return lock.owns_lock(); } }; +typedef CMutexReadLock CRecursiveReadBlock; +typedef CMutexLock CRecursiveWriteBlock; + +#define RECURSIVEREADLOCK(cs) CRecursiveReadBlock UNIQUIFY(readblock)(cs, #cs, __FILE__, __LINE__) +#define RECURSIVEWRITELOCK(cs) CRecursiveWriteBlock UNIQUIFY(writeblock)(cs, #cs, __FILE__, __LINE__) +#define RECURSIVEREADLOCK2(cs1, cs2) \ + CRecursiveReadBlock UNIQUIFY(readblock1)(cs1, #cs1, __FILE__, __LINE__), \ + UNIQUIFY(readblock2)(cs2, #cs2, __FILE__, __LINE__) +#define TRY_READ_LOCK_RECURSIVE(cs, name) CRecursiveReadBlock name(cs, #cs, __FILE__, __LINE__, true) + typedef CMutexReadLock CReadBlock; typedef CMutexLock CWriteBlock; typedef CMutexLock CCriticalBlock; diff --git a/src/sync_rsm.cpp b/src/sync_rsm.cpp deleted file mode 100644 index b59fa7cb..00000000 --- a/src/sync_rsm.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#include "sync.h" -#include "sync_rsm.h" - -#include "util/logger.h" -#include "util/util.h" -#include "util/utilstrencodings.h" - -#include -#include - -#ifdef DEBUG_LOCKORDER -CRecursiveSharedCriticalSection::CRecursiveSharedCriticalSection() : name(NULL), exclusiveOwner(0) {} -CRecursiveSharedCriticalSection::CRecursiveSharedCriticalSection(const char *n) : name(n), exclusiveOwner(0) -{ -// print the address of named critical sections so they can be found in the mutrace output -#ifdef ENABLE_MUTRACE - if (name) - { - LogPrintf("CRecursiveSharedCriticalSection %s at %p\n", name, this); - fflush(stdout); - } -#endif -} - -CRecursiveSharedCriticalSection::~CRecursiveSharedCriticalSection() -{ -#ifdef ENABLE_MUTRACE - if (name) - { - LogPrintf("Destructing CRecursiveSharedCriticalSection %s\n", name); - fflush(stdout); - } -#endif - DeleteLock((void *)this); -} - -void CRecursiveSharedCriticalSection::lock_shared() -{ - uint64_t tid = getTid(); - // detect recursive locking - { - std::unique_lock lock(setlock); - auto alreadyLocked = sharedowners.find(tid); - if (alreadyLocked != sharedowners.end()) - { - LockInfoRecursive li = alreadyLocked->second; - LogPrintf("already locked at %s:%d, incrementing shared lock by 1 to %u\n", li.file, li.line, li.count++); - alreadyLocked->second.count++; - - } - else - { - sharedowners[tid] = LockInfoRecursive("", 0, 1); - } - } - internal_lock.lock_shared(); -} - -void CRecursiveSharedCriticalSection::unlock_shared() -{ - // detect recursive locking - uint64_t tid = getTid(); - { - std::unique_lock lock(setlock); - auto alreadyLocked = sharedowners.find(tid); - if (alreadyLocked == sharedowners.end()) - { - LockInfoRecursive li = alreadyLocked->second; - LogPrintf("never locked at %s:%d\n", li.file, li.line); - assert(alreadyLocked != sharedowners.end()); - } - alreadyLocked->second.count--; - if (alreadyLocked->second.count == 0) - { - sharedowners.erase(tid); - } - } - internal_lock.unlock_shared(); -} - -bool CRecursiveSharedCriticalSection::try_lock_shared() -{ - uint64_t tid = getTid(); - std::unique_lock lock(setlock); - - bool result = internal_lock.try_lock_shared(); - if (result) - { - auto alreadyLocked = sharedowners.find(tid); - if (alreadyLocked == sharedowners.end()) - { - sharedowners[tid] = LockInfoRecursive("", 0, 1); - } - else - { - alreadyLocked->second.count++; - } - } - return result; -} -void CRecursiveSharedCriticalSection::lock() -{ - internal_lock.lock(); - exclusiveOwner = getTid(); - exclusiveOwnerCount++; -} -void CRecursiveSharedCriticalSection::unlock() -{ - uint64_t tid = getTid(); - assert(exclusiveOwner == tid); - exclusiveOwnerCount--; - if (exclusiveOwnerCount == 0) - { - exclusiveOwner = 0; - } - internal_lock.unlock(); -} - -bool CRecursiveSharedCriticalSection::try_lock() -{ - bool result = internal_lock.try_lock(); - if (result) - { - exclusiveOwner = getTid(); - exclusiveOwnerCount++; - } - return result; -} -#endif diff --git a/src/sync_rsm.h b/src/sync_rsm.h deleted file mode 100644 index 08901fa0..00000000 --- a/src/sync_rsm.h +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2015 The Bitcoin Core developers -// Copyright (c) 2015-2018 The Bitcoin Unlimited developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef SYNC_RSM_H -#define SYNC_RSM_H - -#include "recursive_shared_mutex.h" -#include "sync.h" -#include "threadsafety.h" -#include "util/util.h" -#include "util/utiltime.h" - -#include - -#ifndef DEBUG_LOCKORDER -typedef recursive_shared_mutex CRecursiveSharedCriticalSection; -/** Define a named, shared critical section that is named in debug builds. - Named critical sections are useful in conjunction with a lock analyzer to discover bottlenecks. */ -#define RSCRITSEC(x) CRecursiveSharedCriticalSection x -#else - -class CRecursiveSharedCriticalSection -{ -public: - class LockInfoRecursive - { - public: - const char *file; - unsigned int line; - uint32_t count; - LockInfoRecursive() : file(""), line(0), count(0) {} - LockInfoRecursive(const char *f, unsigned int l, uint32_t c) : file(f), line(l), count(c){} - }; - - recursive_shared_mutex internal_lock; - std::mutex setlock; - std::map sharedowners; - const char *name; - uint64_t exclusiveOwner; - uint64_t exclusiveOwnerCount; - CRecursiveSharedCriticalSection(const char *name); - CRecursiveSharedCriticalSection(); - ~CRecursiveSharedCriticalSection(); - void lock_shared(); - bool try_lock_shared(); - void unlock_shared(); - void lock(); - void unlock(); - bool try_lock(); -}; -#define RSCRITSEC(zzname) CRecursiveSharedCriticalSection zzname(#zzname) -#endif - -typedef CMutexReadLock CRecursiveReadBlock; -typedef CMutexLock CRecursiveWriteBlock; - -#define READLOCK_RECURSIVE(cs) CRecursiveReadBlock UNIQUIFY(readblock)(cs, #cs, __FILE__, __LINE__) -#define WRITELOCK_RECURSIVE(cs) CRecursiveWriteBlock UNIQUIFY(writeblock)(cs, #cs, __FILE__, __LINE__) -#define READLOCK2_RECURSIVE(cs1, cs2) \ - CRecursiveReadBlock UNIQUIFY(readblock1)(cs1, #cs1, __FILE__, __LINE__), UNIQUIFY(readblock2)(cs2, #cs2, __FILE__, __LINE__) -#define TRY_READ_LOCK_RECURSIVE(cs, name) CRecursiveReadBlock name(cs, #cs, __FILE__, __LINE__, true) - - -#endif // SYNC_RSM_H diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp index 9996e7eb..2f42f5e7 100644 --- a/src/test/test_bitcoin.cpp +++ b/src/test/test_bitcoin.cpp @@ -56,9 +56,9 @@ TestingSetup::TestingSetup(const std::string &chainName) : BasicTestingSetup(cha ClearDatadirCache(); pathTemp = GetTempPathTest() / strprintf("test_bitcoin_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000))); fs::create_directories(pathTemp); - pnetMan->getChainActive()->pblocktree.reset(new CBlockTreeDB(1 << 20, true)); + pblocktree.reset(new CBlockTreeDB(1 << 20, true)); pcoinsdbview = new CCoinsViewDB(1 << 23, true); - pnetMan->getChainActive()->pcoinsTip.reset(new CCoinsViewCache(pcoinsdbview)); + pcoinsTip.reset(new CCoinsViewCache(pcoinsdbview)); bool worked = pnetMan->getChainActive()->InitBlockIndex(chainparams); assert(worked); RegisterNodeSignals(GetNodeSignals()); @@ -70,9 +70,9 @@ TestingSetup::~TestingSetup() threadGroup.interrupt_all(); threadGroup.join_all(); pnetMan->getChainActive()->UnloadBlockIndex(); - pnetMan->getChainActive()->pcoinsTip.reset(); + pcoinsTip.reset(); pcoinsdbview = nullptr; - pnetMan->getChainActive()->pblocktree.reset(); + pblocktree.reset(); g_connman.reset(); fs::remove_all(pathTemp); } diff --git a/src/undo.h b/src/undo.h index 27381b3f..848790d7 100644 --- a/src/undo.h +++ b/src/undo.h @@ -22,6 +22,7 @@ #define BITCOIN_UNDO_H #include "chain/tx.h" +#include "coins.h" #include "compressor.h" #include "serialize.h" diff --git a/src/verifydb.cpp b/src/verifydb.cpp index 8d63f145..c1d1114b 100644 --- a/src/verifydb.cpp +++ b/src/verifydb.cpp @@ -31,9 +31,8 @@ CVerifyDB::CVerifyDB() {} CVerifyDB::~CVerifyDB() {} bool CVerifyDB::VerifyDB(const CNetworkTemplate &chainparams, CCoinsView *coinsview, int nCheckLevel, int nCheckDepth) { - LOCK(cs_main); - if (pnetMan->getChainActive()->chainActive.Tip() == NULL || - pnetMan->getChainActive()->chainActive.Tip()->pprev == NULL) + if (pnetMan->getChainActive()->chainActive.Tip() == nullptr || + pnetMan->getChainActive()->chainActive.Tip()->pprev == nullptr) return true; // Verify blocks in the best chain @@ -45,9 +44,10 @@ bool CVerifyDB::VerifyDB(const CNetworkTemplate &chainparams, CCoinsView *coinsv LogPrintf("Verifying last %i blocks at level %i\n", nCheckDepth, nCheckLevel); CCoinsViewCache coins(coinsview); CBlockIndex *pindexState = pnetMan->getChainActive()->chainActive.Tip(); - CBlockIndex *pindexFailure = NULL; + CBlockIndex *pindexFailure = nullptr; int nGoodTransactions = 0; CValidationState state; + LOCK(cs_main); for (CBlockIndex *pindex = pnetMan->getChainActive()->chainActive.Tip(); pindex && pindex->pprev; pindex = pindex->pprev) { @@ -84,8 +84,7 @@ bool CVerifyDB::VerifyDB(const CNetworkTemplate &chainparams, CCoinsView *coinsv } // check level 3: check for inconsistencies during memory-only disconnect of tip blocks if (nCheckLevel >= 3 && pindex == pindexState && - (coins.DynamicMemoryUsage() + pnetMan->getChainActive()->pcoinsTip->DynamicMemoryUsage()) <= - nCoinCacheUsage) + (coins.DynamicMemoryUsage() + pcoinsTip->DynamicMemoryUsage()) <= nCoinCacheUsage) { DisconnectResult res = DisconnectBlock(block, pindex, coins); if (res == DISCONNECT_FAILED) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 9f1fa6a3..da9a701c 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -686,7 +686,7 @@ bool CWallet::AddToWallet(const CWalletTx &wtxIn, bool fFromLoadWallet, CWalletD wtx.nTimeSmart = wtx.nTimeReceived; if (!wtxIn.hashUnset()) { - READLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); + RECURSIVEREADLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); if (pnetMan->getChainActive()->mapBlockIndex.count(wtxIn.hashBlock)) { int64_t latestNow = wtx.nTimeReceived; @@ -835,7 +835,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransactionRef &ptx, const CBlock bool CWallet::AbandonTransaction(const uint256 &hashTx) { - LOCK2(cs_main, cs_wallet); + LOCK(cs_wallet); // Do not flush the wallet here for performance reasons CWalletDB walletdb(strWalletFile, "r+", false); @@ -897,12 +897,12 @@ bool CWallet::AbandonTransaction(const uint256 &hashTx) void CWallet::MarkConflicted(const uint256 &hashBlock, const uint256 &hashTx) { - LOCK2(cs_main, cs_wallet); - + LOCK(cs_wallet); int conflictconfirms = 0; CBlockIndex *pindex = pnetMan->getChainActive()->LookupBlockIndex(hashBlock); if (pindex) { + RECURSIVEREADLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); if (pnetMan->getChainActive()->chainActive.Contains(pindex)) { conflictconfirms = -(pnetMan->getChainActive()->chainActive.Height() - pindex->nHeight + 1); @@ -962,7 +962,7 @@ void CWallet::MarkConflicted(const uint256 &hashBlock, const uint256 &hashTx) void CWallet::SyncTransaction(const CTransactionRef &ptx, const CBlock *pblock, int txIdx) { - LOCK2(cs_main, cs_wallet); + LOCK(cs_wallet); if (!AddToWalletIfInvolvingMe(ptx, pblock, true)) { @@ -1246,7 +1246,7 @@ int CWallet::ScanForWalletTransactions(CBlockIndex *pindexStart, bool fUpdate) CBlockIndex *pindex = pindexStart; int nEndHeight = pnetMan->getChainActive()->chainActive.Tip()->nHeight; { - LOCK2(cs_main, cs_wallet); + LOCK(cs_wallet); // no need to read and scan block, if block was created before // our wallet birthday (as adjusted for block time variability) @@ -1292,7 +1292,7 @@ void CWallet::ReacceptWalletTransactions() std::map mapSorted; { - LOCK2(cs_main, cs_wallet); + LOCK(cs_wallet); // Sort pending wallet transactions based on their initial wallet insertion order for (auto const &item : mapWallet) { @@ -1635,7 +1635,7 @@ CAmount CWallet::GetBalance() const { CAmount nTotal = 0; { - LOCK2(cs_main, cs_wallet); + LOCK(cs_wallet); for (std::map::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx *pcoin = &(*it).second; @@ -1651,7 +1651,7 @@ CAmount CWallet::GetUnconfirmedBalance() const { CAmount nTotal = 0; { - LOCK2(cs_main, cs_wallet); + LOCK(cs_wallet); for (std::map::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx *pcoin = &(*it).second; @@ -1666,7 +1666,7 @@ CAmount CWallet::GetImmatureBalance() const { CAmount nTotal = 0; { - LOCK2(cs_main, cs_wallet); + LOCK(cs_wallet); for (std::map::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx *pcoin = &(*it).second; @@ -1680,7 +1680,7 @@ CAmount CWallet::GetWatchOnlyBalance() const { CAmount nTotal = 0; { - LOCK2(cs_main, cs_wallet); + LOCK(cs_wallet); for (std::map::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx *pcoin = &(*it).second; @@ -1696,7 +1696,7 @@ CAmount CWallet::GetUnconfirmedWatchOnlyBalance() const { CAmount nTotal = 0; { - LOCK2(cs_main, cs_wallet); + LOCK(cs_wallet); for (std::map::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx *pcoin = &(*it).second; @@ -1711,7 +1711,7 @@ CAmount CWallet::GetImmatureWatchOnlyBalance() const { CAmount nTotal = 0; { - LOCK2(cs_main, cs_wallet); + LOCK(cs_wallet); for (std::map::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const CWalletTx *pcoin = &(*it).second; @@ -1729,7 +1729,7 @@ void CWallet::AvailableCoins(std::vector &vCoins, vCoins.clear(); { - LOCK2(cs_main, cs_wallet); + LOCK(cs_wallet); for (std::map::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) { const uint256 &wtxid = it->first; @@ -2893,7 +2893,7 @@ void CWallet::GetAllReserveKeys(std::set &setAddress) const CWalletDB walletdb(strWalletFile); - LOCK2(cs_main, cs_wallet); + LOCK(cs_wallet); for (auto const &id : setKeyPool) { CKeyPool keypool; @@ -3072,8 +3072,6 @@ CWalletKey::CWalletKey(int64_t nExpires) int CMerkleTx::SetMerkleBranch(const CBlock &block) { - AssertLockHeld(cs_main); - // Update the tx's hashBlock hashBlock = block.GetHash(); @@ -3093,6 +3091,7 @@ int CMerkleTx::SetMerkleBranch(const CBlock &block) } // Is the tx in a block that's in the main chain + RECURSIVEREADLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); const CBlockIndex *pindex = pnetMan->getChainActive()->LookupBlockIndex(hashBlock); if (!pindex || !pnetMan->getChainActive()->chainActive.Contains(pindex)) { @@ -3107,13 +3106,14 @@ int CMerkleTx::GetDepthInMainChain(const CBlockIndex *&pindexRet) const { return 0; } - AssertLockHeld(cs_main); // Find the block it claims to be in CBlockIndex *pindex = pnetMan->getChainActive()->LookupBlockIndex(hashBlock); - LOCK(cs_main); // for chainActive - if (!pindex || !pnetMan->getChainActive()->chainActive.Contains(pindex)) { - return 0; + RECURSIVEREADLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); + if (!pindex || !pnetMan->getChainActive()->chainActive.Contains(pindex)) + { + return 0; + } } pindexRet = pindex; return ((nIndex == -1) ? (-1) : 1) * (pnetMan->getChainActive()->chainActive.Height() - pindex->nHeight + 1); @@ -3308,7 +3308,7 @@ bool CWallet::CreateCoinStake(const CKeyStore &keystore, CDiskTxPos txindex; { LOCK2(cs_main, cs_wallet); - if (!pnetMan->getChainActive()->pblocktree->ReadTxIndex(pcoin.first->tx->GetHash(), txindex)) + if (!pblocktree->ReadTxIndex(pcoin.first->tx->GetHash(), txindex)) continue; } From e6c00ef33f31681ec87ddcd3ee5a6a2f1ff457c9 Mon Sep 17 00:00:00 2001 From: Griffith <8345264+Greg-Griffith@users.noreply.github.com> Date: Fri, 28 Jun 2019 03:56:01 +0900 Subject: [PATCH 2/8] Cleanup sync logic (#219) * remove sendheaders version define, all nodes must support headers now * allow block downloads from inbound connections * small cleanup of message logic * remove unused network messages * make npreffereddownlaod atomic, increase candirectfetch spacing --- src/main.cpp | 4 +- src/main.h | 4 +- src/net/messages.cpp | 129 +++++++++---------------------------------- src/net/net.cpp | 1 - src/net/net.h | 1 - src/net/protocol.cpp | 10 ++-- src/net/protocol.h | 13 ----- src/processblock.cpp | 2 +- src/version.h | 8 +-- 9 files changed, 36 insertions(+), 136 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index a4e5037b..08cc3806 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -68,7 +68,7 @@ #include -int64_t nTimeBestReceived = 0; +std::atomic nTimeBestReceived(0); CWaitableCriticalSection csBestBlock; @@ -134,7 +134,7 @@ uint32_t nBlockSequenceId = 1; */ /** Number of preferable block download peers. */ -int nPreferredDownload = 0; +std::atomic nPreferredDownload{0}; /** Dirty block index entries. */ std::set setDirtyBlockIndex; diff --git a/src/main.h b/src/main.h index ef3a7335..4616ee74 100644 --- a/src/main.h +++ b/src/main.h @@ -263,8 +263,8 @@ enum FlushStateMode FLUSH_STATE_ALWAYS }; bool FlushStateToDisk(CValidationState &state, FlushStateMode mode); -extern int nPreferredDownload; -extern int64_t nTimeBestReceived; +extern std::atomic nPreferredDownload; +extern std::atomic nTimeBestReceived; extern int nPeersWithValidatedDownloads; /** Flush all state, indexes and buffers to disk. */ diff --git a/src/net/messages.cpp b/src/net/messages.cpp index 9d179b56..ec80c373 100644 --- a/src/net/messages.cpp +++ b/src/net/messages.cpp @@ -176,7 +176,7 @@ void FinalizeNode(NodeId nodeid, bool &fUpdateConnectionTime) EraseOrphansFor(nodeid); } LOCK(cs_main); - nPreferredDownload -= state->fPreferredDownload; + nPreferredDownload.fetch_sub(state->fPreferredDownload); nPeersWithValidatedDownloads -= (state->nBlocksInFlightValidHeaders != 0); assert(nPeersWithValidatedDownloads >= 0); @@ -186,7 +186,7 @@ void FinalizeNode(NodeId nodeid, bool &fUpdateConnectionTime) { // Do a consistency check after the last peer is removed. assert(mapBlocksInFlight.empty()); - assert(nPreferredDownload == 0); + assert(nPreferredDownload.load() == 0); assert(nPeersWithValidatedDownloads == 0); } } @@ -297,14 +297,14 @@ const CBlockIndex *LastCommonAncestor(const CBlockIndex *pa, const CBlockIndex * return pa; } -bool CanDirectFetch(const Consensus::Params &consensusParams) EXCLUSIVE_LOCKS_REQUIRED(cs_main) +bool CanDirectFetch(const Consensus::Params &consensusParams) { int64_t targetSpacing = consensusParams.nTargetSpacing; if (pnetMan->getChainActive()->chainActive.Tip()->GetMedianTimePast() > SERVICE_UPGRADE_HARDFORK) { targetSpacing = 150; } - return pnetMan->getChainActive()->chainActive.Tip()->GetBlockTime() > GetAdjustedTime() - targetSpacing * 20; + return pnetMan->getChainActive()->chainActive.Tip()->GetBlockTime() > GetAdjustedTime() - (targetSpacing * 80); } void RelayTransaction(const CTransaction &tx, CConnman &connman) @@ -500,12 +500,15 @@ void ProcessBlockAvailability(NodeId nodeid) void UpdatePreferredDownload(CNode *node) { CNodeStateAccessor state(nodestateman, node->GetId()); - nPreferredDownload -= state->fPreferredDownload; + nPreferredDownload.fetch_sub(state->fPreferredDownload); // Whether this node should be marked as a preferred download node. - state->fPreferredDownload = (!node->fInbound || node->fWhitelisted) && !node->fOneShot && !node->fClient; + // we allow downloads from inbound nodes; this may have been limited in the past to stop attackers from connecting + // and offering a bad chain. However, we are connecting to multiple nodes and so can choose the most work + // chain on that basis. + state->fPreferredDownload = !node->fOneShot && !node->fClient; - nPreferredDownload += state->fPreferredDownload; + nPreferredDownload.fetch_add(state->fPreferredDownload); } /** Update pindexLastCommonBlock and add not-in-flight missing successors to vBlocks, until it has @@ -840,8 +843,8 @@ void static ProcessGetData(CNode *pfrom, CConnman &connman, const Consensus::Par LOCK(cs_blockstorage); if (!ReadBlockFromDisk(block, pindex, consensusParams)) { - LogPrintf("cannot load block from disk"); - assert(false); + LogPrint("net", "cannot load block from disk, no response"); + return; } } if (inv.type == MSG_BLOCK) @@ -886,7 +889,7 @@ void static ProcessGetData(CNode *pfrom, CConnman &connman, const Consensus::Par // Trigger the peer node to send a getblocks request for the // next batch of inventory. - if (inv.hash == pfrom->hashContinue) + if (inv.hash == uint256()) { // Bypass PushInventory, this must send even if // redundant, and we want it right after the last block @@ -894,7 +897,6 @@ void static ProcessGetData(CNode *pfrom, CConnman &connman, const Consensus::Par std::vector vInv; vInv.push_back(CInv(MSG_BLOCK, pnetMan->getChainActive()->chainActive.Tip()->GetBlockHash())); connman.PushMessage(pfrom, NetMsgType::INV, vInv); - pfrom->hashContinue.SetNull(); } } } @@ -1171,15 +1173,11 @@ bool static ProcessMessage(CNode *pfrom, CNodeStateAccessor state(nodestateman, pfrom->GetId()); state->fCurrentlyConnected = true; } - - if (pfrom->nVersion >= SENDHEADERS_VERSION) - { - // Tell our peer we prefer to receive headers rather than inv's - // We send this to non-NODE NETWORK peers as well, because even - // non-NODE NETWORK peers can announce blocks (such as pruning - // nodes) - connman.PushMessage(pfrom, NetMsgType::SENDHEADERS); - } + // Tell our peer we prefer to receive headers rather than inv's + // We send this to non-NODE NETWORK peers as well, because even + // non-NODE NETWORK peers can announce blocks (such as pruning + // nodes) + connman.PushMessage(pfrom, NetMsgType::SENDHEADERS); pfrom->fSuccessfullyConnected = true; } @@ -1373,47 +1371,6 @@ bool static ProcessMessage(CNode *pfrom, ProcessGetData(pfrom, connman, chainparams.GetConsensus()); } - - else if (strCommand == NetMsgType::GETBLOCKS) - { - CBlockLocator locator; - uint256 hashStop; - vRecv >> locator >> hashStop; - - LOCK(cs_main); - - // Find the last block the caller has in the main chain - const CBlockIndex *pindex = - pnetMan->getChainActive()->FindForkInGlobalIndex(pnetMan->getChainActive()->chainActive, locator); - - // Send the rest of the chain - if (pindex) - { - pindex = pnetMan->getChainActive()->chainActive.Next(pindex); - } - int nLimit = 500; - LogPrintf("getblocks %d to %s limit %d from peer=%d\n", (pindex ? pindex->nHeight : -1), - hashStop.IsNull() ? "end" : hashStop.ToString(), nLimit, pfrom->id); - for (; pindex; pindex = pnetMan->getChainActive()->chainActive.Next(pindex)) - { - if (pindex->GetBlockHash() == hashStop) - { - LogPrintf(" getblocks stopping at %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString()); - break; - } - pfrom->PushInventory(CInv(MSG_BLOCK, pindex->GetBlockHash())); - if (--nLimit <= 0) - { - // When this block is requested, we'll send an inv that'll - // trigger the peer to getblocks the next batch of inventory. - LogPrint( - "net", " getblocks stopping at limit %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString()); - pfrom->hashContinue = pindex->GetBlockHash(); - break; - } - } - } - else if (strCommand == NetMsgType::GETHEADERS) { CBlockLocator locator; @@ -1424,7 +1381,7 @@ bool static ProcessMessage(CNode *pfrom, if (pnetMan->getChainActive()->IsInitialBlockDownload() && !pfrom->fWhitelisted) { - LogPrintf("Ignoring getheaders from peer=%d because node is in initial block download\n", pfrom->id); + LogPrintf("Ignoring getheaders from peer=%d because our node is in initial block download\n", pfrom->id); return true; } @@ -1736,17 +1693,17 @@ bool static ProcessMessage(CNode *pfrom, { if (_pindex->nStatus & BLOCK_FAILED_MASK) { - return error("invalid header received"); + return error("duplicate headers received"); } return true; } } - CBlockIndex *pindexLast = NULL; + CBlockIndex *pindexLast = nullptr; for (const CBlockHeader &header : headers) { CValidationState state; - if (pindexLast != NULL && header.hashPrevBlock != pindexLast->GetBlockHash()) + if (pindexLast != nullptr && header.hashPrevBlock != pindexLast->GetBlockHash()) { Misbehaving(pfrom->GetId(), 20, "disconnected-header"); return error("non-continuous headers sequence"); @@ -1788,7 +1745,7 @@ bool static ProcessMessage(CNode *pfrom, CNodeStateAccessor nodestate(nodestateman, pfrom->GetId()); // If this set of headers is valid and ends in a block with at least as // much work as our tip, download as much as possible. - if (fCanDirectFetch && pindexLast->IsValid(BLOCK_VALID_TREE) && + if (fCanDirectFetch && pindexLast && pindexLast->IsValid(BLOCK_VALID_TREE) && pnetMan->getChainActive()->chainActive.Tip()->nChainWork <= pindexLast->nChainWork) { std::vector vToFetch; @@ -1829,13 +1786,10 @@ bool static ProcessMessage(CNode *pfrom, LogPrint( "net", "Requesting block %s from peer=%d\n", pindex->GetBlockHash().ToString(), pfrom->id); } - if (vGetData.size() > 1) + if (vGetData.size() > 0) { LogPrint("net", "Downloading blocks toward %s (%d) via headers direct fetch\n", pindexLast->GetBlockHash().ToString(), pindexLast->nHeight); - } - if (vGetData.size() > 0) - { connman.PushMessage(pfrom, NetMsgType::GETDATA, vGetData); } } @@ -1919,37 +1873,6 @@ bool static ProcessMessage(CNode *pfrom, } - else if (strCommand == NetMsgType::MEMPOOL) - { - std::vector vtxid; - mempool.queryHashes(vtxid); - std::vector vInv; - BOOST_FOREACH (uint256 &hash, vtxid) - { - CInv inv(MSG_TX, hash); - if (pfrom->pfilter) - { - CTxMemPoolEntry txe; - bool fInMemPool = mempool.lookup(hash, txe); - if (!fInMemPool) - continue; // another thread removed since queryHashes, maybe... - if (!pfrom->pfilter->IsRelevantAndUpdate(txe.GetTx())) - continue; - } - vInv.push_back(inv); - if (vInv.size() == MAX_INV_SZ) - { - connman.PushMessage(pfrom, NetMsgType::INV, vInv); - vInv.clear(); - } - } - if (vInv.size() > 0) - { - connman.PushMessage(pfrom, NetMsgType::INV, vInv); - } - } - - else if (strCommand == NetMsgType::PING) { { @@ -2375,7 +2298,7 @@ bool SendMessages(CNode *pto, CConnman &connman) // Download if this is a nice peer, or we have no nice peers and this one // might do. - bool fFetch = nodestate->fPreferredDownload || (nPreferredDownload == 0 && !pto->fClient && !pto->fOneShot); + bool fFetch = nodestate->fPreferredDownload || (nPreferredDownload.load() == 0 && !pto->fOneShot); if (!nodestate->fSyncStarted && !pto->fClient && !fImporting && !fReindex) { @@ -2408,7 +2331,7 @@ bool SendMessages(CNode *pto, CConnman &connman) // become unconfirmed and spams other nodes. if (!fReindex && !fImporting && !pnetMan->getChainActive()->IsInitialBlockDownload()) { - GetMainSignals().Broadcast(nTimeBestReceived, &connman); + GetMainSignals().Broadcast(nTimeBestReceived.load(), &connman); } // diff --git a/src/net/net.cpp b/src/net/net.cpp index 6ab67349..fed44a3d 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -2912,7 +2912,6 @@ CNode::CNode(NodeId idIn, nRefCount = 0; nSendSize = 0; nSendOffset = 0; - hashContinue = uint256(); nStartingHeight = -1; filterInventoryKnown.reset(); fSendMempool = false; diff --git a/src/net/net.h b/src/net/net.h index f8786c6d..d8271364 100644 --- a/src/net/net.h +++ b/src/net/net.h @@ -266,7 +266,6 @@ class CNode mapMsgCmdSize mapRecvBytesPerMsgCmd; public: - uint256 hashContinue; std::atomic nStartingHeight; // flood relay diff --git a/src/net/protocol.cpp b/src/net/protocol.cpp index 692011ef..5452d649 100644 --- a/src/net/protocol.cpp +++ b/src/net/protocol.cpp @@ -36,13 +36,11 @@ const char *ADDR = "addr"; const char *INV = "inv"; const char *GETDATA = "getdata"; const char *MERKLEBLOCK = "merkleblock"; -const char *GETBLOCKS = "getblocks"; const char *GETHEADERS = "getheaders"; const char *TX = "tx"; const char *HEADERS = "headers"; const char *BLOCK = "block"; const char *GETADDR = "getaddr"; -const char *MEMPOOL = "mempool"; const char *PING = "ping"; const char *PONG = "pong"; const char *ALERT = "alert"; @@ -64,10 +62,10 @@ static const char *ppszTypeName[] = { * messages above and in protocol.h. */ const static std::string allNetMessageTypes[] = {NetMsgType::VERSION, NetMsgType::VERACK, NetMsgType::ADDR, - NetMsgType::INV, NetMsgType::GETDATA, NetMsgType::MERKLEBLOCK, NetMsgType::GETBLOCKS, NetMsgType::GETHEADERS, - NetMsgType::TX, NetMsgType::HEADERS, NetMsgType::BLOCK, NetMsgType::GETADDR, NetMsgType::MEMPOOL, NetMsgType::PING, - NetMsgType::PONG, NetMsgType::ALERT, NetMsgType::NOTFOUND, NetMsgType::FILTERLOAD, NetMsgType::FILTERADD, - NetMsgType::FILTERCLEAR, NetMsgType::REJECT, NetMsgType::SENDHEADERS}; + NetMsgType::INV, NetMsgType::GETDATA, NetMsgType::MERKLEBLOCK, NetMsgType::GETHEADERS, NetMsgType::TX, + NetMsgType::HEADERS, NetMsgType::BLOCK, NetMsgType::GETADDR, NetMsgType::PING, NetMsgType::PONG, NetMsgType::ALERT, + NetMsgType::NOTFOUND, NetMsgType::FILTERLOAD, NetMsgType::FILTERADD, NetMsgType::FILTERCLEAR, NetMsgType::REJECT, + NetMsgType::SENDHEADERS}; const static std::vector allNetMessageTypesVec(allNetMessageTypes, allNetMessageTypes + ARRAYLEN(allNetMessageTypes)); diff --git a/src/net/protocol.h b/src/net/protocol.h index 6ea60e8c..293d3789 100644 --- a/src/net/protocol.h +++ b/src/net/protocol.h @@ -123,12 +123,6 @@ extern const char *GETDATA; * @see https://bitcoin.org/en/developer-reference#merkleblock */ extern const char *MERKLEBLOCK; -/** - * The getblocks message requests an inv message that provides block header - * hashes starting from a particular point in the block chain. - * @see https://bitcoin.org/en/developer-reference#getblocks - */ -extern const char *GETBLOCKS; /** * The getheaders message requests a headers message that provides block * headers starting from a particular point in the block chain. @@ -159,13 +153,6 @@ extern const char *BLOCK; * @see https://bitcoin.org/en/developer-reference#getaddr */ extern const char *GETADDR; -/** - * The mempool message requests the TXIDs of transactions that the receiving - * node has verified as valid but which have not yet appeared in a block. - * @since protocol version 60002. - * @see https://bitcoin.org/en/developer-reference#mempool - */ -extern const char *MEMPOOL; /** * The ping message is sent periodically to help confirm that the receiving * peer is still connected. diff --git a/src/processblock.cpp b/src/processblock.cpp index 1f9a1775..d8d68ee2 100644 --- a/src/processblock.cpp +++ b/src/processblock.cpp @@ -198,7 +198,7 @@ void UpdateTip(CBlockIndex *pindexNew) pnetMan->getChainActive()->chainActive.SetTip(pindexNew); // New best block - nTimeBestReceived = GetTime(); + nTimeBestReceived.store(GetTime()); mempool.AddTransactionsUpdated(1); LogPrintf("%s: new best=%s height=%d log2_work=%.8g tx=%lu date=%s cache=%.1fMiB(%utx)\n", __func__, diff --git a/src/version.h b/src/version.h index 03e95b28..94c36676 100644 --- a/src/version.h +++ b/src/version.h @@ -26,17 +26,11 @@ */ -static const int PROTOCOL_VERSION = 60039; +static const int PROTOCOL_VERSION = 60040; // earlier versions not supported as of Feb 2012, and are disconnected static const int MIN_PROTO_VERSION = 60037; -// "sendheaders" command and announcing blocks with headers starts with this version -static const int SENDHEADERS_VERSION = 60035; - -//! In this version, 'getheaders' was introduced. -static const int GETHEADERS_VERSION = 60035; - //! "filter*" commands are disabled without NODE_BLOOM after and including this version static const int NO_BLOOM_VERSION = 60034; From f1f39d93f2bd3321c5a2b1450fec0e8b126f4f34 Mon Sep 17 00:00:00 2001 From: Griffith <8345264+Greg-Griffith@users.noreply.github.com> Date: Fri, 28 Jun 2019 06:50:45 +0900 Subject: [PATCH 3/8] remove assert in getwarnings (#220) --- src/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 08cc3806..6b32fe30 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1669,7 +1669,6 @@ std::string GetWarnings(const std::string &strFor) return strStatusBar; else if (strFor == "rpc") return strRPC; - assert(!"GetWarnings(): invalid parameter"); return "error"; } From 21393be54c99a9e4c62d516e67768f811179600d Mon Sep 17 00:00:00 2001 From: Griffith <8345264+Greg-Griffith@users.noreply.github.com> Date: Fri, 5 Jul 2019 15:30:46 +0900 Subject: [PATCH 4/8] Refactor locking part2 (#231) * make thread_group call join_all instead of detaching when destructing * make pindexBestHeader atomic and no longer require cs_mapBlockIndex * require SendRejectsAndCheckIfBanned to have cs_main * dont trylock cs_main in sendmessages, call LOCK only when needed instead * add a safety interrupt inside shutdown * ensure we lock mutex in LogPrintStr * add a writelock assertion for a recursive shared mutex * add cs_blockstorage lock assertions for disk accesses * add rsm write lock assertion in AcceptBlockHeader * define DEBUG_LOCKCONTENTION when --enable-debug is part of configure * add missing ifdef around CMutexReadLock time lockedTime data member * refactor some block and header processing functions * add missing cs_blockstorage lock around writeblocktodisk * add missing cs_mapblockindex rsm write locks when processing a new block * move cs_main lock lower in headers message, add cs_mapblockindex lock * add missing cs_blockstorage lock in initblockindex * add missing cs_blockstorage lock when writting undoblock in connectblock * remove CBlockReject, remove cs_main requiremeny from SendRejects func * lock cs_main for all of FinalizeNode * temporarily remove cs_mablockindex writelock assert in acceptblockheader * add missing cs_blockstorage lock when reading undo from disk in verifydb * add missing cs_blockstorage lock in disconnectblock * remove cs_main locks that are no longer needed * require cs_main for mapBlocksInFlight, add missing cs_main lock * cs_mapblockindex is required to check if chainactive contains an index * remove unneeded cs_main when getting mempool info * separate cs_mapBlockIndex and cs_vNodes locks in miner/minter threads * minor sync files cleanup * update some boost locks to std locks --- configure.ac | 2 +- src/blockgeneration/miner.cpp | 9 +- src/blockgeneration/minter.cpp | 9 +- src/blockstorage/blockstorage.cpp | 5 + src/chain/chainman.cpp | 13 +- src/chain/chainman.h | 6 +- src/httpserver.cpp | 14 +- src/init.cpp | 4 +- src/main.cpp | 126 --------- src/net/messages.cpp | 66 ++--- src/net/messages.h | 8 - src/net/nodestate.h | 3 - src/processblock.cpp | 417 ++++++++++++++++++++---------- src/processblock.h | 49 ++-- src/processheader.cpp | 3 +- src/processheader.h | 2 +- src/rpc/rpcblockchain.cpp | 33 +-- src/rpc/rpcmining.cpp | 21 +- src/rpc/rpcmisc.cpp | 2 +- src/sync.cpp | 24 +- src/sync.h | 39 ++- src/threadgroup.h | 6 +- src/util/logger.cpp | 39 +-- src/util/logger.h | 12 +- src/util/util.cpp | 2 +- src/verifydb.cpp | 1 + 26 files changed, 449 insertions(+), 466 deletions(-) diff --git a/configure.ac b/configure.ac index 3eacc0c5..727340be 100644 --- a/configure.ac +++ b/configure.ac @@ -224,7 +224,7 @@ AC_LANG_PUSH([C++]) AX_CHECK_COMPILE_FLAG([-Werror],[CXXFLAG_WERROR="-Werror"],[CXXFLAG_WERROR=""]) if test "x$enable_debug" = xyes; then - CPPFLAGS="$CPPFLAGS -DDEBUG -DDEBUG_LOCKORDER" + CPPFLAGS="$CPPFLAGS -DDEBUG -DDEBUG_LOCKORDER -DDEBUG_LOCKCONTENTION" if test "x$GCC" = xyes; then CFLAGS="$CFLAGS -g3 -O0" fi diff --git a/src/blockgeneration/miner.cpp b/src/blockgeneration/miner.cpp index 05c9cad3..37761025 100644 --- a/src/blockgeneration/miner.cpp +++ b/src/blockgeneration/miner.cpp @@ -445,8 +445,13 @@ void EccMiner(CWallet *pwallet) if (shutdown_threads.load() || shutdown_miner_threads.load()) return; } - while (g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL) < DEFAULT_MIN_BLOCK_GEN_PEERS || - pnetMan->getChainActive()->IsInitialBlockDownload() || pwallet->IsLocked()) + while (pnetMan->getChainActive()->IsInitialBlockDownload() || pwallet->IsLocked()) + { + MilliSleep(1000); + if (shutdown_threads.load() || shutdown_miner_threads.load()) + return; + } + while (g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL) < DEFAULT_MIN_BLOCK_GEN_PEERS) { MilliSleep(1000); if (shutdown_threads.load() || shutdown_miner_threads.load()) diff --git a/src/blockgeneration/minter.cpp b/src/blockgeneration/minter.cpp index b4504bb2..df7615af 100644 --- a/src/blockgeneration/minter.cpp +++ b/src/blockgeneration/minter.cpp @@ -352,8 +352,13 @@ void EccMinter(CWallet *pwallet) if (shutdown_threads.load() || shutdown_minter_threads.load()) return; } - while (g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL) < DEFAULT_MIN_BLOCK_GEN_PEERS || - pnetMan->getChainActive()->IsInitialBlockDownload() || pwallet->IsLocked()) + while (pnetMan->getChainActive()->IsInitialBlockDownload() || pwallet->IsLocked()) + { + MilliSleep(1000); + if (shutdown_threads.load() || shutdown_minter_threads.load()) + return; + } + while (g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL) < DEFAULT_MIN_BLOCK_GEN_PEERS) { MilliSleep(1000); if (shutdown_threads.load() || shutdown_minter_threads.load()) diff --git a/src/blockstorage/blockstorage.cpp b/src/blockstorage/blockstorage.cpp index 21f9500b..4b595e21 100644 --- a/src/blockstorage/blockstorage.cpp +++ b/src/blockstorage/blockstorage.cpp @@ -41,6 +41,7 @@ FILE *OpenUndoFile(const CDiskBlockPos &pos, bool fReadOnly) { return OpenDiskFi bool WriteBlockToDisk(const CBlock &block, CDiskBlockPos &pos, const CMessageHeader::MessageMagic &messageStart) EXCLUSIVE_LOCKS_REQUIRED(cs_blockstorage) { + AssertLockHeld(cs_blockstorage); // Open history file to append CAutoFile fileout(OpenBlockFile(pos), SER_DISK, CLIENT_VERSION); if (fileout.IsNull()) @@ -63,6 +64,7 @@ bool WriteBlockToDisk(const CBlock &block, CDiskBlockPos &pos, const CMessageHea bool ReadBlockFromDisk(CBlock &block, const CDiskBlockPos &pos, const Consensus::Params &consensusParams) EXCLUSIVE_LOCKS_REQUIRED(cs_blockstorage) { + AssertLockHeld(cs_blockstorage); block.SetNull(); // Open history file to read @@ -92,6 +94,7 @@ bool ReadBlockFromDisk(CBlock &block, const CDiskBlockPos &pos, const Consensus: bool ReadBlockFromDisk(CBlock &block, const CBlockIndex *pindex, const Consensus::Params &consensusParams) EXCLUSIVE_LOCKS_REQUIRED(cs_blockstorage) { + AssertLockHeld(cs_blockstorage); if (!pindex) { return false; @@ -113,6 +116,7 @@ bool UndoWriteToDisk(const CBlockUndo &blockundo, const uint256 &hashBlock, const CMessageHeader::MessageMagic &messageStart) EXCLUSIVE_LOCKS_REQUIRED(cs_blockstorage) { + AssertLockHeld(cs_blockstorage); // Open history file to append CAutoFile fileout(OpenUndoFile(pos), SER_DISK, CLIENT_VERSION); if (fileout.IsNull()) @@ -141,6 +145,7 @@ bool UndoWriteToDisk(const CBlockUndo &blockundo, bool UndoReadFromDisk(CBlockUndo &blockundo, const CDiskBlockPos &pos, const uint256 &hashBlock) EXCLUSIVE_LOCKS_REQUIRED(cs_blockstorage) { + AssertLockHeld(cs_blockstorage); // Open history file to read CAutoFile filein(OpenUndoFile(pos, true), SER_DISK, CLIENT_VERSION); if (filein.IsNull()) diff --git a/src/chain/chainman.cpp b/src/chain/chainman.cpp index 4a20ec3c..3294ec69 100644 --- a/src/chain/chainman.cpp +++ b/src/chain/chainman.cpp @@ -69,7 +69,7 @@ CBlockIndex *CChainManager::AddToBlockIndex(const CBlockHeader &block) } pindexNew->nChainWork = (pindexNew->pprev ? pindexNew->pprev->nChainWork : 0) + GetBlockProof(*pindexNew); pindexNew->RaiseValidity(BLOCK_VALID_TREE); - if (pindexBestHeader == NULL || pindexBestHeader->nChainWork < pindexNew->nChainWork) + if (pindexBestHeader == NULL || pindexBestHeader.load()->nChainWork < pindexNew->nChainWork) pindexBestHeader = pindexNew; setDirtyBlockIndex.insert(pindexNew); @@ -105,8 +105,8 @@ bool CChainManager::IsInitialBlockDownload() static bool lockIBDState = false; if (lockIBDState) return false; - bool state = (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 || - pindexBestHeader->GetBlockTime() < GetTime() - chainParams.MaxTipAge()); + bool state = (chainActive.Height() < pindexBestHeader.load()->nHeight - 24 * 6 || + pindexBestHeader.load()->GetBlockTime() < GetTime() - chainParams.MaxTipAge()); if (!state) lockIBDState = true; return state; @@ -158,8 +158,11 @@ bool CChainManager::InitBlockIndex(const CNetworkTemplate &chainparams) CValidationState state; if (!FindBlockPos(state, blockPos, nBlockSize + 8, 0, block.GetBlockTime())) return error("InitBlockIndex(): FindBlockPos failed"); - if (!WriteBlockToDisk(block, blockPos, chainparams.MessageStart())) - return error("InitBlockIndex(): writing genesis block to disk failed"); + { + LOCK(cs_blockstorage); + if (!WriteBlockToDisk(block, blockPos, chainparams.MessageStart())) + return error("InitBlockIndex(): writing genesis block to disk failed"); + } CBlockIndex *pindex = AddToBlockIndex(block); // ppcoin: compute stake entropy bit for stake modifier diff --git a/src/chain/chainman.h b/src/chain/chainman.h index ce8fe9ba..38c55825 100644 --- a/src/chain/chainman.h +++ b/src/chain/chainman.h @@ -46,7 +46,7 @@ class CChainManager CChain chainActive; /** Best header we've seen so far (used for getheaders queries' starting points). */ - CBlockIndex *pindexBestHeader GUARDED_BY(cs_mapBlockIndex); + std::atomic pindexBestHeader; private: bool LoadBlockIndexDB(); @@ -68,7 +68,7 @@ class CChainManager delete (*it1).second; } mapBlockIndex.clear(); - delete pindexBestHeader; + pindexBestHeader = nullptr; } void operator=(const CChainManager &oldMan) @@ -76,7 +76,7 @@ class CChainManager RECURSIVEWRITELOCK(cs_mapBlockIndex); mapBlockIndex = oldMan.mapBlockIndex; chainActive = oldMan.chainActive; - pindexBestHeader = oldMan.pindexBestHeader; + pindexBestHeader.store(oldMan.pindexBestHeader.load()); } /** Look up the block index entry for a given block hash. returns nullptr if it does not exist */ diff --git a/src/httpserver.cpp b/src/httpserver.cpp index c40935d7..8b013ebd 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -97,12 +97,12 @@ class WorkQueue WorkQueue &wq; ThreadCounter(WorkQueue &w) : wq(w) { - boost::lock_guard lock(wq.cs); + std::lock_guard lock(wq.cs); wq.numThreads += 1; } ~ThreadCounter() { - boost::lock_guard lock(wq.cs); + std::lock_guard lock(wq.cs); wq.numThreads -= 1; wq.cond.notify_all(); } @@ -124,7 +124,7 @@ class WorkQueue /** Enqueue a work item */ bool Enqueue(WorkItem *item) { - boost::unique_lock lock(cs); + std::unique_lock lock(cs); if (queue.size() >= maxDepth) { return false; @@ -141,7 +141,7 @@ class WorkQueue { WorkItem *i = 0; { - boost::unique_lock lock(cs); + std::unique_lock lock(cs); while (running && queue.empty()) cond.wait(lock); if (!running) @@ -156,14 +156,14 @@ class WorkQueue /** Interrupt and exit loops */ void Interrupt() { - boost::unique_lock lock(cs); + std::unique_lock lock(cs); running = false; cond.notify_all(); } /** Wait for worker threads to exit */ void WaitExit() { - boost::unique_lock lock(cs); + std::unique_lock lock(cs); while (numThreads > 0) cond.wait(lock); } @@ -171,7 +171,7 @@ class WorkQueue /** Return current depth of queue */ size_t Depth() { - boost::unique_lock lock(cs); + std::unique_lock lock(cs); return queue.size(); } }; diff --git a/src/init.cpp b/src/init.cpp index da0a0276..39072139 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -197,6 +197,8 @@ void Shutdown(thread_group &threadGroup) { return; } + // we should have already interrupted but there is no harm in doing it again + threadGroup.interrupt_all(); threadGroup.join_all(); /// Note: Shutdown() must be able to handle cases in which AppInit2() failed part of the way, @@ -296,7 +298,7 @@ void Shutdown(thread_group &threadGroup) globalVerifyHandle.reset(); ECC_Stop(); LogPrintf("%s: done\n", __func__); - delete g_logger; + g_logger.reset(); g_logger = nullptr; } diff --git a/src/main.cpp b/src/main.cpp index 6b32fe30..dcdec8a4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1400,132 +1400,6 @@ bool FindBlockPos(CValidationState &state, return true; } - -bool CheckBlock(const CBlock &block, CValidationState &state, bool fCheckPOW, bool fCheckMerkleRoot) -{ - // These are checks that are independent of context. - - if (block.fChecked) - { - return true; - } - - if (block.IsProofOfWork() && fCheckPOW && - !CheckProofOfWork(block.GetHash(), block.nBits, pnetMan->getActivePaymentNetwork()->GetConsensus())) - { - return state.DoS(50, error("CheckBlockHeader(): proof of work failed"), REJECT_INVALID, "high-hash"); - } - - // Check that the header is valid (particularly PoW). This is mostly - // redundant with the call in AcceptBlockHeader. - if (!CheckBlockHeader(block, state, fCheckPOW)) - { - return false; - } - - // Check the merkle root. - if (fCheckMerkleRoot) - { - bool mutated; - uint256 hashMerkleRoot2 = BlockMerkleRoot(block, &mutated); - if (block.hashMerkleRoot != hashMerkleRoot2) - { - return state.DoS( - 100, error("CheckBlock(): hashMerkleRoot mismatch"), REJECT_INVALID, "bad-txnmrklroot", true); - } - - // Check for merkle tree malleability (CVE-2012-2459): repeating sequences - // of transactions in a block without affecting the merkle root of a block, - // while still invalidating it. - if (mutated) - { - return state.DoS( - 100, error("CheckBlock(): duplicate transaction"), REJECT_INVALID, "bad-txns-duplicate", true); - } - } - - // All potential-corruption validation must be done before we do any - // transaction validation, as otherwise we may mark the header as invalid - // because we receive the wrong transactions for it. - - // Size limits - if (block.vtx.empty() || block.vtx.size() > MAX_BLOCK_SIZE || - ::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE) - { - return state.DoS(100, error("CheckBlock(): size limits failed"), REJECT_INVALID, "bad-blk-length"); - } - - // First transaction must be coinbase, the rest must not be - if (block.vtx.empty() || !block.vtx[0]->IsCoinBase()) - { - return state.DoS(100, error("CheckBlock(): first tx is not coinbase"), REJECT_INVALID, "bad-cb-missing"); - } - - for (unsigned int i = 1; i < block.vtx.size(); i++) - { - if (block.vtx[i]->IsCoinBase()) - { - return state.DoS(100, error("CheckBlock(): more than one coinbase"), REJECT_INVALID, "bad-cb-multiple"); - } - } - - // PoS: only the second transaction can be the optional coinstake - for (unsigned int i = 2; i < block.vtx.size(); i++) - { - if (block.vtx[i]->IsCoinStake()) - { - return state.DoS(100, error("CheckBlock() : coinstake in wrong position")); - } - } - - // PoS: coinbase output should be empty if proof-of-stake block - if (block.IsProofOfStake() && (block.vtx[0]->vout.size() != 1 || !block.vtx[0]->vout[0].IsEmpty())) - { - return state.DoS(0, error("CheckBlock() : coinbase output not empty for proof-of-stake block")); - } - - // Check transactions - for (auto const &tx : block.vtx) - { - if (!CheckTransaction(*tx, state)) - { - return state.Invalid(false, state.GetRejectCode(), state.GetRejectReason(), - strprintf("Transaction check failed (txid %s) %s", tx->GetId().ToString(), state.GetDebugMessage())); - } - if (tx->nVersion == 2) - { - } - // PoS: check transaction timestamp - if (block.GetBlockTime() < (int64_t)tx->nTime) - { - return state.DoS(50, error("CheckBlock() : block timestamp earlier than transaction timestamp")); - } - } - - unsigned int nSigOps = 0; - for (auto const &tx : block.vtx) - { - nSigOps += GetLegacySigOpCount(*tx); - } - if (nSigOps > MAX_BLOCK_SIGOPS) - { - return state.DoS(100, error("CheckBlock(): out-of-bounds SigOpCount"), REJECT_INVALID, "bad-blk-sigops"); - } - - // PoS: check block signature - if (!block.CheckBlockSignature()) - { - return state.DoS(100, error("CheckBlock() : bad block signature"), REJECT_INVALID, "bad-block-sig"); - } - - if (fCheckPOW && fCheckMerkleRoot) - { - block.fChecked = true; - } - - return true; -} - bool CheckIndexAgainstCheckpoint(const CBlockIndex *pindexPrev, CValidationState &state, const CNetworkTemplate &chainparams, diff --git a/src/net/messages.cpp b/src/net/messages.cpp index ec80c373..5d0c6dfb 100644 --- a/src/net/messages.cpp +++ b/src/net/messages.cpp @@ -80,7 +80,8 @@ void EraseOrphansFor(NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(cs_orphans); * Memory used: 1.3 MB */ std::unique_ptr recentRejects; -std::map::iterator> > mapBlocksInFlight; +std::map::iterator> > mapBlocksInFlight EXCLUSIVE_LOCKS_REQUIRED( + cs_main); uint256 hashRecentRejectsChainTip; std::map > mapBlockSource; CCriticalSection cs_mapRelay; @@ -137,6 +138,7 @@ void InitializeNode(CNode *pnode, CConnman &connman) void FinalizeNode(NodeId nodeid, bool &fUpdateConnectionTime) { + LOCK(cs_main); fUpdateConnectionTime = false; CNodeStateAccessor state(nodestateman, nodeid); @@ -146,7 +148,6 @@ void FinalizeNode(NodeId nodeid, bool &fUpdateConnectionTime) } { - LOCK(cs_main); for (const QueuedBlock &entry : state->vBlocksInFlight) { mapBlocksInFlight.erase(entry.hash); @@ -175,7 +176,6 @@ void FinalizeNode(NodeId nodeid, bool &fUpdateConnectionTime) LOCK(cs_orphans); EraseOrphansFor(nodeid); } - LOCK(cs_main); nPreferredDownload.fetch_sub(state->fPreferredDownload); nPeersWithValidatedDownloads -= (state->nBlocksInFlightValidHeaders != 0); assert(nPeersWithValidatedDownloads >= 0); @@ -247,8 +247,9 @@ static void Misbehaving(CNode *node, int howmuch, const std::string &reason) } // Returns a bool indicating whether we requested this block. -bool MarkBlockAsReceived(const uint256 &hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main) +bool MarkBlockAsReceived(const uint256 &hash) { + LOCK(cs_main); std::map::iterator> >::iterator itInFlight = mapBlocksInFlight.find(hash); if (itInFlight != mapBlocksInFlight.end()) @@ -453,7 +454,7 @@ unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans) EXCLUSIVE_LOCKS_REQUIRE void MarkBlockAsInFlight(NodeId nodeid, const uint256 &hash, const Consensus::Params &consensusParams, - const CBlockIndex *pindex = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs_main) + const CBlockIndex *pindex = nullptr) { CNodeStateAccessor state(nodestateman, nodeid); assert(state.IsNull() == false); @@ -474,7 +475,10 @@ void MarkBlockAsInFlight(NodeId nodeid, { nPeersWithValidatedDownloads++; } - mapBlocksInFlight[hash] = std::make_pair(nodeid, it); + { + LOCK(cs_main); + mapBlocksInFlight[hash] = std::make_pair(nodeid, it); + } } /** Check whether the last unknown block a peer advertized is not yet known. */ @@ -655,16 +659,7 @@ void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) static bool SendRejectsAndCheckIfBanned(CNode *pnode, CConnman &connman) { - AssertLockHeld(cs_main); CNodeState state = *CNodeStateAccessor(nodestateman, pnode->GetId()); - - for (const CBlockReject &reject : state.rejects) - { - connman.PushMessage(pnode, NetMsgType::REJECT, std::string(NetMsgType::BLOCK), reject.chRejectCode, - reject.strRejectReason, reject.hashBlock); - } - state.rejects.clear(); - if (state.fShouldBan) { state.fShouldBan = false; @@ -790,6 +785,7 @@ void static ProcessGetData(CNode *pfrom, CConnman &connman, const Consensus::Par CBlockIndex *pindex = pnetMan->getChainActive()->LookupBlockIndex(inv.hash); if (pindex) { + RECURSIVEREADLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); if (pnetMan->getChainActive()->chainActive.Contains(pindex)) { send = true; @@ -802,12 +798,13 @@ void static ProcessGetData(CNode *pfrom, CConnman &connman, const Consensus::Par // more than a month older (both in time, and in best // equivalent proof of work) than the best header chain // we know about. - send = pindex->IsValid(BLOCK_VALID_SCRIPTS) && - (pnetMan->getChainActive()->pindexBestHeader != nullptr) && - (pnetMan->getChainActive()->pindexBestHeader->GetBlockTime() - pindex->GetBlockTime() < - nOneMonth) && - (GetBlockProofEquivalentTime(*pnetMan->getChainActive()->pindexBestHeader, *pindex, - *pnetMan->getChainActive()->pindexBestHeader, consensusParams) < nOneMonth); + send = + pindex->IsValid(BLOCK_VALID_SCRIPTS) && + (pnetMan->getChainActive()->pindexBestHeader != nullptr) && + (pnetMan->getChainActive()->pindexBestHeader.load()->GetBlockTime() - pindex->GetBlockTime() < + nOneMonth) && + (GetBlockProofEquivalentTime(*pnetMan->getChainActive()->pindexBestHeader, *pindex, + *pnetMan->getChainActive()->pindexBestHeader, consensusParams) < nOneMonth); if (!send) { LogPrintf("%s: ignoring request from peer=%i for old block that isn't in the main chain\n", @@ -822,7 +819,7 @@ void static ProcessGetData(CNode *pfrom, CConnman &connman, const Consensus::Par static const int nOneWeek = 7 * 24 * 60 * 60; if (send && connman.OutboundTargetReached(true) && (((pnetMan->getChainActive()->pindexBestHeader != nullptr) && - (pnetMan->getChainActive()->pindexBestHeader->GetBlockTime() - pindex->GetBlockTime() > + (pnetMan->getChainActive()->pindexBestHeader.load()->GetBlockTime() - pindex->GetBlockTime() > nOneWeek)) || inv.type == MSG_FILTERED_BLOCK) && !pfrom->fWhitelisted) @@ -1321,7 +1318,7 @@ bool static ProcessMessage(CNode *pfrom, MarkBlockAsInFlight(pfrom->GetId(), inv.hash, chainparams.GetConsensus()); } LogPrint("net", "getheaders (%d) %s to peer=%d\n", - pnetMan->getChainActive()->pindexBestHeader->nHeight, inv.hash.ToString(), pfrom->id); + pnetMan->getChainActive()->pindexBestHeader.load()->nHeight, inv.hash.ToString(), pfrom->id); } } else @@ -1675,15 +1672,11 @@ bool static ProcessMessage(CNode *pfrom, ReadCompactSize(vRecv); // ignore tx count; assume it is 0. ReadCompactSize(vRecv); // ignore empty vchBlockSig } - - LOCK(cs_main); - if (nCount == 0) { // Nothing interesting. Stop asking this peers for more headers. return true; } - // check if these are duplicate headers uint256 hash = headers.front().GetHash(); CBlockIndex *_pindex = pnetMan->getChainActive()->LookupBlockIndex(hash); @@ -1698,7 +1691,8 @@ bool static ProcessMessage(CNode *pfrom, return true; } } - + LOCK(cs_main); + RECURSIVEWRITELOCK(pnetMan->getChainActive()->cs_mapBlockIndex); CBlockIndex *pindexLast = nullptr; for (const CBlockHeader &header : headers) { @@ -2186,8 +2180,6 @@ bool ProcessMessages(CNode *pfrom, CConnman &connman) { LogPrintf("%s(%s, %u bytes) FAILED peer=%d\n", __func__, SanitizeString(strCommand), nMessageSize, pfrom->id); } - - LOCK(cs_main); SendRejectsAndCheckIfBanned(pfrom, connman); return fMoreWork; @@ -2230,17 +2222,11 @@ bool SendMessages(CNode *pto, CConnman &connman) connman.PushMessage(pto, NetMsgType::PING, nonce); } - // Acquire cs_main for IsInitialBlockDownload() and CNodeState() - TRY_LOCK(cs_main, lockMain); - if (!lockMain) - { - return true; - } - if (SendRejectsAndCheckIfBanned(pto, connman)) { return true; } + CNodeStateAccessor nodestate(nodestateman, pto->GetId()); if (nodestate.IsNull()) { @@ -2302,7 +2288,8 @@ bool SendMessages(CNode *pto, CConnman &connman) if (!nodestate->fSyncStarted && !pto->fClient && !fImporting && !fReindex) { - if (fFetch || pnetMan->getChainActive()->pindexBestHeader->GetBlockTime() > GetAdjustedTime() - 24 * 60 * 60) + if (fFetch || + pnetMan->getChainActive()->pindexBestHeader.load()->GetBlockTime() > GetAdjustedTime() - 24 * 60 * 60) { nodestate->fSyncStarted = true; const CBlockIndex *pindexStart = pnetMan->getChainActive()->pindexBestHeader; @@ -2584,10 +2571,11 @@ bool SendMessages(CNode *pto, CConnman &connman) } } + std::vector vGetData; + // // Message: getdata (blocks) // - std::vector vGetData; if (!pto->fClient && (fFetch || !pnetMan->getChainActive()->IsInitialBlockDownload()) && nodestate->nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER) { diff --git a/src/net/messages.h b/src/net/messages.h index 8ec15bf2..9f24c9a6 100644 --- a/src/net/messages.h +++ b/src/net/messages.h @@ -73,14 +73,6 @@ struct CNodeStateStats std::vector vHeightInFlight; }; - -struct CBlockReject -{ - unsigned char chRejectCode; - std::string strRejectReason; - uint256 hashBlock; -}; - /** Blocks that are in flight, and that are in the queue to be downloaded. Protected by cs_main. */ struct QueuedBlock { diff --git a/src/net/nodestate.h b/src/net/nodestate.h index 95f46b9e..8e19dc94 100644 --- a/src/net/nodestate.h +++ b/src/net/nodestate.h @@ -20,9 +20,6 @@ struct CNodeState bool fShouldBan; //! String name of this peer (debugging/logging purposes). const std::string name; - //! List of asynchronously-determined block rejections to notify this peer - //! about. - std::vector rejects; //! The best known block we know this peer has announced. const CBlockIndex *pindexBestKnownBlock; //! The hash of the last unknown block this peer has announced. diff --git a/src/processblock.cpp b/src/processblock.cpp index d8d68ee2..5f5da834 100644 --- a/src/processblock.cpp +++ b/src/processblock.cpp @@ -31,6 +31,7 @@ #include "blockstorage/blockstorage.h" #include "chain/checkpoints.h" #include "checkqueue.h" +#include "consensus/merkle.h" #include "crypto/hash.h" #include "init.h" #include "kernel.h" @@ -55,142 +56,6 @@ bool fLargeWorkInvalidChainFound = false; CBlockIndex *pindexBestForkTip = nullptr; CBlockIndex *pindexBestForkBase = nullptr; - -/** Store block on disk. If dbp is non-NULL, the file is known to already reside on disk */ -bool AcceptBlock(const CBlock *pblock, - CValidationState &state, - const CNetworkTemplate &chainparams, - CBlockIndex **ppindex, - bool fRequested, - CDiskBlockPos *dbp) -{ - AssertLockHeld(cs_main); - - CBlockIndex *&pindex = *ppindex; - - if (!AcceptBlockHeader(*pblock, state, chainparams, &pindex)) - return false; - - // Try to process all requested blocks that we don't have, but only - // process an unrequested block if it's new and has enough work to - // advance our tip, and isn't too many blocks ahead. - bool fAlreadyHave = pindex->nStatus & BLOCK_HAVE_DATA; - bool fHasMoreWork = (pnetMan->getChainActive()->chainActive.Tip() ? - pindex->nChainWork > pnetMan->getChainActive()->chainActive.Tip()->nChainWork : - true); - // Blocks that are too out-of-order needlessly limit the effectiveness of - // pruning, because pruning will not delete block files that contain any - // blocks which are too close in height to the tip. Apply this test - // regardless of whether pruning is enabled; it should generally be safe to - // not process unrequested blocks. - bool fTooFarAhead = (pindex->nHeight > int(pnetMan->getChainActive()->chainActive.Height() + MIN_BLOCKS_TO_KEEP)); - - // TODO: deal better with return value and error conditions for duplicate - // and unrequested blocks. - if (fAlreadyHave) - return true; - if (!fRequested) - { // If we didn't ask for it: - if (pindex->nTx != 0) - return true; // This is a previously-processed block that was pruned - if (!fHasMoreWork) - return true; // Don't process less-work chains - if (fTooFarAhead) - return true; // Block height is too high - } - - if ((!CheckBlock(*pblock, state)) || !ContextualCheckBlock(*pblock, state, pindex->pprev)) - { - if (state.IsInvalid() && !state.CorruptionPossible()) - { - pindex->nStatus |= BLOCK_FAILED_VALID; - setDirtyBlockIndex.insert(pindex); - } - return false; - } - - // Header is valid/has work, merkle tree and segwit merkle tree are - // good...RELAY NOW (but if it does not build on our best tip, let the - // SendMessages loop relay it) - if (!pnetMan->getChainActive()->IsInitialBlockDownload() && - pnetMan->getChainActive()->chainActive.Tip() == pindex->pprev) - { - GetMainSignals().NewPoWValidBlock(pindex, pblock); - } - - - int nHeight = pindex->nHeight; - - // Write block to history file - try - { - unsigned int nBlockSize = ::GetSerializeSize(*pblock, SER_DISK, CLIENT_VERSION); - CDiskBlockPos blockPos; - if (dbp != NULL) - blockPos = *dbp; - if (!FindBlockPos(state, blockPos, nBlockSize + 8, nHeight, (*pblock).GetBlockTime(), dbp != NULL)) - return error("AcceptBlock(): FindBlockPos failed"); - if (dbp == NULL) - if (!WriteBlockToDisk(*pblock, blockPos, chainparams.MessageStart())) - AbortNode(state, "Failed to write block"); - if (!ReceivedBlockTransactions(*pblock, state, pindex, blockPos)) - return error("AcceptBlock(): ReceivedBlockTransactions failed"); - } - catch (const std::runtime_error &e) - { - return AbortNode(state, std::string("System error: ") + e.what()); - } - - return true; -} - -bool ProcessNewBlock(CValidationState &state, - const CNetworkTemplate &chainparams, - const CNode *pfrom, - const CBlock *pblock, - bool fForceProcessing, - CDiskBlockPos *dbp) -{ - if (!CheckBlockHeader(*pblock, state, true)) - { - // block header is bad - // demerit the sender - return error("%s: CheckBlockHeader FAILED", __func__); - } - // Preliminary checks - bool checked = CheckBlock(*pblock, state); - - { - LOCK(cs_main); - bool fRequested = MarkBlockAsReceived(pblock->GetHash()); - fRequested |= fForceProcessing; - if (!checked) - { - LogPrintf("%s \n", state.GetRejectReason().c_str()); - return error("%s: CheckBlock FAILED", __func__); - } - - // Store to disk - CBlockIndex *pindex = nullptr; - bool ret = AcceptBlock(pblock, state, chainparams, &pindex, fRequested, dbp); - CheckBlockIndex(chainparams.GetConsensus()); - if (!ret) - { - return error("%s: AcceptBlock FAILED", __func__); - } - } - - if (!ActivateBestChain(state, chainparams, pblock)) - { - if (state.IsInvalid() || state.IsError()) - return error("%s: ActivateBestChain failed", __func__); - else - return false; - } - - return true; -} - /** Update chainActive and related internal data structures. */ void UpdateTip(CBlockIndex *pindexNew) { @@ -1063,6 +928,8 @@ bool ConnectBlock(const CBlock &block, if (pindex->GetBlockHash() != chainparams.GetConsensus().hashGenesisBlock) { + // need cs_mapBlockIndex to update the index + RECURSIVEWRITELOCK(pnetMan->getChainActive()->cs_mapBlockIndex); // once updateForPos runs the only flags that should be enabled are the ones that determine if PoS block or not // before this runs there should have been no flags set. so it is ok to reset the flags to 0 pindex->updateForPos(block); @@ -1073,7 +940,7 @@ bool ConnectBlock(const CBlock &block, return false; // verify that the view's current state corresponds to the previous block - uint256 hashPrevBlock = pindex->pprev == NULL ? uint256() : pindex->pprev->GetBlockHash(); + uint256 hashPrevBlock = pindex->pprev == nullptr ? uint256() : pindex->pprev->GetBlockHash(); assert(hashPrevBlock == view.GetBestBlock()); // Special case for the genesis block, skipping connection of its transactions @@ -1127,7 +994,7 @@ bool ConnectBlock(const CBlock &block, CBlockUndo blockundo; - CCheckQueueControl control(fScriptChecks && nScriptCheckThreads ? &scriptcheckqueue : NULL); + CCheckQueueControl control(fScriptChecks && nScriptCheckThreads ? &scriptcheckqueue : nullptr); std::vector prevheights; CAmount nFees = 0; @@ -1335,8 +1202,11 @@ bool ConnectBlock(const CBlock &block, CDiskBlockPos _pos; if (!FindUndoPos(state, pindex->nFile, _pos, ::GetSerializeSize(blockundo, SER_DISK, CLIENT_VERSION) + 40)) return error("ConnectBlock(): FindUndoPos failed"); - if (!UndoWriteToDisk(blockundo, _pos, pindex->pprev->GetBlockHash(), chainparams.MessageStart())) - return AbortNode(state, "Failed to write undo data"); + { + LOCK(cs_blockstorage); + if (!UndoWriteToDisk(blockundo, _pos, pindex->pprev->GetBlockHash(), chainparams.MessageStart())) + return AbortNode(state, "Failed to write undo data"); + } // update nUndoPos in block index pindex->nUndoPos = _pos.nPos; @@ -1414,10 +1284,13 @@ DisconnectResult DisconnectBlock(const CBlock &block, const CBlockIndex *pindex, error("DisconnectBlock(): no undo data available"); return DISCONNECT_FAILED; } - if (!UndoReadFromDisk(blockUndo, pos, pindex->pprev->GetBlockHash())) { - error("DisconnectBlock(): failure reading undo data"); - return DISCONNECT_FAILED; + LOCK(cs_blockstorage); + if (!UndoReadFromDisk(blockUndo, pos, pindex->pprev->GetBlockHash())) + { + error("DisconnectBlock(): failure reading undo data"); + return DISCONNECT_FAILED; + } } if (blockUndo.vtxundo.size() + 1 != block.vtx.size()) { @@ -1480,3 +1353,261 @@ DisconnectResult DisconnectBlock(const CBlock &block, const CBlockIndex *pindex, return fClean ? DISCONNECT_OK : DISCONNECT_UNCLEAN; } + + +/** Store block on disk. If dbp is non-NULL, the file is known to already reside on disk */ +bool AcceptBlock(const CBlock *pblock, + CValidationState &state, + const CNetworkTemplate &chainparams, + CBlockIndex **ppindex, + bool fRequested, + CDiskBlockPos *dbp) +{ + AssertLockHeld(cs_main); + + CBlockIndex *&pindex = *ppindex; + + if (!AcceptBlockHeader(*pblock, state, chainparams, &pindex)) + return false; + + // Try to process all requested blocks that we don't have, but only + // process an unrequested block if it's new and has enough work to + // advance our tip, and isn't too many blocks ahead. + bool fAlreadyHave = pindex->nStatus & BLOCK_HAVE_DATA; + bool fHasMoreWork = (pnetMan->getChainActive()->chainActive.Tip() ? + pindex->nChainWork > pnetMan->getChainActive()->chainActive.Tip()->nChainWork : + true); + // Blocks that are too out-of-order needlessly limit the effectiveness of + // pruning, because pruning will not delete block files that contain any + // blocks which are too close in height to the tip. Apply this test + // regardless of whether pruning is enabled; it should generally be safe to + // not process unrequested blocks. + bool fTooFarAhead = (pindex->nHeight > int(pnetMan->getChainActive()->chainActive.Height() + MIN_BLOCKS_TO_KEEP)); + + // TODO: deal better with return value and error conditions for duplicate + // and unrequested blocks. + if (fAlreadyHave) + return true; + if (!fRequested) + { // If we didn't ask for it: + if (pindex->nTx != 0) + return true; // This is a previously-processed block that was pruned + if (!fHasMoreWork) + return true; // Don't process less-work chains + if (fTooFarAhead) + return true; // Block height is too high + } + + if ((!CheckBlock(*pblock, state)) || !ContextualCheckBlock(*pblock, state, pindex->pprev)) + { + if (state.IsInvalid() && !state.CorruptionPossible()) + { + pindex->nStatus |= BLOCK_FAILED_VALID; + setDirtyBlockIndex.insert(pindex); + } + return false; + } + + // Header is valid/has work, merkle tree and segwit merkle tree are + // good...RELAY NOW (but if it does not build on our best tip, let the + // SendMessages loop relay it) + if (!pnetMan->getChainActive()->IsInitialBlockDownload() && + pnetMan->getChainActive()->chainActive.Tip() == pindex->pprev) + { + GetMainSignals().NewPoWValidBlock(pindex, pblock); + } + + + int nHeight = pindex->nHeight; + + // Write block to history file + try + { + unsigned int nBlockSize = ::GetSerializeSize(*pblock, SER_DISK, CLIENT_VERSION); + CDiskBlockPos blockPos; + if (dbp != NULL) + blockPos = *dbp; + if (!FindBlockPos(state, blockPos, nBlockSize + 8, nHeight, (*pblock).GetBlockTime(), dbp != NULL)) + return error("AcceptBlock(): FindBlockPos failed"); + if (dbp == NULL) + { + LOCK(cs_blockstorage); + if (!WriteBlockToDisk(*pblock, blockPos, chainparams.MessageStart())) + AbortNode(state, "Failed to write block"); + } + if (!ReceivedBlockTransactions(*pblock, state, pindex, blockPos)) + return error("AcceptBlock(): ReceivedBlockTransactions failed"); + } + catch (const std::runtime_error &e) + { + return AbortNode(state, std::string("System error: ") + e.what()); + } + + return true; +} + +bool CheckBlock(const CBlock &block, CValidationState &state, bool fCheckPOW, bool fCheckMerkleRoot) +{ + // These are checks that are independent of context. + if (block.fChecked) + { + return true; + } + + if (block.IsProofOfWork() && fCheckPOW && + !CheckProofOfWork(block.GetHash(), block.nBits, pnetMan->getActivePaymentNetwork()->GetConsensus())) + { + return state.DoS(50, error("CheckBlockHeader(): proof of work failed"), REJECT_INVALID, "high-hash"); + } + + // Check that the header is valid (particularly PoW). This is mostly + // redundant with the call in AcceptBlockHeader. + if (!CheckBlockHeader(block, state)) + { + return error("%s: CheckBlockHeader FAILED", __func__); + } + + // Check the merkle root. + if (fCheckMerkleRoot) + { + bool mutated; + uint256 hashMerkleRoot2 = BlockMerkleRoot(block, &mutated); + if (block.hashMerkleRoot != hashMerkleRoot2) + { + return state.DoS( + 100, error("CheckBlock(): hashMerkleRoot mismatch"), REJECT_INVALID, "bad-txnmrklroot", true); + } + + // Check for merkle tree malleability (CVE-2012-2459): repeating sequences + // of transactions in a block without affecting the merkle root of a block, + // while still invalidating it. + if (mutated) + { + return state.DoS( + 100, error("CheckBlock(): duplicate transaction"), REJECT_INVALID, "bad-txns-duplicate", true); + } + } + + // All potential-corruption validation must be done before we do any + // transaction validation, as otherwise we may mark the header as invalid + // because we receive the wrong transactions for it. + + // Size limits + if (block.vtx.empty() || block.vtx.size() > MAX_BLOCK_SIZE || + ::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE) + { + return state.DoS(100, error("CheckBlock(): size limits failed"), REJECT_INVALID, "bad-blk-length"); + } + + // First transaction must be coinbase, the rest must not be + if (block.vtx.empty() || !block.vtx[0]->IsCoinBase()) + { + return state.DoS(100, error("CheckBlock(): first tx is not coinbase"), REJECT_INVALID, "bad-cb-missing"); + } + + for (unsigned int i = 1; i < block.vtx.size(); i++) + { + if (block.vtx[i]->IsCoinBase()) + { + return state.DoS(100, error("CheckBlock(): more than one coinbase"), REJECT_INVALID, "bad-cb-multiple"); + } + } + + // PoS: only the second transaction can be the optional coinstake + for (unsigned int i = 2; i < block.vtx.size(); i++) + { + if (block.vtx[i]->IsCoinStake()) + { + return state.DoS(100, error("CheckBlock() : coinstake in wrong position")); + } + } + + // PoS: coinbase output should be empty if proof-of-stake block + if (block.IsProofOfStake() && (block.vtx[0]->vout.size() != 1 || !block.vtx[0]->vout[0].IsEmpty())) + { + return state.DoS(0, error("CheckBlock() : coinbase output not empty for proof-of-stake block")); + } + + // Check transactions + for (auto const &tx : block.vtx) + { + if (!CheckTransaction(*tx, state)) + { + return state.Invalid(false, state.GetRejectCode(), state.GetRejectReason(), + strprintf("Transaction check failed (txid %s) %s", tx->GetId().ToString(), state.GetDebugMessage())); + } + if (tx->nVersion == 2) + { + } + // PoS: check transaction timestamp + if (block.GetBlockTime() < (int64_t)tx->nTime) + { + return state.DoS(50, error("CheckBlock() : block timestamp earlier than transaction timestamp")); + } + } + + unsigned int nSigOps = 0; + for (auto const &tx : block.vtx) + { + nSigOps += GetLegacySigOpCount(*tx); + } + if (nSigOps > MAX_BLOCK_SIGOPS) + { + return state.DoS(100, error("CheckBlock(): out-of-bounds SigOpCount"), REJECT_INVALID, "bad-blk-sigops"); + } + + // PoS: check block signature + if (!block.CheckBlockSignature()) + { + return state.DoS(100, error("CheckBlock() : bad block signature"), REJECT_INVALID, "bad-block-sig"); + } + + if (fCheckPOW && fCheckMerkleRoot) + { + block.fChecked = true; + } + + return true; +} + +bool ProcessNewBlock(CValidationState &state, + const CNetworkTemplate &chainparams, + const CNode *pfrom, + const CBlock *pblock, + bool fForceProcessing, + CDiskBlockPos *dbp) +{ + // Preliminary checks + bool checked = CheckBlock(*pblock, state); // no lock required + + { + LOCK(cs_main); + RECURSIVEWRITELOCK(pnetMan->getChainActive()->cs_mapBlockIndex); + bool fRequested = MarkBlockAsReceived(pblock->GetHash()); + fRequested |= fForceProcessing; + if (!checked) + { + LogPrintf("%s \n", state.GetRejectReason().c_str()); + return error("%s: CheckBlock FAILED", __func__); + } + + // Store to disk + CBlockIndex *pindex = nullptr; + bool ret = AcceptBlock(pblock, state, chainparams, &pindex, fRequested, dbp); + CheckBlockIndex(chainparams.GetConsensus()); + if (!ret) + { + return error("%s: AcceptBlock FAILED", __func__); + } + } + + if (!ActivateBestChain(state, chainparams, pblock)) + { + if (state.IsInvalid() || state.IsError()) + return error("%s: ActivateBestChain failed", __func__); + else + return false; + } + + return true; +} diff --git a/src/processblock.h b/src/processblock.h index cc5df753..81178c0b 100644 --- a/src/processblock.h +++ b/src/processblock.h @@ -37,30 +37,7 @@ extern bool fLargeWorkInvalidChainFound; CBlockIndex *FindMostWorkChain(); void CheckBlockIndex(const Consensus::Params &consensusParams); -/** - * Process an incoming block. This only returns after the best known valid - * block is made active. Note that it does not, however, guarantee that the - * specific block passed to it has been checked for validity! - * - * @param[out] state This may be set to an Error state if any error occurred processing it, including during - * validation/connection/etc of otherwise unrelated blocks during reorganisation; or it may be set to an Invalid state - * if pblock is itself invalid (but this is not guaranteed even when the block is checked). If you want to *possibly* - * get feedback on whether pblock is valid, you must also install a CValidationInterface (see validationinterface.h) - - * this will have its BlockChecked method called whenever *any* block completes validation. - * @param[in] pfrom The node which we are receiving the block from; it is added to mapBlockSource and may be - * penalised if the block is invalid. - * @param[in] pblock The block we want to process. - * @param[in] fForceProcessing Process this block even if unrequested; used for non-network block sources and - * whitelisted peers. - * @param[out] dbp If pblock is stored to disk (or already there), this will be set to its location. - * @return True if state.IsValid() - */ -bool ProcessNewBlock(CValidationState &state, - const CNetworkTemplate &chainparams, - const CNode *pfrom, - const CBlock *pblock, - bool fForceProcessing, - CDiskBlockPos *dbp); + bool DisconnectTip(CValidationState &state, const Consensus::Params &consensusParams); void InvalidChainFound(CBlockIndex *pindexNew); void InvalidBlockFound(CBlockIndex *pindex, const CValidationState &state); @@ -85,5 +62,29 @@ DisconnectResult DisconnectBlock(const CBlock &block, const CBlockIndex *pindex, /** Find the best known block, and make it the tip of the block chain */ bool ActivateBestChain(CValidationState &state, const CNetworkTemplate &chainparams, const CBlock *pblock = nullptr); +/** + * Process an incoming block. This only returns after the best known valid + * block is made active. Note that it does not, however, guarantee that the + * specific block passed to it has been checked for validity! + * + * @param[out] state This may be set to an Error state if any error occurred processing it, including during + * validation/connection/etc of otherwise unrelated blocks during reorganisation; or it may be set to an Invalid state + * if pblock is itself invalid (but this is not guaranteed even when the block is checked). If you want to *possibly* + * get feedback on whether pblock is valid, you must also install a CValidationInterface (see validationinterface.h) - + * this will have its BlockChecked method called whenever *any* block completes validation. + * @param[in] pfrom The node which we are receiving the block from; it is added to mapBlockSource and may be + * penalised if the block is invalid. + * @param[in] pblock The block we want to process. + * @param[in] fForceProcessing Process this block even if unrequested; used for non-network block sources and + * whitelisted peers. + * @param[out] dbp If pblock is stored to disk (or already there), this will be set to its location. + * @return True if state.IsValid() + */ +bool ProcessNewBlock(CValidationState &state, + const CNetworkTemplate &chainparams, + const CNode *pfrom, + const CBlock *pblock, + bool fForceProcessing, + CDiskBlockPos *dbp); #endif // PROCESSBLOCK_H diff --git a/src/processheader.cpp b/src/processheader.cpp index f39b596c..75b8ccc0 100644 --- a/src/processheader.cpp +++ b/src/processheader.cpp @@ -31,6 +31,7 @@ bool AcceptBlockHeader(const CBlockHeader &block, CBlockIndex **ppindex) { AssertLockHeld(cs_main); + // AssertRecursiveWriteLockHeld(pnetMan->getChainActive()->cs_mapBlockIndex); // Check for duplicate uint256 hash = block.GetHash(); CBlockIndex *pindex = pnetMan->getChainActive()->LookupBlockIndex(hash); @@ -79,7 +80,7 @@ bool AcceptBlockHeader(const CBlockHeader &block, } -bool CheckBlockHeader(const CBlockHeader &block, CValidationState &state, bool fCheckPOW) +bool CheckBlockHeader(const CBlockHeader &block, CValidationState &state) { // Check timestamp if (block.GetBlockTime() > GetAdjustedTime() + 2 * 60 * 60) diff --git a/src/processheader.h b/src/processheader.h index 82721166..0c7175a4 100644 --- a/src/processheader.h +++ b/src/processheader.h @@ -24,7 +24,7 @@ #include "networks/networktemplate.h" #include "validationinterface.h" -bool CheckBlockHeader(const CBlockHeader &block, CValidationState &state, bool fCheckPOW = true); +bool CheckBlockHeader(const CBlockHeader &block, CValidationState &state); bool ContextualCheckBlockHeader(const CBlockHeader &block, CValidationState &state, CBlockIndex *pindexPrev); bool AcceptBlockHeader(const CBlockHeader &block, CValidationState &state, diff --git a/src/rpc/rpcblockchain.cpp b/src/rpc/rpcblockchain.cpp index 0822afc9..ffe80c57 100644 --- a/src/rpc/rpcblockchain.cpp +++ b/src/rpc/rpcblockchain.cpp @@ -167,7 +167,6 @@ UniValue getblockcount(const UniValue ¶ms, bool fHelp) "\nExamples:\n" + HelpExampleCli("getblockcount", "") + HelpExampleRpc("getblockcount", "")); - LOCK(cs_main); return pnetMan->getChainActive()->chainActive.Height(); } @@ -181,7 +180,6 @@ UniValue getbestblockhash(const UniValue ¶ms, bool fHelp) "\nExamples\n" + HelpExampleCli("getbestblockhash", "") + HelpExampleRpc("getbestblockhash", "")); - LOCK(cs_main); return pnetMan->getChainActive()->chainActive.Tip()->GetBlockHash().GetHex(); } @@ -196,7 +194,6 @@ UniValue getdifficulty(const UniValue ¶ms, bool fHelp) "\nExamples:\n" + HelpExampleCli("getdifficulty", "") + HelpExampleRpc("getdifficulty", "")); - LOCK(cs_main); return GetDifficulty(); } @@ -292,8 +289,6 @@ UniValue getrawmempool(const UniValue ¶ms, bool fHelp) "\nExamples\n" + HelpExampleCli("getrawmempool", "true") + HelpExampleRpc("getrawmempool", "true")); - LOCK(cs_main); - bool fVerbose = false; if (params.size() > 0) fVerbose = params[0].get_bool(); @@ -313,12 +308,11 @@ UniValue getblockhash(const UniValue ¶ms, bool fHelp) "\nExamples:\n" + HelpExampleCli("getblockhash", "1000") + HelpExampleRpc("getblockhash", "1000")); - LOCK(cs_main); - int nHeight = params[0].get_int(); if (nHeight < 0 || nHeight > pnetMan->getChainActive()->chainActive.Height()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range"); + RECURSIVEREADLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); CBlockIndex *pblockindex = pnetMan->getChainActive()->chainActive[nHeight]; return pblockindex->GetBlockHash().GetHex(); } @@ -358,8 +352,6 @@ UniValue getblockheader(const UniValue ¶ms, bool fHelp) HelpExampleCli("getblockheader", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"") + HelpExampleRpc("getblockheader", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")); - LOCK(cs_main); - std::string strHash = params[0].get_str(); uint256 hash(uint256S(strHash)); @@ -429,12 +421,10 @@ UniValue getblock(const UniValue ¶ms, bool fHelp) CBlockIndex *pblockindex; if (params.size() > 1) fVerbose = params[1].get_bool(); - { - LOCK(cs_main); - pblockindex = pnetMan->getChainActive()->LookupBlockIndex(hash); - if (!pblockindex) - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); - } + + pblockindex = pnetMan->getChainActive()->LookupBlockIndex(hash); + if (!pblockindex) + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); CBlock block; { @@ -483,9 +473,7 @@ static bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats) CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION); stats.hashBlock = pcursor->GetBestBlock(); - { - stats.nHeight = pnetMan->getChainActive()->LookupBlockIndex(stats.hashBlock)->nHeight; - } + stats.nHeight = pnetMan->getChainActive()->LookupBlockIndex(stats.hashBlock)->nHeight; ss << stats.hashBlock; uint256 prevkey; std::map outputs; @@ -752,13 +740,12 @@ UniValue getblockchaininfo(const UniValue ¶ms, bool fHelp) "\nExamples:\n" + HelpExampleCli("getblockchaininfo", "") + HelpExampleRpc("getblockchaininfo", "")); - LOCK(cs_main); - UniValue obj(UniValue::VOBJ); obj.push_back(Pair("chain", pnetMan->getActivePaymentNetwork()->NetworkIDString())); obj.push_back(Pair("blocks", (int)pnetMan->getChainActive()->chainActive.Height())); - obj.push_back(Pair("headers", - pnetMan->getChainActive()->pindexBestHeader ? pnetMan->getChainActive()->pindexBestHeader->nHeight : -1)); + obj.push_back(Pair("headers", pnetMan->getChainActive()->pindexBestHeader ? + pnetMan->getChainActive()->pindexBestHeader.load()->nHeight : + -1)); obj.push_back(Pair("bestblockhash", pnetMan->getChainActive()->chainActive.Tip()->GetBlockHash().GetHex())); obj.push_back(Pair("difficulty", (double)GetDifficulty())); obj.push_back(Pair("mediantime", (int64_t)pnetMan->getChainActive()->chainActive.Tip()->GetMedianTimePast())); @@ -866,8 +853,6 @@ UniValue getchaintips(const UniValue ¶ms, bool fHelp) "\nExamples:\n" + HelpExampleCli("getchaintips", "") + HelpExampleRpc("getchaintips", "")); - LOCK(cs_main); - std::set setTips; setTips = GetChainTips(); diff --git a/src/rpc/rpcmining.cpp b/src/rpc/rpcmining.cpp index f6b3a3f2..47ac5fc7 100644 --- a/src/rpc/rpcmining.cpp +++ b/src/rpc/rpcmining.cpp @@ -44,6 +44,7 @@ #include #include +#include #include @@ -709,7 +710,7 @@ UniValue getblocktemplate(const UniValue ¶ms, bool fHelp) { // Wait to respond until either the best block changes, OR a minute has passed and there are more transactions uint256 hashWatchedChain; - boost::system_time checktxtime; + std::chrono::time_point checktxtime; unsigned int nTransactionsUpdatedLastLP; if (lpval.isStr()) @@ -730,17 +731,17 @@ UniValue getblocktemplate(const UniValue ¶ms, bool fHelp) // Release the wallet and main lock while waiting LEAVE_CRITICAL_SECTION(cs_main); { - checktxtime = boost::get_system_time() + boost::posix_time::minutes(1); + checktxtime = std::chrono::system_clock::now() + std::chrono::minutes(1); - boost::unique_lock lock(csBestBlock); + std::unique_lock lock(csBestBlock); while (pnetMan->getChainActive()->chainActive.Tip()->GetBlockHash() == hashWatchedChain && IsRPCRunning()) { - if (!cvBlockChange.timed_wait(lock, checktxtime)) + if (cvBlockChange.wait_until(lock, checktxtime) == std::cv_status::timeout) { // Timeout: Check transactions for update if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLastLP) break; - checktxtime += boost::posix_time::seconds(10); + checktxtime += std::chrono::seconds(10); } } } @@ -1036,7 +1037,7 @@ UniValue getposblocktemplate(const UniValue ¶ms, bool fHelp) { // Wait to respond until either the best block changes, OR a minute has passed and there are more transactions uint256 hashWatchedChain; - boost::system_time checktxtime; + std::chrono::time_point checktxtime; unsigned int nTransactionsUpdatedLastLP; if (lpval.isStr()) @@ -1057,17 +1058,17 @@ UniValue getposblocktemplate(const UniValue ¶ms, bool fHelp) // Release the wallet and main lock while waiting LEAVE_CRITICAL_SECTION(cs_main); { - checktxtime = boost::get_system_time() + boost::posix_time::minutes(1); + checktxtime = std::chrono::system_clock::now() + std::chrono::minutes(1); - boost::unique_lock lock(csBestBlock); + std::unique_lock lock(csBestBlock); while (pnetMan->getChainActive()->chainActive.Tip()->GetBlockHash() == hashWatchedChain && IsRPCRunning()) { - if (!cvBlockChange.timed_wait(lock, checktxtime)) + if (cvBlockChange.wait_until(lock, checktxtime) == std::cv_status::timeout) { // Timeout: Check transactions for update if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLastLP) break; - checktxtime += boost::posix_time::seconds(10); + checktxtime += std::chrono::seconds(10); } } } diff --git a/src/rpc/rpcmisc.cpp b/src/rpc/rpcmisc.cpp index 46ef05fa..3865a7ab 100644 --- a/src/rpc/rpcmisc.cpp +++ b/src/rpc/rpcmisc.cpp @@ -103,7 +103,7 @@ UniValue getinfo(const UniValue ¶ms, bool fHelp) obj.push_back(Pair("stake", ValueFromAmount(pwalletMain->GetStake()))); } obj.push_back(Pair("blocks", (int)pnetMan->getChainActive()->chainActive.Height())); - obj.push_back(Pair("headers", (int)pnetMan->getChainActive()->pindexBestHeader->nHeight)); + obj.push_back(Pair("headers", (int)pnetMan->getChainActive()->pindexBestHeader.load()->nHeight)); obj.push_back(Pair("moneysupply", ValueFromAmount(pnetMan->getChainActive()->chainActive.Tip()->nMoneySupply))); obj.push_back(Pair("timeoffset", GetTimeOffset())); obj.push_back(Pair("connections", (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL))); diff --git a/src/sync.cpp b/src/sync.cpp index 61cb412b..43315588 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -35,7 +35,7 @@ void PrintLockContention(const char *pszName, const char *pszFile, unsigned int } #endif /* DEBUG_LOCKCONTENTION */ -#ifdef DEBUG_LOCKORDER +#ifdef DEBUG_LOCKORDER // this define covers the rest of the file // // Early deadlock detection. // Problem being solved: @@ -150,7 +150,7 @@ static void potential_deadlock_detected(const std::pair &mismatc static void push_lock(void *c, const CLockLocation &locklocation, bool fTry) { - if (lockstack.get() == NULL) + if (lockstack.get() == nullptr) lockstack.reset(new LockStack); std::lock_guard lock(lockdata.dd_mutex); @@ -231,9 +231,22 @@ void AssertWriteLockHeldInternal(const char *pszName, } } +void AssertRecursiveWriteLockHeldinternal(const char *pszName, + const char *pszFile, + unsigned int nLine, + CRecursiveSharedCriticalSection *cs) +{ + if (cs->try_lock()) // It would be better to check that this thread has the lock + { + fprintf(stderr, "Assertion failed: lock %s not held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, + LocksHeld().c_str()); + fflush(stderr); + abort(); + } +} + // BU normally CCriticalSection is a typedef, but when lockorder debugging is on we need to delete the critical // section from the lockorder map -#ifdef DEBUG_LOCKORDER CCriticalSection::CCriticalSection() : name(NULL) {} CCriticalSection::CCriticalSection(const char *n) : name(n) { @@ -258,11 +271,9 @@ CCriticalSection::~CCriticalSection() #endif DeleteLock((void *)this); } -#endif // BU normally CSharedCriticalSection is a typedef, but when lockorder debugging is on we need to delete the critical // section from the lockorder map -#ifdef DEBUG_LOCKORDER CSharedCriticalSection::CSharedCriticalSection() : name(NULL), exclusiveOwner(0) {} CSharedCriticalSection::CSharedCriticalSection(const char *n) : name(n), exclusiveOwner(0) { @@ -287,7 +298,6 @@ CSharedCriticalSection::~CSharedCriticalSection() #endif DeleteLock((void *)this); } -#endif void CSharedCriticalSection::lock_shared() @@ -391,7 +401,6 @@ void DeleteLock(void *cs) } } -#ifdef DEBUG_LOCKORDER CRecursiveSharedCriticalSection::CRecursiveSharedCriticalSection() : name(nullptr) {} CRecursiveSharedCriticalSection::CRecursiveSharedCriticalSection(const char *n) : name(n) { @@ -416,7 +425,6 @@ CRecursiveSharedCriticalSection::~CRecursiveSharedCriticalSection() #endif DeleteLock((void *)this); } -#endif #endif /* DEBUG_LOCKORDER */ diff --git a/src/sync.h b/src/sync.h index 17d935c6..9ee26c31 100644 --- a/src/sync.h +++ b/src/sync.h @@ -21,6 +21,7 @@ #include // for boost::thread_specific_ptr #include +#include //////////////////////////////////////////////// // // @@ -240,13 +241,13 @@ class CSharedUnlocker /** Wrapped boost mutex: supports waiting but not recursive locking */ -typedef AnnotatedMixin CWaitableCriticalSection; +typedef AnnotatedMixin CWaitableCriticalSection; /** Just a typedef for boost::condition_variable, can be wrapped later if desired */ -typedef boost::condition_variable CConditionVariable; +typedef std::condition_variable CConditionVariable; /** Just a typedef for boost::condition_variable_any, can be wrapped later if desired -- c++11 version missing on win */ -typedef boost::condition_variable_any CCond; +typedef std::condition_variable_any CCond; #ifdef DEBUG_LOCKORDER void EnterCritical(const char *pszName, const char *pszFile, unsigned int nLine, void *cs, bool fTry = false); @@ -261,6 +262,10 @@ void AssertWriteLockHeldInternal(const char *pszName, const char *pszFile, unsigned int nLine, CSharedCriticalSection *cs); +void AssertRecursiveWriteLockHeldinternal(const char *pszName, + const char *pszFile, + unsigned int nLine, + CRecursiveSharedCriticalSection *cs); #else void static inline EnterCritical(const char *pszName, const char *pszFile, @@ -270,6 +275,7 @@ void static inline EnterCritical(const char *pszName, { } void static inline LeaveCritical() {} +void static inline DeleteLock(void *cs) {} void static inline AssertLockHeldInternal(const char *pszName, const char *pszFile, unsigned int nLine, void *cs) {} void static inline AssertLockNotHeldInternal(const char *pszName, const char *pszFile, unsigned int nLine, void *cs) {} void static inline AssertWriteLockHeldInternal(const char *pszName, @@ -278,11 +284,17 @@ void static inline AssertWriteLockHeldInternal(const char *pszName, CSharedCriticalSection *cs) { } -static inline void DeleteLock(void *cs) {} +void static inline AssertRecursiveWriteLockHeldinternal(const char *pszName, + const char *pszFile, + unsigned int nLine, + CRecursiveSharedCriticalSection *cs) +{ +} #endif #define AssertLockHeld(cs) AssertLockHeldInternal(#cs, __FILE__, __LINE__, &cs) #define AssertLockNotHeld(cs) AssertLockNotHeldInternal(#cs, __FILE__, __LINE__, &cs) #define AssertWriteLockHeld(cs) AssertWriteLockHeldInternal(#cs, __FILE__, __LINE__, &cs) +#define AssertRecursiveWriteLockHeld(cs) AssertRecursiveWriteLockHeldInternal(#cs, __FILE__, __LINE__, &cs) #ifdef DEBUG_LOCKCONTENTION void PrintLockContention(const char *pszName, const char *pszFile, unsigned int nLine); @@ -290,12 +302,12 @@ void PrintLockContention(const char *pszName, const char *pszFile, unsigned int #define LOCK_WARN_TIME (500ULL * 1000ULL * 1000ULL) -/** Wrapper around boost::unique_lock */ +/** Wrapper around std::unique_lock */ template class SCOPED_LOCKABLE CMutexLock { private: - boost::unique_lock lock; + std::unique_lock lock; // Checking elapsed lock time is very inefficient compared to the lock/unlock operation so we must be able to // turn the feature on and off at compile time. #ifdef DEBUG_LOCKTIME @@ -357,7 +369,7 @@ class SCOPED_LOCKABLE CMutexLock public: CMutexLock(Mutex &mutexIn, const char *pszName, const char *pszFile, unsigned int nLine, bool fTry = false) EXCLUSIVE_LOCK_FUNCTION(mutexIn) - : lock(mutexIn, boost::defer_lock) + : lock(mutexIn, std::defer_lock) { if (fTry) TryEnter(pszName, pszFile, nLine); @@ -371,7 +383,7 @@ class SCOPED_LOCKABLE CMutexLock if (!pmutexIn) return; - lock = boost::unique_lock(*pmutexIn, boost::defer_lock); + lock = std::unique_lock(*pmutexIn, std::defer_lock); if (fTry) TryEnter(pszName, pszFile, nLine); else @@ -396,13 +408,15 @@ class SCOPED_LOCKABLE CMutexLock operator bool() { return lock.owns_lock(); } }; -/** Wrapper around boost::unique_lock */ +/** Wrapper around std::unique_lock */ template class SCOPED_LOCKABLE CMutexReadLock { private: - boost::shared_lock lock; + std::shared_lock lock; +#ifdef DEBUG_LOCKTIME uint64_t lockedTime = 0; +#endif const char *name = "unknown-name"; const char *file = "unknown-file"; unsigned int line = 0; @@ -459,7 +473,7 @@ class SCOPED_LOCKABLE CMutexReadLock public: CMutexReadLock(Mutex &mutexIn, const char *pszName, const char *pszFile, unsigned int nLine, bool fTry = false) SHARED_LOCK_FUNCTION(mutexIn) - : lock(mutexIn, boost::defer_lock) + : lock(mutexIn, std::defer_lock) { if (fTry) TryEnter(pszName, pszFile, nLine); @@ -511,7 +525,6 @@ typedef CMutexLock CRecursiveWriteBlock; typedef CMutexReadLock CReadBlock; typedef CMutexLock CWriteBlock; -typedef CMutexLock CCriticalBlock; #define READLOCK(cs) CReadBlock UNIQUIFY(readblock)(cs, #cs, __FILE__, __LINE__) #define WRITELOCK(cs) CWriteBlock UNIQUIFY(writeblock)(cs, #cs, __FILE__, __LINE__) @@ -519,6 +532,8 @@ typedef CMutexLock CCriticalBlock; CReadBlock UNIQUIFY(readblock1)(cs1, #cs1, __FILE__, __LINE__), UNIQUIFY(readblock2)(cs2, #cs2, __FILE__, __LINE__) #define TRY_READ_LOCK(cs, name) CReadBlock name(cs, #cs, __FILE__, __LINE__, true) +typedef CMutexLock CCriticalBlock; + #define LOCK(cs) CCriticalBlock UNIQUIFY(criticalblock)(cs, #cs, __FILE__, __LINE__) #define LOCK2(cs1, cs2) \ CCriticalBlock UNIQUIFY(criticalblock1)(cs1, #cs1, __FILE__, __LINE__), \ diff --git a/src/threadgroup.h b/src/threadgroup.h index bf597db9..ad920e1f 100644 --- a/src/threadgroup.h +++ b/src/threadgroup.h @@ -44,11 +44,7 @@ class thread_group ~thread_group() { interrupt_all(); - for (auto &t : threads) - { - if (t.joinable()) - t.detach(); - } + join_all(); } }; diff --git a/src/util/logger.cpp b/src/util/logger.cpp index e987e979..f8d85422 100644 --- a/src/util/logger.cpp +++ b/src/util/logger.cpp @@ -9,22 +9,9 @@ #include -CLogger* g_logger = nullptr; +std::unique_ptr g_logger; volatile bool fReopenDebugLog = false; -bool CLogger::DebugPrintInit() -{ - if (mutexDebugLog == nullptr) - { - mutexDebugLog = new std::mutex(); - } - if (vMsgsBeforeOpenLog == nullptr) - { - vMsgsBeforeOpenLog = new std::list; - } - return true; -} - /** * fStartedNewLine is a state variable held by the calling context that will * suppress printing of the timestamp when multiple calls are made that don't @@ -63,28 +50,20 @@ int CLogger::FileWriteStr(const std::string &str, FILE *fp) void CLogger::OpenDebugLog() { - if (!DebugPrintInit()) - { - return; - } - std::lock_guard scoped_lock(*mutexDebugLog); + std::lock_guard scoped_lock(mutexDebugLog); assert(fileout == nullptr); - assert(vMsgsBeforeOpenLog); fs::path pathDebug = GetDataDir() / "debug.log"; fileout = fopen(pathDebug.string().c_str(), "a"); if (fileout) - setbuf(fileout, NULL); // unbuffered + setbuf(fileout, nullptr); // unbuffered // dump buffered messages from before we opened the log - while (!vMsgsBeforeOpenLog->empty()) + while (!vMsgsBeforeOpenLog.empty()) { - FileWriteStr(vMsgsBeforeOpenLog->front(), fileout); - vMsgsBeforeOpenLog->pop_front(); + FileWriteStr(vMsgsBeforeOpenLog.front(), fileout); + vMsgsBeforeOpenLog.pop_front(); } - - delete vMsgsBeforeOpenLog; - vMsgsBeforeOpenLog = nullptr; } bool CLogger::LogAcceptCategory(const char *category) @@ -117,6 +96,7 @@ bool CLogger::LogAcceptCategory(const char *category) int CLogger::LogPrintStr(const std::string &str) { + std::lock_guard scoped_lock(mutexDebugLog); int ret = 0; // Returns total number of characters written static bool fStartedNewLine = true; @@ -130,14 +110,11 @@ int CLogger::LogPrintStr(const std::string &str) } else if (fPrintToDebugLog) { - std::lock_guard scoped_lock(*mutexDebugLog); - // buffer if we haven't opened the log yet if (fileout == nullptr) { - assert(vMsgsBeforeOpenLog); ret = strTimestamped.length(); - vMsgsBeforeOpenLog->push_back(strTimestamped); + vMsgsBeforeOpenLog.push_back(strTimestamped); } else { diff --git a/src/util/logger.h b/src/util/logger.h index 6b88efd1..63d5b3bb 100644 --- a/src/util/logger.h +++ b/src/util/logger.h @@ -18,8 +18,8 @@ class CLogger { private: FILE *fileout; - std::mutex *mutexDebugLog; - std::list *vMsgsBeforeOpenLog; + mutable std::mutex mutexDebugLog; + std::list vMsgsBeforeOpenLog; public: bool fLogTimestamps; @@ -35,8 +35,6 @@ class CLogger CLogger(const CLogger &); CLogger &operator=(const CLogger &); - bool DebugPrintInit(); - std::string LogTimestampStr(const std::string &str, bool *fStartedNewLine); int FileWriteStr(const std::string &str, FILE *fp); @@ -45,8 +43,7 @@ class CLogger CLogger() { fileout = nullptr; - mutexDebugLog = nullptr; - vMsgsBeforeOpenLog = nullptr; + vMsgsBeforeOpenLog.clear(); fLogTimestamps = DEFAULT_LOGTIMESTAMPS; fLogTimeMicros = DEFAULT_LOGTIMEMICROS; @@ -54,7 +51,6 @@ class CLogger fDebug = false; fPrintToConsole = false; fPrintToDebugLog = true; - DebugPrintInit(); } void OpenDebugLog(); @@ -66,8 +62,8 @@ class CLogger void ShrinkDebugFile(); }; +extern std::unique_ptr g_logger; -extern CLogger* g_logger; #define LogPrintf(...) LogPrint(NULL, __VA_ARGS__) diff --git a/src/util/util.cpp b/src/util/util.cpp index 5fa7cb11..6bb3e10c 100644 --- a/src/util/util.cpp +++ b/src/util/util.cpp @@ -496,7 +496,7 @@ void SetupEnvironment() fs::path::imbue(loc); // create the here and delete it absolutely last - g_logger = new CLogger(); + g_logger = std::unique_ptr(new CLogger()); } bool SetupNetworking() diff --git a/src/verifydb.cpp b/src/verifydb.cpp index c1d1114b..7bf48e87 100644 --- a/src/verifydb.cpp +++ b/src/verifydb.cpp @@ -77,6 +77,7 @@ bool CVerifyDB::VerifyDB(const CNetworkTemplate &chainparams, CCoinsView *coinsv CDiskBlockPos pos = pindex->GetUndoPos(); if (!pos.IsNull()) { + LOCK(cs_blockstorage); if (!UndoReadFromDisk(undo, pos, pindex->pprev->GetBlockHash())) return error("VerifyDB(): *** found bad undo data at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString()); From 4cb4ae0c8e7bd891127ea03d9d523acc762bd348 Mon Sep 17 00:00:00 2001 From: Griffith <8345264+Greg-Griffith@users.noreply.github.com> Date: Fri, 26 Jul 2019 11:09:03 -0700 Subject: [PATCH 5/8] Refactor locking part3 (#232) * implement deadlock detection for recursive mutex, shared mutex, and rsm * remove debug lock contention from --enable-debug configure param * remove recursive detection from CSharedCriticalSection it was added to deadlock detector * deadlock detector fixes/adjustments/tests * fix net deadlock when checking for sending a message * fix deadlock issues --- configure.ac | 2 +- src/.formatted-files | 8 + src/Makefile.am | 2 + src/Makefile.test.include | 6 + src/coins.cpp | 10 +- src/net/net.cpp | 9 +- src/net/nodestate.cpp | 4 +- src/net/nodestate.h | 13 +- src/sync.cpp | 297 +---------- src/sync.h | 182 +++---- src/test/deadlock_tests/suite.h | 20 + src/test/deadlock_tests/test1-4.cpp | 55 ++ src/test/deadlock_tests/test5.cpp | 48 ++ src/test/deadlock_tests/test6.cpp | 48 ++ src/test/deadlock_tests/test7.cpp | 61 +++ src/test/deadlock_tests/test8.cpp | 61 +++ src/threaddeadlock.cpp | 764 ++++++++++++++++++++++++++++ src/threaddeadlock.h | 87 ++++ src/util/logger.cpp | 4 +- src/util/util.cpp | 4 +- 20 files changed, 1297 insertions(+), 388 deletions(-) create mode 100644 src/test/deadlock_tests/suite.h create mode 100644 src/test/deadlock_tests/test1-4.cpp create mode 100644 src/test/deadlock_tests/test5.cpp create mode 100644 src/test/deadlock_tests/test6.cpp create mode 100644 src/test/deadlock_tests/test7.cpp create mode 100644 src/test/deadlock_tests/test8.cpp create mode 100644 src/threaddeadlock.cpp create mode 100644 src/threaddeadlock.h diff --git a/configure.ac b/configure.ac index 727340be..3eacc0c5 100644 --- a/configure.ac +++ b/configure.ac @@ -224,7 +224,7 @@ AC_LANG_PUSH([C++]) AX_CHECK_COMPILE_FLAG([-Werror],[CXXFLAG_WERROR="-Werror"],[CXXFLAG_WERROR=""]) if test "x$enable_debug" = xyes; then - CPPFLAGS="$CPPFLAGS -DDEBUG -DDEBUG_LOCKORDER -DDEBUG_LOCKCONTENTION" + CPPFLAGS="$CPPFLAGS -DDEBUG -DDEBUG_LOCKORDER" if test "x$GCC" = xyes; then CFLAGS="$CFLAGS -g3 -O0" fi diff --git a/src/.formatted-files b/src/.formatted-files index cc137d22..9be35e9c 100644 --- a/src/.formatted-files +++ b/src/.formatted-files @@ -159,6 +159,8 @@ support/pagelocker.cpp support/pagelocker.h sync.cpp sync.h +threaddeadlock.cpp +threaddeadlock.h threadgroup.h threadsafety.h timedata.cpp @@ -216,6 +218,12 @@ test/coins_tests.cpp test/compress_tests.cpp test/crypto_tests.cpp test/dbwrapper_tests.cpp +test/deadlock_tests/test1-4.cpp +test/deadlock_tests/test5.cpp +test/deadlock_tests/test6.cpp +test/deadlock_tests/test7.cpp +test/deadlock_tests/test8.cpp +test/deadlock_tests/suite.h test/DoS_tests.cpp test/exploit_tests.cpp test/getarg_tests.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 1a745dd2..07bbe07f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -135,6 +135,7 @@ BITCOIN_CORE_H = \ support/cleanse.h \ support/pagelocker.h \ sync.h \ + threaddeadlock.h \ threadgroup.h \ threadsafety.h \ timedata.h \ @@ -174,6 +175,7 @@ libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CP libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIC_FLAGS) $(PIE_FLAGS) libbitcoin_server_a_SOURCES = \ globals.cpp \ + threaddeadlock.cpp \ sync.cpp \ net/addrdb.cpp \ net/addrman.cpp \ diff --git a/src/Makefile.test.include b/src/Makefile.test.include index a0c8e7d4..08c48a29 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -67,6 +67,12 @@ BITCOIN_TESTS = \ test/compress_tests.cpp \ test/crypto_tests.cpp \ test/dbwrapper_tests.cpp \ + test/deadlock_tests/test1-4.cpp \ + test/deadlock_tests/test5.cpp \ + test/deadlock_tests/test6.cpp \ + test/deadlock_tests/test7.cpp \ + test/deadlock_tests/test8.cpp \ + test/deadlock_tests/suite.h \ test/getarg_tests.cpp \ test/jsonutil.h \ test/jsonutil.cpp \ diff --git a/src/coins.cpp b/src/coins.cpp index 05cd4d5f..9f95dd17 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -509,7 +509,7 @@ static const size_t nMaxOutputsPerBlock = CoinAccessor::CoinAccessor(const CCoinsViewCache &view, const uint256 &txid) : cache(&view), lock(cache->csCacheInsert) { - EnterCritical("CCoinsViewCache.cs_utxo", __FILE__, __LINE__, (void *)(&cache->cs_utxo)); + EnterCritical("CCoinsViewCache.cs_utxo", __FILE__, __LINE__, (void *)(&cache->cs_utxo), LockType::SHARED, false); cache->cs_utxo.lock_shared(); COutPoint iter(txid, 0); coin = &emptyCoin; @@ -528,7 +528,7 @@ CoinAccessor::CoinAccessor(const CCoinsViewCache &view, const uint256 &txid) : c CoinAccessor::CoinAccessor(const CCoinsViewCache &cacheObj, const COutPoint &output) : cache(&cacheObj), lock(cache->csCacheInsert) { - EnterCritical("CCoinsViewCache.cs_utxo", __FILE__, __LINE__, (void *)(&cache->cs_utxo)); + EnterCritical("CCoinsViewCache.cs_utxo", __FILE__, __LINE__, (void *)(&cache->cs_utxo), LockType::SHARED, false); cache->cs_utxo.lock_shared(); it = cache->FetchCoin(output, &lock); if (it != cache->cacheCoins.end()) @@ -541,13 +541,13 @@ CoinAccessor::~CoinAccessor() { coin = nullptr; cache->cs_utxo.unlock_shared(); - LeaveCritical(); + LeaveCritical(&cache->cs_utxo); } CoinModifier::CoinModifier(const CCoinsViewCache &cacheObj, const COutPoint &output) : cache(&cacheObj) { - EnterCritical("CCoinsViewCache.cs_utxo", __FILE__, __LINE__, (void *)(&cache->cs_utxo)); + EnterCritical("CCoinsViewCache.cs_utxo", __FILE__, __LINE__, (void *)(&cache->cs_utxo), LockType::SHARED, true); cache->cs_utxo.lock(); it = cache->FetchCoin(output, nullptr); if (it != cache->cacheCoins.end()) @@ -560,7 +560,7 @@ CoinModifier::~CoinModifier() { coin = nullptr; cache->cs_utxo.unlock(); - LeaveCritical(); + LeaveCritical(&cache->cs_utxo); } void AddCoins(CCoinsViewCache &cache, const CTransaction &tx, int nHeight) diff --git a/src/net/net.cpp b/src/net/net.cpp index fed44a3d..1853ebe8 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -1275,11 +1275,10 @@ void CConnman::ThreadSocketHandler() // handled without blocking here. bool select_recv = !pnode->fPauseRecv; - bool select_send; - { - LOCK(pnode->cs_vSend); - select_send = !pnode->vSendMsg.empty(); - } + bool select_send = false; + LOCK(pnode->cs_vSend); + select_send = !pnode->vSendMsg.empty(); + LOCK(pnode->cs_hSocket); if (pnode->hSocket == INVALID_SOCKET) diff --git a/src/net/nodestate.cpp b/src/net/nodestate.cpp index 8b17fc8c..549bee66 100644 --- a/src/net/nodestate.cpp +++ b/src/net/nodestate.cpp @@ -12,13 +12,13 @@ CNodeState *CNodesStateManager::_GetNodeState(const NodeId id) void CNodesStateManager::InitializeNodeState(const CNode *pnode) { - LOCK(cs); + LOCK(cs_main); mapNodeState.emplace_hint(mapNodeState.end(), std::piecewise_construct, std::forward_as_tuple(pnode->GetId()), std::forward_as_tuple(pnode->addr, pnode->GetAddrName())); } void CNodesStateManager::RemoveNodeState(const NodeId id) { - LOCK(cs); + LOCK(cs_main); mapNodeState.erase(id); } diff --git a/src/net/nodestate.h b/src/net/nodestate.h index 8e19dc94..845b1dfa 100644 --- a/src/net/nodestate.h +++ b/src/net/nodestate.h @@ -1,6 +1,8 @@ #include "messages.h" #include "net.h" +extern CCriticalSection cs_main; + /** * Maintain validation-specific state about nodes, protected by cs_main, instead * by CNode's own locks. This simplifies asynchronous operation, where @@ -82,7 +84,7 @@ struct CNodeState class CNodesStateManager { protected: - CCriticalSection cs; + // CCriticalSection cs; std::map mapNodeState; friend class CNodeStateAccessor; @@ -98,14 +100,16 @@ class CNodesStateManager /** Clear the entire nodestate map */ void Clear() { - LOCK(cs); + // LOCK(cs); + LOCK(cs_main); mapNodeState.clear(); } /** Is mapNodestate empty */ bool Empty() { - LOCK(cs); + // LOCK(cs); + LOCK(cs_main); return mapNodeState.empty(); } }; @@ -119,7 +123,8 @@ class CNodeStateAccessor CNodeStateAccessor(CCriticalSection *_cs, CNodeState *_obj) : cs(_cs), obj(_obj) { cs->lock(); } CNodeStateAccessor(CNodesStateManager &ns, const NodeId id) { - cs = &ns.cs; + // cs = &ns.cs; + cs = &cs_main; cs->lock(); obj = ns._GetNodeState(id); } diff --git a/src/sync.cpp b/src/sync.cpp index 43315588..048252c8 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -36,187 +36,19 @@ void PrintLockContention(const char *pszName, const char *pszFile, unsigned int #endif /* DEBUG_LOCKCONTENTION */ #ifdef DEBUG_LOCKORDER // this define covers the rest of the file -// -// Early deadlock detection. -// Problem being solved: -// Thread 1 locks A, then B, then C -// Thread 2 locks D, then C, then A -// --> may result in deadlock between the two threads, depending on when they run. -// Solution implemented here: -// Keep track of pairs of locks: (A before B), (A before C), etc. -// Complain if any thread tries to lock in a different order. -// -struct CLockLocation -{ - CLockLocation(const char *pszName, const char *pszFile, int nLine, bool fTryIn) - { - mutexName = pszName; - sourceFile = pszFile; - sourceLine = nLine; - fTry = fTryIn; - } - - std::string ToString() const - { - return mutexName + " " + sourceFile + ":" + itostr(sourceLine) + (fTry ? " (TRY)" : ""); - } - - bool GetTry() const { return fTry; } -private: - bool fTry; - std::string mutexName; - std::string sourceFile; - int sourceLine; -}; - -typedef std::vector > LockStack; -typedef std::map, LockStack> LockOrders; -typedef std::set > InvLockOrders; - -struct LockData -{ - // Very ugly hack: as the global constructs and destructors run single - // threaded, we use this boolean to know whether LockData still exists, - // as DeleteLock can get called by global CCriticalSection destructors - // after LockData disappears. - bool available; - LockData() : available(true) {} - ~LockData() { available = false; } - LockOrders lockorders; - InvLockOrders invlockorders; - std::mutex dd_mutex; -} static lockdata; - -static thread_local std::unique_ptr lockstack; - -static void potential_deadlock_detected(const std::pair &mismatch, - const LockStack &s1, - const LockStack &s2) -{ - // We attempt to not assert on probably-not deadlocks by assuming that - // a try lock will immediately have otherwise bailed if it had - // failed to get the lock - // We do this by, for the locks which triggered the potential deadlock, - // in either lockorder, checking that the second of the two which is locked - // is only a TRY_LOCK, ignoring locks if they are reentrant. - bool firstLocked = false; - bool secondLocked = false; - bool onlyMaybeDeadlock = false; - - LogPrintf("POTENTIAL DEADLOCK DETECTED\n"); - LogPrintf("Previous lock order was:\n"); - for (const PAIRTYPE(void *, CLockLocation) & i : s2) - { - if (i.first == mismatch.first) - { - LogPrintf(" (1)"); - if (!firstLocked && secondLocked && i.second.GetTry()) - onlyMaybeDeadlock = true; - firstLocked = true; - } - if (i.first == mismatch.second) - { - LogPrintf(" (2)"); - if (!secondLocked && firstLocked && i.second.GetTry()) - onlyMaybeDeadlock = true; - secondLocked = true; - } - LogPrintf(" %s\n", i.second.ToString()); - } - firstLocked = false; - secondLocked = false; - LogPrintf("Current lock order is:\n"); - for (const PAIRTYPE(void *, CLockLocation) & i : s1) - { - if (i.first == mismatch.first) - { - LogPrintf(" (1)"); - if (!firstLocked && secondLocked && i.second.GetTry()) - onlyMaybeDeadlock = true; - firstLocked = true; - } - if (i.first == mismatch.second) - { - LogPrintf(" (2)"); - if (!secondLocked && firstLocked && i.second.GetTry()) - onlyMaybeDeadlock = true; - secondLocked = true; - } - LogPrintf(" %s\n", i.second.ToString()); - } - assert(onlyMaybeDeadlock); -} - -static void push_lock(void *c, const CLockLocation &locklocation, bool fTry) -{ - if (lockstack.get() == nullptr) - lockstack.reset(new LockStack); - - std::lock_guard lock(lockdata.dd_mutex); - - (*lockstack).push_back(std::make_pair(c, locklocation)); - // If this is a blocking lock operation, we want to make sure that the locking order between 2 mutexes is consistent - // across the program - if (!fTry) - { - for (const PAIRTYPE(void *, CLockLocation) & i : (*lockstack)) - { - if (i.first == c) - break; - - std::pair p1 = std::make_pair(i.first, c); - // If this order has already been placed into the order map, we've already tested it - if (lockdata.lockorders.count(p1)) - continue; - lockdata.lockorders[p1] = (*lockstack); - // check to see if the opposite order has ever occurred, if so flag a possible deadlock - std::pair p2 = std::make_pair(c, i.first); - lockdata.invlockorders.insert(p2); - if (lockdata.lockorders.count(p2)) - potential_deadlock_detected(p1, lockdata.lockorders[p1], lockdata.lockorders[p2]); - } - } -} - -static void pop_lock() { (*lockstack).pop_back(); } -void EnterCritical(const char *pszName, const char *pszFile, unsigned int nLine, void *cs, bool fTry) -{ - push_lock(cs, CLockLocation(pszName, pszFile, nLine, fTry), fTry); -} - -void LeaveCritical() { pop_lock(); } -std::string LocksHeld() -{ - std::string result; - for (const PAIRTYPE(void *, CLockLocation) & i : *lockstack) - result += i.second.ToString() + std::string("\n"); - return result; -} - -void AssertLockHeldInternal(const char *pszName, const char *pszFile, unsigned int nLine, void *cs) -{ - for (const PAIRTYPE(void *, CLockLocation) & i : *lockstack) - if (i.first == cs) - return; - fprintf(stderr, "Assertion failed: lock %s not held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, - LocksHeld().c_str()); - abort(); -} - -void AssertLockNotHeldInternal(const char *pszName, const char *pszFile, unsigned int nLine, void *cs) +void EnterCritical(const char *pszName, + const char *pszFile, + unsigned int nLine, + void *cs, + LockType type, + bool isExclusive, + bool fTry) { - for (const std::pair &i : *lockstack) - { - if (i.first == cs) - { - fprintf(stderr, "Assertion failed: lock %s held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, - LocksHeld().c_str()); - abort(); - } - } + push_lock(cs, CLockLocation(pszName, pszFile, nLine, fTry, isExclusive), type, isExclusive, fTry); } +void LeaveCritical(void *cs) { remove_lock_critical_exit(cs); } void AssertWriteLockHeldInternal(const char *pszName, const char *pszFile, unsigned int nLine, @@ -274,8 +106,8 @@ CCriticalSection::~CCriticalSection() // BU normally CSharedCriticalSection is a typedef, but when lockorder debugging is on we need to delete the critical // section from the lockorder map -CSharedCriticalSection::CSharedCriticalSection() : name(NULL), exclusiveOwner(0) {} -CSharedCriticalSection::CSharedCriticalSection(const char *n) : name(n), exclusiveOwner(0) +CSharedCriticalSection::CSharedCriticalSection() : name(NULL) {} +CSharedCriticalSection::CSharedCriticalSection(const char *n) : name(n) { // print the address of named critical sections so they can be found in the mutrace output #ifdef ENABLE_MUTRACE @@ -300,107 +132,12 @@ CSharedCriticalSection::~CSharedCriticalSection() } -void CSharedCriticalSection::lock_shared() -{ - uint64_t tid = getTid(); - // detect recursive locking - { - std::unique_lock lock(setlock); - assert(exclusiveOwner != tid); - auto alreadyLocked = sharedowners.find(tid); - if (alreadyLocked != sharedowners.end()) - { - LockInfo li = alreadyLocked->second; - LogPrintf("already locked at %s:%d\n", li.file, li.line); - assert(alreadyLocked == sharedowners.end()); - } - sharedowners[tid] = LockInfo("", 0); - } - boost::shared_mutex::lock_shared(); -} - -void CSharedCriticalSection::unlock_shared() -{ - // detect recursive locking - uint64_t tid = getTid(); - { - std::unique_lock lock(setlock); - auto alreadyLocked = sharedowners.find(tid); - if (alreadyLocked == sharedowners.end()) - { - LockInfo li = alreadyLocked->second; - LogPrintf("never locked at %s:%d\n", li.file, li.line); - assert(alreadyLocked != sharedowners.end()); - } - sharedowners.erase(tid); - } - boost::shared_mutex::unlock_shared(); -} - -bool CSharedCriticalSection::try_lock_shared() -{ - // detect recursive locking - uint64_t tid = getTid(); - std::unique_lock lock(setlock); - assert(exclusiveOwner != tid); - assert(sharedowners.find(tid) == sharedowners.end()); - - bool result = boost::shared_mutex::try_lock_shared(); - if (result) - { - sharedowners[tid] = LockInfo("", 0); - } - return result; -} -void CSharedCriticalSection::lock() -{ - boost::shared_mutex::lock(); - exclusiveOwner = getTid(); -} -void CSharedCriticalSection::unlock() -{ - uint64_t tid = getTid(); - assert(exclusiveOwner == tid); - exclusiveOwner = 0; - boost::shared_mutex::unlock(); -} - -bool CSharedCriticalSection::try_lock() -{ - bool result = boost::shared_mutex::try_lock(); - if (result) - { - exclusiveOwner = getTid(); - } - return result; -} - -void DeleteLock(void *cs) -{ - if (!lockdata.available) - { - // We're already shutting down. - return; - } - - std::lock_guard lock(lockdata.dd_mutex); - std::pair item = std::make_pair(cs, nullptr); - LockOrders::iterator it = lockdata.lockorders.lower_bound(item); - while (it != lockdata.lockorders.end() && it->first.first == cs) - { - std::pair invitem = std::make_pair(it->first.second, it->first.first); - lockdata.invlockorders.erase(invitem); - lockdata.lockorders.erase(it++); - } - InvLockOrders::iterator invit = lockdata.invlockorders.lower_bound(item); - while (invit != lockdata.invlockorders.end() && invit->first == cs) - { - std::pair invinvitem = std::make_pair(invit->second, invit->first); - lockdata.lockorders.erase(invinvitem); - lockdata.invlockorders.erase(invit++); - } -} - +void CSharedCriticalSection::lock_shared() { boost::shared_mutex::lock_shared(); } +void CSharedCriticalSection::unlock_shared() { boost::shared_mutex::unlock_shared(); } +bool CSharedCriticalSection::try_lock_shared() { return boost::shared_mutex::try_lock_shared(); } +void CSharedCriticalSection::lock() { boost::shared_mutex::lock(); } +void CSharedCriticalSection::unlock() { boost::shared_mutex::unlock(); } +bool CSharedCriticalSection::try_lock() { return boost::shared_mutex::try_lock(); } CRecursiveSharedCriticalSection::CRecursiveSharedCriticalSection() : name(nullptr) {} CRecursiveSharedCriticalSection::CRecursiveSharedCriticalSection(const char *n) : name(n) { diff --git a/src/sync.h b/src/sync.h index 9ee26c31..91ce779d 100644 --- a/src/sync.h +++ b/src/sync.h @@ -8,6 +8,7 @@ #define BITCOIN_SYNC_H #include "recursive_shared_mutex.h" +#include "threaddeadlock.h" #include "threadsafety.h" #include "util/util.h" #include "util/utiltime.h" @@ -56,26 +57,6 @@ LEAVE_CRITICAL_SECTION(mutex); // no RAII // // /////////////////////////////// -#ifdef DEBUG_LOCKORDER -#include - -#ifdef __linux__ -inline uint64_t getTid(void) -{ - // "native" thread id used so the number correlates with what is shown in gdb - pid_t tid = (pid_t)syscall(SYS_gettid); - return tid; -} -#else -inline uint64_t getTid(void) -{ - uint64_t tid = boost::lexical_cast(boost::this_thread::get_id()); - return tid; -} -#endif - -#endif // DEBUG_LOCKORDER - /** * Template mixin that adds -Wthread-safety locking * annotations to a subset of the mutex API. @@ -158,19 +139,7 @@ typedef AnnotatedMixin CSharedCriticalSection; class CSharedCriticalSection : public AnnotatedMixin { public: - class LockInfo - { - public: - const char *file; - unsigned int line; - LockInfo() : file(""), line(0) {} - LockInfo(const char *f, unsigned int l) : file(f), line(l) {} - }; - - std::mutex setlock; - std::map sharedowners; const char *name; - uint64_t exclusiveOwner; CSharedCriticalSection(const char *name); CSharedCriticalSection(); ~CSharedCriticalSection(); @@ -250,9 +219,14 @@ typedef std::condition_variable CConditionVariable; typedef std::condition_variable_any CCond; #ifdef DEBUG_LOCKORDER -void EnterCritical(const char *pszName, const char *pszFile, unsigned int nLine, void *cs, bool fTry = false); -void LeaveCritical(); -void DeleteLock(void *cs); +void EnterCritical(const char *pszName, + const char *pszFile, + unsigned int nLine, + void *cs, + LockType type, + bool isExclusive, + bool fTry = false); +void LeaveCritical(void *cs); std::string LocksHeld(); /** Asserts in debug builds if a critical section is not held. */ void AssertLockHeldInternal(const char *pszName, const char *pszFile, unsigned int nLine, void *cs); @@ -271,10 +245,12 @@ void static inline EnterCritical(const char *pszName, const char *pszFile, unsigned int nLine, void *cs, + LockType type, + bool isExclusive, bool fTry = false) { } -void static inline LeaveCritical() {} +void static inline LeaveCritical(void *cs) {} void static inline DeleteLock(void *cs) {} void static inline AssertLockHeldInternal(const char *pszName, const char *pszFile, unsigned int nLine, void *cs) {} void static inline AssertLockNotHeldInternal(const char *pszName, const char *pszFile, unsigned int nLine, void *cs) {} @@ -317,7 +293,7 @@ class SCOPED_LOCKABLE CMutexLock const char *file = "unknown-file"; unsigned int line = 0; - void Enter(const char *pszName, const char *pszFile, unsigned int nLine) + void Enter(const char *pszName, const char *pszFile, unsigned int nLine, LockType type) { #ifdef DEBUG_LOCKTIME uint64_t startWait = GetStopwatch(); @@ -325,13 +301,14 @@ class SCOPED_LOCKABLE CMutexLock name = pszName; file = pszFile; line = nLine; - EnterCritical(pszName, pszFile, nLine, (void *)(lock.mutex())); + EnterCritical(pszName, pszFile, nLine, (void *)(lock.mutex()), type, true, false); #ifdef DEBUG_LOCKCONTENTION if (!lock.try_lock()) { PrintLockContention(pszName, pszFile, nLine); #endif lock.lock(); + SetWaitingToHeld((void *)(lock.mutex()), getTid(), true); #ifdef DEBUG_LOCKCONTENTION } #endif @@ -345,56 +322,69 @@ class SCOPED_LOCKABLE CMutexLock #endif } - bool TryEnter(const char *pszName, const char *pszFile, unsigned int nLine) + bool TryEnter(const char *pszName, const char *pszFile, unsigned int nLine, LockType type) { name = pszName; file = pszFile; line = nLine; - EnterCritical(pszName, pszFile, nLine, (void *)(lock.mutex()), true); + EnterCritical(pszName, pszFile, nLine, (void *)(lock.mutex()), type, true, true); lock.try_lock(); if (!lock.owns_lock()) { #ifdef DEBUG_LOCKTIME lockedTime = 0; #endif - LeaveCritical(); + LeaveCritical((void *)(lock.mutex())); } #ifdef DEBUG_LOCKTIME else lockedTime = GetStopwatch(); #endif - return lock.owns_lock(); + bool owned = lock.owns_lock(); + if (owned) + { + SetWaitingToHeld((void *)(lock.mutex()), getTid(), false); + } + return owned; } public: - CMutexLock(Mutex &mutexIn, const char *pszName, const char *pszFile, unsigned int nLine, bool fTry = false) - EXCLUSIVE_LOCK_FUNCTION(mutexIn) + CMutexLock(Mutex &mutexIn, + const char *pszName, + const char *pszFile, + unsigned int nLine, + LockType type, + bool fTry = false) EXCLUSIVE_LOCK_FUNCTION(mutexIn) : lock(mutexIn, std::defer_lock) { if (fTry) - TryEnter(pszName, pszFile, nLine); + TryEnter(pszName, pszFile, nLine, type); else - Enter(pszName, pszFile, nLine); + Enter(pszName, pszFile, nLine, type); } - CMutexLock(Mutex *pmutexIn, const char *pszName, const char *pszFile, unsigned int nLine, bool fTry = false) - EXCLUSIVE_LOCK_FUNCTION(pmutexIn) + CMutexLock(Mutex *pmutexIn, + const char *pszName, + const char *pszFile, + unsigned int nLine, + LockType type, + bool fTry = false) EXCLUSIVE_LOCK_FUNCTION(pmutexIn) { if (!pmutexIn) return; lock = std::unique_lock(*pmutexIn, std::defer_lock); if (fTry) - TryEnter(pszName, pszFile, nLine); + TryEnter(pszName, pszFile, nLine, type); else - Enter(pszName, pszFile, nLine); + Enter(pszName, pszFile, nLine, type); } ~CMutexLock() UNLOCK_FUNCTION() { if (lock.owns_lock()) { - LeaveCritical(); + LeaveCritical((void *)(lock.mutex())); #ifdef DEBUG_LOCKTIME uint64_t doneTime = GetStopwatch(); if (doneTime - lockedTime > LOCK_WARN_TIME) @@ -421,7 +411,7 @@ class SCOPED_LOCKABLE CMutexReadLock const char *file = "unknown-file"; unsigned int line = 0; - void Enter(const char *pszName, const char *pszFile, unsigned int nLine) + void Enter(const char *pszName, const char *pszFile, unsigned int nLine, LockType type) { #ifdef DEBUG_LOCKTIME uint64_t startWait = GetStopwatch(); @@ -429,7 +419,7 @@ class SCOPED_LOCKABLE CMutexReadLock name = pszName; file = pszFile; line = nLine; - EnterCritical(pszName, pszFile, nLine, (void *)(lock.mutex())); + EnterCritical(pszName, pszFile, nLine, (void *)(lock.mutex()), type, false, false); // LOG(LCK,"try ReadLock %p %s by %d\n", lock.mutex(), name ? name : "", boost::this_thread::get_id()); #ifdef DEBUG_LOCKCONTENTION if (!lock.try_lock()) @@ -437,6 +427,7 @@ class SCOPED_LOCKABLE CMutexReadLock PrintLockContention(pszName, pszFile, nLine); #endif lock.lock(); + SetWaitingToHeld((void *)(lock.mutex()), getTid(), false); #ifdef DEBUG_LOCKCONTENTION } #endif @@ -450,55 +441,68 @@ class SCOPED_LOCKABLE CMutexReadLock #endif } - bool TryEnter(const char *pszName, const char *pszFile, unsigned int nLine) + bool TryEnter(const char *pszName, const char *pszFile, unsigned int nLine, LockType type) { name = pszName; file = pszFile; line = nLine; - EnterCritical(pszName, pszFile, nLine, (void *)(lock.mutex()), true); + EnterCritical(pszName, pszFile, nLine, (void *)(lock.mutex()), type, false, true); if (!lock.try_lock()) { #ifdef DEBUG_LOCKTIME lockedTime = 0; #endif - LeaveCritical(); + LeaveCritical((void *)(lock.mutex())); } #ifdef DEBUG_LOCKTIME else lockedTime = GetStopwatch(); #endif - return lock.owns_lock(); + bool owned = lock.owns_lock(); + if (owned) + { + SetWaitingToHeld((void *)(lock.mutex()), getTid(), false); + } + return owned; } public: - CMutexReadLock(Mutex &mutexIn, const char *pszName, const char *pszFile, unsigned int nLine, bool fTry = false) - SHARED_LOCK_FUNCTION(mutexIn) + CMutexReadLock(Mutex &mutexIn, + const char *pszName, + const char *pszFile, + unsigned int nLine, + LockType type, + bool fTry = false) SHARED_LOCK_FUNCTION(mutexIn) : lock(mutexIn, std::defer_lock) { if (fTry) - TryEnter(pszName, pszFile, nLine); + TryEnter(pszName, pszFile, nLine, type); else - Enter(pszName, pszFile, nLine); + Enter(pszName, pszFile, nLine, type); } - CMutexReadLock(Mutex *pmutexIn, const char *pszName, const char *pszFile, unsigned int nLine, bool fTry = false) - SHARED_LOCK_FUNCTION(pmutexIn) + CMutexReadLock(Mutex *pmutexIn, + const char *pszName, + const char *pszFile, + unsigned int nLine, + LockType type, + bool fTry = false) SHARED_LOCK_FUNCTION(pmutexIn) { if (!pmutexIn) return; lock = boost::shared_lock(*pmutexIn, boost::defer_lock); if (fTry) - TryEnter(pszName, pszFile, nLine); + TryEnter(pszName, pszFile, nLine, type); else - Enter(pszName, pszFile, nLine); + Enter(pszName, pszFile, nLine, type); } ~CMutexReadLock() UNLOCK_FUNCTION() { if (lock.owns_lock()) { - LeaveCritical(); + LeaveCritical((void *)(lock.mutex())); #ifdef DEBUG_LOCKTIME int64_t doneTime = GetStopwatch(); if (doneTime - lockedTime > LOCK_WARN_TIME) @@ -516,40 +520,44 @@ class SCOPED_LOCKABLE CMutexReadLock typedef CMutexReadLock CRecursiveReadBlock; typedef CMutexLock CRecursiveWriteBlock; -#define RECURSIVEREADLOCK(cs) CRecursiveReadBlock UNIQUIFY(readblock)(cs, #cs, __FILE__, __LINE__) -#define RECURSIVEWRITELOCK(cs) CRecursiveWriteBlock UNIQUIFY(writeblock)(cs, #cs, __FILE__, __LINE__) -#define RECURSIVEREADLOCK2(cs1, cs2) \ - CRecursiveReadBlock UNIQUIFY(readblock1)(cs1, #cs1, __FILE__, __LINE__), \ - UNIQUIFY(readblock2)(cs2, #cs2, __FILE__, __LINE__) -#define TRY_READ_LOCK_RECURSIVE(cs, name) CRecursiveReadBlock name(cs, #cs, __FILE__, __LINE__, true) +#define RECURSIVEREADLOCK(cs) \ + CRecursiveReadBlock UNIQUIFY(readblock)(cs, #cs, __FILE__, __LINE__, LockType::RECRUSIVESHARED) +#define RECURSIVEWRITELOCK(cs) \ + CRecursiveWriteBlock UNIQUIFY(writeblock)(cs, #cs, __FILE__, __LINE__, LockType::RECRUSIVESHARED) +#define RECURSIVEREADLOCK2(cs1, cs2) \ + CRecursiveReadBlock UNIQUIFY(readblock1)(cs1, #cs1, __FILE__, __LINE__, LockType::RECRUSIVESHARED), \ + UNIQUIFY(readblock2)(cs2, #cs2, __FILE__, __LINE__, LockType::RECRUSIVESHARED) +#define TRY_READ_LOCK_RECURSIVE(cs, name) \ + CRecursiveReadBlock name(cs, #cs, __FILE__, __LINE__, LockType::RECRUSIVESHARED, true) typedef CMutexReadLock CReadBlock; typedef CMutexLock CWriteBlock; -#define READLOCK(cs) CReadBlock UNIQUIFY(readblock)(cs, #cs, __FILE__, __LINE__) -#define WRITELOCK(cs) CWriteBlock UNIQUIFY(writeblock)(cs, #cs, __FILE__, __LINE__) -#define READLOCK2(cs1, cs2) \ - CReadBlock UNIQUIFY(readblock1)(cs1, #cs1, __FILE__, __LINE__), UNIQUIFY(readblock2)(cs2, #cs2, __FILE__, __LINE__) -#define TRY_READ_LOCK(cs, name) CReadBlock name(cs, #cs, __FILE__, __LINE__, true) +#define READLOCK(cs) CReadBlock UNIQUIFY(readblock)(cs, #cs, __FILE__, __LINE__, LockType::SHARED) +#define WRITELOCK(cs) CWriteBlock UNIQUIFY(writeblock)(cs, #cs, __FILE__, __LINE__, LockType::SHARED) +#define READLOCK2(cs1, cs2) \ + CReadBlock UNIQUIFY(readblock1)(cs1, #cs1, __FILE__, __LINE__, LockType::SHARED), \ + UNIQUIFY(readblock2)(cs2, #cs2, __FILE__, __LINE__, LockType::SHARED) +#define TRY_READ_LOCK(cs, name) CReadBlock name(cs, #cs, __FILE__, __LINE__, LockType::SHARED, true) typedef CMutexLock CCriticalBlock; -#define LOCK(cs) CCriticalBlock UNIQUIFY(criticalblock)(cs, #cs, __FILE__, __LINE__) -#define LOCK2(cs1, cs2) \ - CCriticalBlock UNIQUIFY(criticalblock1)(cs1, #cs1, __FILE__, __LINE__), \ - UNIQUIFY(criticalblock2)(cs2, #cs2, __FILE__, __LINE__) -#define TRY_LOCK(cs, name) CCriticalBlock name(cs, #cs, __FILE__, __LINE__, true) +#define LOCK(cs) CCriticalBlock UNIQUIFY(criticalblock)(cs, #cs, __FILE__, __LINE__, LockType::RECURSIVE) +#define LOCK2(cs1, cs2) \ + CCriticalBlock UNIQUIFY(criticalblock1)(cs1, #cs1, __FILE__, __LINE__, LockType::RECURSIVE), \ + UNIQUIFY(criticalblock2)(cs2, #cs2, __FILE__, __LINE__, LockType::RECURSIVE) +#define TRY_LOCK(cs, name) CCriticalBlock name(cs, #cs, __FILE__, __LINE__, LockType::RECURSIVE, true) -#define ENTER_CRITICAL_SECTION(cs) \ - { \ - EnterCritical(#cs, __FILE__, __LINE__, (void *)(&cs)); \ - (cs).lock(); \ +#define ENTER_CRITICAL_SECTION(cs) \ + { \ + EnterCritical(#cs, __FILE__, __LINE__, (void *)(&cs), LockType::RECURSIVE, true); \ + (cs).lock(); \ } #define LEAVE_CRITICAL_SECTION(cs) \ { \ (cs).unlock(); \ - LeaveCritical(); \ + LeaveCritical(&cs); \ } class CSemaphore diff --git a/src/test/deadlock_tests/suite.h b/src/test/deadlock_tests/suite.h new file mode 100644 index 00000000..7a87ba49 --- /dev/null +++ b/src/test/deadlock_tests/suite.h @@ -0,0 +1,20 @@ +// Copyright (c) 2019 Greg Griffith +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include "sync.h" + +#include "test/test_bitcoin.h" + +struct EmptySuite +{ + EmptySuite() + { + ECC_Start(); + SetupEnvironment(); + SetupNetworking(); + g_logger->fPrintToDebugLog = false; // don't want to write to debug.log file + } + + ~EmptySuite() { ECC_Stop(); } +}; diff --git a/src/test/deadlock_tests/test1-4.cpp b/src/test/deadlock_tests/test1-4.cpp new file mode 100644 index 00000000..b8ebc183 --- /dev/null +++ b/src/test/deadlock_tests/test1-4.cpp @@ -0,0 +1,55 @@ +// Copyright (c) 2019 Greg Griffith +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include + +#include "suite.h" + +#include +#include +#include +#include +#include + +#include +#include + +BOOST_FIXTURE_TEST_SUITE(self_deadlock_tests, EmptySuite) + +BOOST_AUTO_TEST_CASE(TEST_1_SM) +{ + CSharedCriticalSection shared_mutex; + READLOCK(shared_mutex); + BOOST_CHECK_THROW(WRITELOCK(shared_mutex), std::logic_error); +} + +BOOST_AUTO_TEST_CASE(TEST_1_RSM) +{ + CRecursiveSharedCriticalSection rsm; + RECURSIVEREADLOCK(rsm); + BOOST_CHECK_THROW(RECURSIVEWRITELOCK(rsm), std::logic_error); +} + +BOOST_AUTO_TEST_CASE(TEST_2) +{ + CSharedCriticalSection shared_mutex; + WRITELOCK(shared_mutex); + BOOST_CHECK_THROW(READLOCK(shared_mutex), std::logic_error); +} + +BOOST_AUTO_TEST_CASE(TEST_3) +{ + CSharedCriticalSection shared_mutex; + READLOCK(shared_mutex); + BOOST_CHECK_THROW(READLOCK(shared_mutex), std::logic_error); +} + +BOOST_AUTO_TEST_CASE(TEST_4) +{ + CSharedCriticalSection shared_mutex; + WRITELOCK(shared_mutex); + BOOST_CHECK_THROW(WRITELOCK(shared_mutex), std::logic_error); +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/deadlock_tests/test5.cpp b/src/test/deadlock_tests/test5.cpp new file mode 100644 index 00000000..e2accc46 --- /dev/null +++ b/src/test/deadlock_tests/test5.cpp @@ -0,0 +1,48 @@ +// Copyright (c) 2019 Greg Griffith +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include + +#include "suite.h" + +#include +#include +#include +#include +#include + +#include +#include +#include + +BOOST_FIXTURE_TEST_SUITE(test5, EmptySuite) + +CSharedCriticalSection mutexA; +CSharedCriticalSection mutexB; + +void Thread1() +{ + WRITELOCK(mutexA); + MilliSleep(100); + READLOCK(mutexB); +} + +void Thread2() +{ + MilliSleep(50); + WRITELOCK(mutexB); + MilliSleep(100); + BOOST_CHECK_THROW(READLOCK(mutexA), std::logic_error); +} + + +BOOST_AUTO_TEST_CASE(TEST_5) +{ + std::thread thread1(Thread1); + std::thread thread2(Thread2); + thread1.join(); + thread2.join(); +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/deadlock_tests/test6.cpp b/src/test/deadlock_tests/test6.cpp new file mode 100644 index 00000000..f4586d6d --- /dev/null +++ b/src/test/deadlock_tests/test6.cpp @@ -0,0 +1,48 @@ +// Copyright (c) 2019 Greg Griffith +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include + +#include "suite.h" + +#include +#include +#include +#include +#include + +#include +#include +#include + +BOOST_FIXTURE_TEST_SUITE(test6, EmptySuite) + +CSharedCriticalSection mutexA; +CSharedCriticalSection mutexB; + +void Thread1() +{ + READLOCK(mutexA); + MilliSleep(100); + READLOCK(mutexB); +} + +void Thread2() +{ + MilliSleep(50); + WRITELOCK(mutexB); + MilliSleep(100); + BOOST_CHECK_THROW(WRITELOCK(mutexA), std::logic_error); +} + + +BOOST_AUTO_TEST_CASE(TEST_6) +{ + std::thread thread1(Thread1); + std::thread thread2(Thread2); + thread1.join(); + thread2.join(); +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/deadlock_tests/test7.cpp b/src/test/deadlock_tests/test7.cpp new file mode 100644 index 00000000..108fda3b --- /dev/null +++ b/src/test/deadlock_tests/test7.cpp @@ -0,0 +1,61 @@ +// Copyright (c) 2019 Greg Griffith +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include + +#include "suite.h" + +#include +#include +#include +#include +#include + +#include +#include +#include + +BOOST_FIXTURE_TEST_SUITE(test7, EmptySuite) + +CSharedCriticalSection mutexA; +CSharedCriticalSection mutexB; +CSharedCriticalSection mutexC; + +void Thread1() +{ + READLOCK(mutexA); // 1 + MilliSleep(150); + WRITELOCK(mutexB); // 4 + MilliSleep(1000); +} + +void Thread2() +{ + MilliSleep(50); + READLOCK(mutexB); // 2 + MilliSleep(150); + WRITELOCK(mutexC); // 5 + MilliSleep(1000); +} + +void Thread3() +{ + MilliSleep(100); + READLOCK(mutexC); // 3 + MilliSleep(150); + BOOST_CHECK_THROW(WRITELOCK(mutexA), std::logic_error); // 6 +} + + +BOOST_AUTO_TEST_CASE(TEST_7) +{ + std::thread thread1(Thread1); + std::thread thread2(Thread2); + std::thread thread3(Thread3); + thread1.join(); + thread2.join(); + thread3.join(); +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/deadlock_tests/test8.cpp b/src/test/deadlock_tests/test8.cpp new file mode 100644 index 00000000..b35d399a --- /dev/null +++ b/src/test/deadlock_tests/test8.cpp @@ -0,0 +1,61 @@ +// Copyright (c) 2019 Greg Griffith +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include + +#include "suite.h" + +#include +#include +#include +#include +#include + +#include +#include +#include + +BOOST_FIXTURE_TEST_SUITE(test8, EmptySuite) + +CSharedCriticalSection mutexA; +CSharedCriticalSection mutexB; +CSharedCriticalSection mutexC; + +void Thread1() +{ + WRITELOCK(mutexA); // 1 + MilliSleep(150); + READLOCK(mutexB); // 4 + MilliSleep(1000); +} + +void Thread2() +{ + MilliSleep(50); + WRITELOCK(mutexB); // 2 + MilliSleep(150); + READLOCK(mutexC); // 5 + MilliSleep(1000); +} + +void Thread3() +{ + MilliSleep(100); + WRITELOCK(mutexC); // 3 + MilliSleep(150); + BOOST_CHECK_THROW(READLOCK(mutexA), std::logic_error); // 6 +} + + +BOOST_AUTO_TEST_CASE(TEST_8) +{ + std::thread thread1(Thread1); + std::thread thread2(Thread2); + std::thread thread3(Thread3); + thread1.join(); + thread2.join(); + thread3.join(); +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/src/threaddeadlock.cpp b/src/threaddeadlock.cpp new file mode 100644 index 00000000..50302afd --- /dev/null +++ b/src/threaddeadlock.cpp @@ -0,0 +1,764 @@ +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2015 The Bitcoin Core developers +// Copyright (c) 2015-2019 The Bitcoin Unlimited developers +// Copyright (c) 2019 Greg Griffith +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include "threaddeadlock.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "util/logger.h" +#include "util/util.h" + +#ifdef DEBUG_LOCKORDER // covers the entire file + +// pair ( cs : lock location ) +typedef std::pair LockStackEntry; +typedef std::vector LockStack; + +// cs : set of thread ids +typedef std::map > ReadLocksHeld; +// cs : set of thread ids +typedef std::map > WriteLocksHeld; + +// cs : set of thread ids +typedef std::map > ReadLocksWaiting; +// cs : set of thread ids +typedef std::map > WriteLocksWaiting; + +// thread id : vector of locks held (both shared and exclusive, waiting and held) +typedef std::map LocksHeldByThread; + + +struct LockData +{ + // Very ugly hack: as the global constructs and destructors run single + // threaded, we use this boolean to know whether LockData still exists, + // as DeleteLock can get called by global CCriticalSection destructors + // after LockData disappears. + bool available; + LockData() : available(true) {} + ~LockData() { available = false; } + ReadLocksWaiting readlockswaiting; + WriteLocksWaiting writelockswaiting; + + ReadLocksHeld readlocksheld; + WriteLocksHeld writelocksheld; + LocksHeldByThread locksheldbythread; + std::mutex dd_mutex; +} static lockdata; + +void potential_deadlock_detected(LockStackEntry now, LockStack &deadlocks, std::set &threads) +{ + LogPrintf("POTENTIAL DEADLOCK DETECTED\n"); + LogPrintf("This occurred while trying to lock: %s ", now.second.ToString().c_str()); + LogPrintf("which has:\n"); + + auto rlw = lockdata.readlockswaiting.find(now.first); + if (rlw != lockdata.readlockswaiting.end()) + { + for (auto &entry : rlw->second) + { + LogPrintf("Read Lock Waiting for thread with id %" PRIu64 "\n", entry); + } + } + + auto wlw = lockdata.writelockswaiting.find(now.first); + if (wlw != lockdata.writelockswaiting.end()) + { + for (auto &entry : wlw->second) + { + LogPrintf("Write Lock Waiting for thread with id %" PRIu64 "\n", entry); + } + } + + auto rlh = lockdata.readlocksheld.find(now.first); + if (rlh != lockdata.readlocksheld.end()) + { + for (auto &entry : rlh->second) + { + LogPrintf("Read Lock Held for thread with id %" PRIu64 "\n", entry); + } + } + + auto wlh = lockdata.writelocksheld.find(now.first); + if (wlh != lockdata.writelocksheld.end()) + { + for (auto &entry : wlh->second) + { + LogPrintf("Write Lock Held for thread with id %" PRIu64 "\n", entry); + } + } + + LogPrintf("\nThe locks involved are:\n"); + for (auto &lock : deadlocks) + { + LogPrintf(" %s\n", lock.second.ToString().c_str()); + } + for (auto &thread : threads) + { + LogPrintf("\nThread with tid %" PRIu64 " was involved. It held locks:\n", thread); + auto iterheld = lockdata.locksheldbythread.find(thread); + if (iterheld != lockdata.locksheldbythread.end()) + { + for (auto &lockentry : iterheld->second) + { + LogPrintf(" %s\n", lockentry.second.ToString().c_str()); + } + } + } + // clean up the lock before throwing + _remove_lock_critical_exit(now.first); + throw std::logic_error("potential deadlock detected"); +} + +static bool ReadRecursiveCheck(const uint64_t &tid, + const void *c, + uint64_t lastTid, + void *lastLock, + bool firstRun, + LockStack &deadlocks, + std::set &threads) +{ + if (!firstRun && c == lastLock && tid == lastTid) + { + // we are back where we started, infinite loop means there is a deadlock + return true; + } + // first check if we currently have any exclusive ownerships + bool haveExclusives = false; + size_t selfOtherLockCount = 0; + auto self_iter = lockdata.locksheldbythread.find(lastTid); + if (self_iter != lockdata.locksheldbythread.end()) + { + selfOtherLockCount = self_iter->second.size(); + for (auto &lockStackLock : self_iter->second) + { + if (lockStackLock.second.GetExclusive() == true) + { + haveExclusives = true; + break; + } + } + } + // we cant deadlock if we dont own any other mutexs + if (selfOtherLockCount == 0) + { + return false; + } + // at this point we have at least 1 lock for a mutex somewhere + + // if we do not have any exclusive locks and we arent requesting an exclusive lock... + if (!haveExclusives) + { + // then we cant block + return false; + } + + // check if a thread has an ownership of c + auto writeiter = lockdata.writelocksheld.find(lastLock); + + // NOTE: be careful when adjusting these booleans, the order of the checks is important + bool writeIsEnd = ((writeiter == lockdata.writelocksheld.end()) || writeiter->second.empty()); + if (writeIsEnd) + { + // no exclusive owners, no deadlock possible + return false; + } + + // we have other locks, so check if we have any in common with the holder(s) of the write lock + for (auto &threadId : writeiter->second) + { + if (threadId == lastTid) + { + continue; + } + auto other_iter = lockdata.locksheldbythread.find(threadId); + // we dont need to check empty here, other thread has at least 1 lock otherwise we wouldnt be checking it + if (other_iter->second.size() == 1) + { + // it does not have any locks aside from known exclusive, no deadlock possible + // we can just wait until that exclusive lock is released + return false; + } + // if the other thread has 1+ other locks aside from the known exclusive, check them for matches with our own + // locks + for (auto &lock : other_iter->second) + { + // if they have a lock that is on a lock that we have exclusive ownership for + if (HasAnyOwners(lock.first)) + { + // and their lock is waiting... + if (lock.second.GetWaiting() == true) + { + deadlocks.push_back(lock); + threads.emplace(other_iter->first); + if (other_iter->first == tid && lock.first == c) + { + // we are back where we started and there is a deadlock + return true; + } + if (ReadRecursiveCheck(tid, c, other_iter->first, lock.first, false, deadlocks, threads)) + { + return true; + } + } + // no deadlock, other lock is not waiting, we simply have to wait until they release that lock + } + } + } + return false; +} + +static bool WriteRecursiveCheck(const uint64_t &tid, + const void *c, + uint64_t lastTid, + void *lastLock, + bool firstRun, + LockStack &deadlocks, + std::set &threads) +{ + if (!firstRun && c == lastLock && tid == lastTid) + { + // we are back where we started, infinite loop means there is a deadlock + return true; + } + // first check if we currently have any exclusive ownerships + size_t selfOtherLockCount = 0; + auto self_iter = lockdata.locksheldbythread.find(lastTid); + if (self_iter != lockdata.locksheldbythread.end() && self_iter->second.empty() == false) + { + selfOtherLockCount = self_iter->second.size(); + } + // we cant deadlock if we dont own any other mutexs + if (selfOtherLockCount == 0) + { + return false; + } + // at this point we have at least 1 lock for a mutex somewhere + + // check if a thread has an ownership of c + auto writeiter = lockdata.writelocksheld.find(lastLock); + auto readiter = lockdata.readlocksheld.find(lastLock); + + // NOTE: be careful when adjusting these booleans, the order of the checks is important + bool readIsEnd = ((readiter == lockdata.readlocksheld.end()) || readiter->second.empty()); + bool writeIsEnd = ((writeiter == lockdata.writelocksheld.end()) || writeiter->second.empty()); + if (writeIsEnd && readIsEnd) + { + // no owners, no deadlock possible + return false; + } + // we have other locks, so check if we have any in common with the holder(s) of the other lock + std::set otherLocks; + if (!writeIsEnd) + { + otherLocks.insert(writeiter->second.begin(), writeiter->second.end()); + } + if (!readIsEnd) + { + otherLocks.insert(readiter->second.begin(), readiter->second.end()); + } + for (auto &threadId : otherLocks) + { + if (threadId == lastTid) + { + continue; + } + auto other_iter = lockdata.locksheldbythread.find(threadId); + // we dont need to check empty here, other thread has at least 1 lock otherwise we wouldnt be checking it + if (other_iter->second.size() == 1) + { + // it does not have any locks aside from known exclusive, no deadlock possible + // we can just wait until that exclusive lock is released + return false; + } + // if the other thread has 1+ other locks aside from the known exclusive, check them for matches with our own + // locks + for (auto &lock : other_iter->second) + { + // if they have a lock that is on a lock that someone has a lock on + if (HasAnyOwners(lock.first)) + { + // and their lock is waiting... + if (lock.second.GetWaiting() == true) + { + deadlocks.push_back(lock); + threads.emplace(other_iter->first); + if (other_iter->first == tid && lock.first == c) + { + // we are back where we started and there is a deadlock + return true; + } + if (WriteRecursiveCheck(tid, c, other_iter->first, lock.first, false, deadlocks, threads)) + { + return true; + } + } + // no deadlock, other lock is not waiting, we simply have to wait until they release that lock + } + } + } + return false; +} + +// for recrusive locking issues with a non recrusive mutex +static void self_deadlock_detected(LockStackEntry now, LockStackEntry previous) +{ + LogPrintf("SELF DEADLOCK DETECTED FOR SHARED MUTEX\n"); + LogPrintf("Previous lock was: %s\n", previous.second.ToString()); + LogPrintf("Current lock is: %s\n", now.second.ToString()); + throw std::logic_error("self_deadlock_detected"); +} + +bool HasAnyOwners(void *c) +{ + auto iter = lockdata.writelocksheld.find(c); + if (iter != lockdata.writelocksheld.end()) + { + if (!iter->second.empty()) + { + return true; + } + } + + auto iter2 = lockdata.readlocksheld.find(c); + if (iter2 != lockdata.readlocksheld.end()) + { + if (!iter2->second.empty()) + { + return true; + } + } + + return false; +} + +void AddNewLock(LockStackEntry &newEntry, const uint64_t &tid) +{ + auto it = lockdata.locksheldbythread.find(tid); + if (it == lockdata.locksheldbythread.end()) + { + LockStack newLockStack; + newLockStack.push_back(newEntry); + lockdata.locksheldbythread.emplace(tid, newLockStack); + } + else + { + it->second.push_back(newEntry); + } +} + +void AddNewWaitingLock(void *c, const uint64_t &tid, bool &isExclusive) +{ + if (isExclusive) + { + auto it = lockdata.writelockswaiting.find(c); + if (it == lockdata.writelockswaiting.end()) + { + std::set holders; + holders.emplace(tid); + lockdata.writelockswaiting.emplace(c, holders); + } + else + { + it->second.emplace(tid); + } + } + else // !isExclusive + { + auto it = lockdata.readlockswaiting.find(c); + if (it == lockdata.readlockswaiting.end()) + { + std::set holders; + holders.emplace(tid); + lockdata.readlockswaiting.emplace(c, holders); + } + else + { + it->second.emplace(tid); + } + } +} + +void SetWaitingToHeld(void *c, const uint64_t &tid, bool isExclusive) +{ + if (isExclusive) + { + auto it = lockdata.writelockswaiting.find(c); + if (it == lockdata.writelockswaiting.end()) + { + return; + } + else + { + it->second.erase(tid); + auto iter = lockdata.writelocksheld.find(c); + if (iter == lockdata.writelocksheld.end()) + { + std::set holders; + holders.emplace(tid); + lockdata.writelocksheld.emplace(c, holders); + } + else + { + iter->second.emplace(tid); + } + } + } + else // !isExclusive + { + auto it = lockdata.readlockswaiting.find(c); + if (it == lockdata.readlockswaiting.end()) + { + return; + } + else + { + it->second.erase(tid); + auto iter = lockdata.readlocksheld.find(c); + if (iter == lockdata.readlocksheld.end()) + { + std::set holders; + holders.emplace(tid); + lockdata.readlocksheld.emplace(c, holders); + } + else + { + iter->second.emplace(tid); + } + } + } + + auto itheld = lockdata.locksheldbythread.find(tid); + if (itheld != lockdata.locksheldbythread.end()) + { + for (auto rit = itheld->second.rbegin(); rit != itheld->second.rend(); ++rit) + { + if (rit->first == c) + { + rit->second.ChangeWaitingToHeld(); + break; + } + } + } +} + +// c = the cs +// isExclusive = is the current lock exclusive, for a recursive mutex (CCriticalSection) this value should always be +// true +void push_lock(void *c, const CLockLocation &locklocation, LockType type, bool isExclusive, bool fTry) +{ + std::lock_guard lock(lockdata.dd_mutex); + + LockStackEntry now = std::make_pair(c, locklocation); + // tid of the originating request + const uint64_t tid = getTid(); + // If this is a blocking lock operation, we want to make sure that the locking order between 2 mutexes is consistent + // across the program + if (fTry) + { + // a try lock will either get it, or it wont. so just add it. + // if we dont get the lock this will be undone in destructor + AddNewLock(now, tid); + // AddNewWaitingLock(c, tid, isExclusive); + return; + } + // first check lock specific issues + if (type == LockType::SHARED) + { + TEST_1_SM: + TEST_2: + TEST_3: + TEST_4: + // shared mutexs cant recursively lock at all, check if we already have a lock on the mutex + auto it = lockdata.locksheldbythread.find(tid); + if (it == lockdata.locksheldbythread.end() || it->second.empty()) + { + // intentionally left blank + } + else + { + for (auto &lockStackLock : it->second) + { + // if it is c we are recursively locking a non recursive mutex, there is a deadlock + if (lockStackLock.first == c) + { + self_deadlock_detected(now, lockStackLock); + } + } + } + } + else if (type == LockType::RECRUSIVESHARED) + { + TEST_1_RSM: + // we cannot lock exclusive if we already hold shared, check for this scenario + if (isExclusive) + { + auto it = lockdata.locksheldbythread.find(tid); + if (it == lockdata.locksheldbythread.end() || it->second.empty()) + { + // intentionally left blank + } + else + { + for (auto &lockStackLock : it->second) + { + // if we have a lock and it isnt exclusive and we are attempting to get exclusive + // then we will deadlock ourself + if (lockStackLock.first == c && lockStackLock.second.GetExclusive() == false) + { + self_deadlock_detected(now, lockStackLock); + } + } + } + } + else + { + // intentionally left blank + } + } + else if (type == LockType::RECURSIVE) + { + // this lock can not deadlock itself + // intentionally left blank + } + + // Begin general deadlock checks for all lock types + AddNewLock(now, tid); + AddNewWaitingLock(c, tid, isExclusive); + + // if we have exclusive lock(s) and we arent requesting an exclusive lock... + if (!isExclusive) + { + TEST_5: + TEST_8: + std::vector deadlocks; + std::set threads; + // then we can only deadlock if we are locking a thread that is currently held in exclusive state by someone + // else + if (ReadRecursiveCheck(tid, c, tid, c, true, deadlocks, threads)) + { + // we have a deadlock where we are requesting shared ownership on a mutex that is exclusively owned by + // another thread which has either a shared or exlcusive request on a mutex we have exclusive ownership over + potential_deadlock_detected(now, deadlocks, threads); + } + } + // if we have exclusive lock(s) and we are requesting another exclusive lock + if (isExclusive) + { + TEST_6: + TEST_7: + TEST_9: + std::vector deadlocks; + std::set threads; + if (WriteRecursiveCheck(tid, c, tid, c, true, deadlocks, threads)) + { + potential_deadlock_detected(now, deadlocks, threads); + } + } +} + +// remove removes 1 instance of the lock, delete removes all instances + +void DeleteLock(void *cs) +{ + // remove all instances of the critical section from lockdata + std::lock_guard lock(lockdata.dd_mutex); + if (!lockdata.available) + { + // lockdata was already deleted + return; + } + if (lockdata.readlockswaiting.count(cs)) + lockdata.readlockswaiting.erase(cs); + if (lockdata.writelockswaiting.count(cs)) + lockdata.writelockswaiting.erase(cs); + if (lockdata.readlocksheld.count(cs)) + lockdata.readlocksheld.erase(cs); + if (lockdata.writelocksheld.count(cs)) + lockdata.writelocksheld.erase(cs); + for (auto &iter : lockdata.locksheldbythread) + { + LockStack newStack; + for (auto &iter2 : iter.second) + { + if (iter2.first != cs) + { + newStack.emplace_back(std::make_pair(iter2.first, iter2.second)); + } + } + std::swap(iter.second, newStack); + } +} + +void _remove_lock_critical_exit(void *cs) +{ + if (!lockdata.available) + { + // lockdata was already deleted + return; + } + uint64_t tid = getTid(); + bool isExclusive = false; + bool fTry = false; + auto it = lockdata.locksheldbythread.find(tid); + if (it == lockdata.locksheldbythread.end()) + { + throw std::logic_error("unlocking non-existant lock"); + } + else + { + if (it->second.back().first != cs) + { + LogPrintf("got %s but was not expecting it\n", it->second.back().second.ToString().c_str()); + throw std::logic_error("unlock order inconsistant with lock order"); + } + isExclusive = it->second.back().second.GetExclusive(); + fTry = it->second.back().second.GetTry(); + it->second.pop_back(); + } + // remove from the other maps + if (isExclusive) + { + if (fTry) + { + auto iter = lockdata.writelockswaiting.find(cs); + if (iter != lockdata.writelockswaiting.end()) + { + if (iter->second.empty()) + return; + if (iter->second.count(tid) != 0) + { + iter->second.erase(tid); + } + } + } + else + { + auto iter = lockdata.writelocksheld.find(cs); + if (iter != lockdata.writelocksheld.end()) + { + if (iter->second.empty()) + return; + if (iter->second.count(tid) != 0) + { + iter->second.erase(tid); + } + } + } + } + else // !isExclusive + { + if (fTry) + { + auto iter = lockdata.readlockswaiting.find(cs); + if (iter != lockdata.readlockswaiting.end()) + { + if (iter->second.empty()) + return; + if (iter->second.count(tid) != 0) + { + iter->second.erase(tid); + } + } + } + else + { + auto iter = lockdata.readlocksheld.find(cs); + if (iter != lockdata.readlocksheld.end()) + { + if (iter->second.empty()) + return; + if (iter->second.count(tid) != 0) + { + iter->second.erase(tid); + } + } + } + } +} + +void remove_lock_critical_exit(void *cs) +{ + // assuming we unlock in the reverse order of locks, we can simply pop back + std::lock_guard lock(lockdata.dd_mutex); + _remove_lock_critical_exit(cs); +} + +std::string _LocksHeld() +{ + std::string result; + uint64_t tid = getTid(); + auto self_iter = lockdata.locksheldbythread.find(tid); + if (self_iter != lockdata.locksheldbythread.end()) + { + for (auto &entry : self_iter->second) + { + result += entry.second.ToString() + std::string("\n"); + } + } + return result; +} + +std::string LocksHeld() +{ + std::lock_guard lock(lockdata.dd_mutex); + return _LocksHeld(); +} + +void AssertLockHeldInternal(const char *pszName, const char *pszFile, unsigned int nLine, void *cs) +{ + std::lock_guard lock(lockdata.dd_mutex); + uint64_t tid = getTid(); + auto self_iter = lockdata.locksheldbythread.find(tid); + if (self_iter == lockdata.locksheldbythread.end()) + { + return; + } + if (self_iter->second.empty()) + { + return; + } + for (auto &entry : self_iter->second) + { + if (entry.first == cs) + { + // found the lock so return + return; + } + } + fprintf(stderr, "Assertion failed: lock %s not held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, + _LocksHeld().c_str()); + abort(); +} + +void AssertLockNotHeldInternal(const char *pszName, const char *pszFile, unsigned int nLine, void *cs) +{ + std::lock_guard lock(lockdata.dd_mutex); + uint64_t tid = getTid(); + auto self_iter = lockdata.locksheldbythread.find(tid); + if (self_iter != lockdata.locksheldbythread.end() && self_iter->second.empty() == false) + { + for (auto &entry : self_iter->second) + { + if (entry.first == cs) + { + fprintf(stderr, "Assertion failed: lock %s held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, + _LocksHeld().c_str()); + abort(); + } + } + } +} + +#endif // DEBUG_LOCKORDER diff --git a/src/threaddeadlock.h b/src/threaddeadlock.h new file mode 100644 index 00000000..e38d356d --- /dev/null +++ b/src/threaddeadlock.h @@ -0,0 +1,87 @@ +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2015 The Bitcoin Core developers +// Copyright (c) 2015-2019 The Bitcoin Unlimited developers +// Copyright (c) 2019 Greg Griffith +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef ECCOIN_THREAD_DEADLOCK_H +#define ECCOIN_THREAD_DEADLOCK_H + +#include + +#include "util/utilstrencodings.h" + +enum LockType +{ + RECURSIVE, // CCriticalSection + SHARED, // CSharedCriticalSection + RECRUSIVESHARED, // CRecursiveSharedCriticalSection +}; + +#include +#include // for syscall definition + +#ifdef __linux__ +inline uint64_t getTid(void) +{ + // "native" thread id used so the number correlates with what is shown in gdb + pid_t tid = (pid_t)syscall(SYS_gettid); + return tid; +} +#else +inline uint64_t getTid(void) +{ + uint64_t tid = boost::lexical_cast(boost::this_thread::get_id()); + return tid; +} +#endif + +#ifdef DEBUG_LOCKORDER // covers the entire file + +struct CLockLocation +{ + CLockLocation(const char *pszName, const char *pszFile, int nLine, bool fTryIn, bool fExclusiveIn) + { + mutexName = pszName; + sourceFile = pszFile; + sourceLine = nLine; + fTry = fTryIn; + fExclusive = fExclusiveIn; + fWaiting = true; + } + + std::string ToString() const + { + return mutexName + " " + sourceFile + ":" + itostr(sourceLine) + (fTry ? " (TRY)" : "") + + (fExclusive ? " (EXCLUSIVE)" : "") + (fWaiting ? " (WAITING)" : ""); + } + + bool GetTry() const { return fTry; } + bool GetExclusive() const { return fExclusive; } + bool GetWaiting() const { return fWaiting; } + void ChangeWaitingToHeld() { fWaiting = false; } +private: + bool fTry; + std::string mutexName; + std::string sourceFile; + int sourceLine; + bool fExclusive; // signifies Exclusive Ownership, this is always true for a CCriticalSection + bool fWaiting; // determines if lock is held or is waiting to be held +}; + +void push_lock(void *c, const CLockLocation &locklocation, LockType type, bool isExclusive, bool fTry); +void DeleteLock(void *cs); +void _remove_lock_critical_exit(void *cs); +void remove_lock_critical_exit(void *cs); +std::string LocksHeld(); +void SetWaitingToHeld(void *c, const uint64_t &tid, bool isExclusive); +bool HasAnyOwners(void *c); + +#else // NOT DEBUG_LOCKORDER + +static inline void SetWaitingToHeld(void *c, const uint64_t &tid, bool isExclusive) {} + +#endif // END DEBUG_LOCKORDER + +#endif diff --git a/src/util/logger.cpp b/src/util/logger.cpp index f8d85422..88371f20 100644 --- a/src/util/logger.cpp +++ b/src/util/logger.cpp @@ -50,10 +50,10 @@ int CLogger::FileWriteStr(const std::string &str, FILE *fp) void CLogger::OpenDebugLog() { - std::lock_guard scoped_lock(mutexDebugLog); + fs::path pathDebug = GetDataDir() / "debug.log"; + std::lock_guard scoped_lock(mutexDebugLog); assert(fileout == nullptr); - fs::path pathDebug = GetDataDir() / "debug.log"; fileout = fopen(pathDebug.string().c_str(), "a"); if (fileout) setbuf(fileout, nullptr); // unbuffered diff --git a/src/util/util.cpp b/src/util/util.cpp index 6bb3e10c..e3b6b284 100644 --- a/src/util/util.cpp +++ b/src/util/util.cpp @@ -213,13 +213,13 @@ fs::path GetDefaultDataDir() static fs::path pathCached; static fs::path pathCachedNetSpecific; -static CCriticalSection csPathCached; +static std::mutex csPathCached; const fs::path &GetDataDir(bool fNetSpecific) { namespace fs = boost::filesystem; - LOCK(csPathCached); + std::lock_guard lock(csPathCached); fs::path &path = fNetSpecific ? pathCachedNetSpecific : pathCached; From 8123cff8193d3c2389bbc3196a290d04632ee4f3 Mon Sep 17 00:00:00 2001 From: Griffith <8345264+Greg-Griffith@users.noreply.github.com> Date: Tue, 6 Aug 2019 12:11:44 -0700 Subject: [PATCH 6/8] refactor locking part4 (#233) * add debug_lockorder define for sys/syscall.h inclusion * add new openssl methods, hackfix for old openssl mutex array segfault * minor cleanup, call getTid internally so non debug builds dont need it * remove lockcontention code * fix locktime print statements * fix csharedcriticalsection default constructor, fix formatting * add critical section to protect CNode::vRecvGetData * remove msg checksum checking, it is not needed, tcp does this for us * rework some nodestate logic to reduce amount of time the locks are held * dont use cs_main for nodestateman anymore * add more sync points to verifydb.py and walletbackup.py * remove unused rpc post command * add missing return in create transaction * remove unnecessary lock on cs_mapblockindex * move lockidbstate outside of isInitialBlockDownload and make it atomic * remove CSharedUnlocker * add defines to deadlock tests so they only run when debugging lockorder * move some global variables to globals.cpp * move lock assertion functions to sync.cpp * add missing lock in SetWaitingToHeld * add missing lock in getnexttargetrequired * add missing writelocks needed for editing mapblockindex * remove bench print statements * formatting fixes * tweak wallet.py node connection method * temp disable walletbackup due to issue with restarting nodes mid test * add more syncpoints to lisstransactions.py --- qa/pull-tester/rpc-tests.py | 2 +- qa/rpc-tests/listtransactions.py | 8 +- qa/rpc-tests/verifydb.py | 16 +++ qa/rpc-tests/wallet.py | 2 +- qa/rpc-tests/walletbackup.py | 7 +- src/args.cpp | 6 +- src/chain/chainman.cpp | 5 +- src/globals.cpp | 48 +++++++- src/init.cpp | 6 +- src/main.cpp | 10 +- src/net/messages.cpp | 175 +++++++++++++++------------- src/net/messages.h | 2 +- src/net/net.cpp | 8 +- src/net/net.h | 1 + src/net/netbase.cpp | 6 +- src/net/nodestate.cpp | 4 +- src/net/nodestate.h | 23 ++-- src/processblock.cpp | 96 ++++----------- src/rpc/rpcserver.cpp | 16 +-- src/rpc/rpcserver.h | 1 - src/rpc/rpcwallet.cpp | 4 +- src/sync.cpp | 88 ++++++++------ src/sync.h | 105 ++++------------- src/test/deadlock_tests/test1-4.cpp | 8 ++ src/test/deadlock_tests/test5.cpp | 8 ++ src/test/deadlock_tests/test6.cpp | 8 ++ src/test/deadlock_tests/test7.cpp | 8 ++ src/test/deadlock_tests/test8.cpp | 8 ++ src/threaddeadlock.cpp | 93 ++------------- src/threaddeadlock.h | 50 +++++++- src/timedata.cpp | 4 +- src/util/util.cpp | 29 ++++- src/validationinterface.h | 4 +- src/wallet/wallet.cpp | 1 + src/wallet/walletdb.cpp | 3 + 35 files changed, 428 insertions(+), 435 deletions(-) diff --git a/qa/pull-tester/rpc-tests.py b/qa/pull-tester/rpc-tests.py index f4854b86..11dfc782 100755 --- a/qa/pull-tester/rpc-tests.py +++ b/qa/pull-tester/rpc-tests.py @@ -197,7 +197,7 @@ def option_passed(option_without_dashes): 'txpropagate', 'verifydb', 'wallet', - 'walletbackup', + Disabled('walletbackup', "TIMEOUT"), # issue with restarting nodes mid test 'zapwallettxes', # Disabled('mempool_limit', "FAILS"), diff --git a/qa/rpc-tests/listtransactions.py b/qa/rpc-tests/listtransactions.py index 9c25b4d0..dfb6019a 100755 --- a/qa/rpc-tests/listtransactions.py +++ b/qa/rpc-tests/listtransactions.py @@ -36,9 +36,13 @@ def setup_network(self, split=False): self.sync_all() def run_test(self): - self.nodes[0].generate(100) + for i in range (4): + self.nodes[0].generate(25) + self.sync_all() self.sync_all() - self.nodes[1].generate(100) + for i in range (4): + self.nodes[1].generate(25) + self.sync_all() self.sync_all() # Simple send, 0 to 1: txid = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.1) diff --git a/qa/rpc-tests/verifydb.py b/qa/rpc-tests/verifydb.py index a0693013..c68a6e29 100755 --- a/qa/rpc-tests/verifydb.py +++ b/qa/rpc-tests/verifydb.py @@ -54,31 +54,45 @@ def run_test (self): j = randint(1, 5) for k in range(j): self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1) + if i % 10 == 0: + self.sync_all() self.sync_all() + #get to 500 blocks for i in range (100): self.nodes[0].generate(1) j = randint(1, 5) for k in range(j): self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 1) + if i % 50 == 0: + self.sync_all() self.sync_all() + for i in range (100): self.nodes[1].generate(1) j = randint(1, 5) for k in range(j): self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1) + if i % 50 == 0: + self.sync_all() self.sync_all() + for i in range (100): self.nodes[0].generate(1) j = randint(1, 5) for k in range(j): self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 1) + if i % 50 == 0: + self.sync_all() self.sync_all() + for i in range (100): self.nodes[1].generate(1) j = randint(1, 5) for k in range(j): self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1) + if i % 50 == 0: + self.sync_all() self.sync_all() #pos blocks for i in range (100): @@ -86,6 +100,8 @@ def run_test (self): j = randint(1, 5) for k in range(j): self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1) + if i % 10 == 0: + self.sync_all() self.sync_all() #stop the nodes diff --git a/qa/rpc-tests/wallet.py b/qa/rpc-tests/wallet.py index 9cacbdd0..e84b6f96 100755 --- a/qa/rpc-tests/wallet.py +++ b/qa/rpc-tests/wallet.py @@ -186,7 +186,7 @@ def run_test (self): sync_mempools(self.nodes) self.nodes.append(start_node(3, self.options.tmpdir, ['-usehd=0'])) - connect_nodes_bi(self.nodes, 0, 3) + interconnect_nodes(self.nodes) sync_blocks(self.nodes) relayed = self.nodes[0].resendwallettransactions() diff --git a/qa/rpc-tests/walletbackup.py b/qa/rpc-tests/walletbackup.py index 2a9000fc..619acf96 100755 --- a/qa/rpc-tests/walletbackup.py +++ b/qa/rpc-tests/walletbackup.py @@ -49,7 +49,7 @@ def setup_chain(self): # This mirrors how the network was setup in the bash test def setup_network(self, split=False): # nodes 1, 2,3 are spenders, let's give them a keypool=100 - extra_args = [["-keypool=100"], ["-keypool=100"], ["-keypool=100"], []] + extra_args = [["-keypool=100", "-debug=net"], ["-keypool=100", "-debug=net"], ["-keypool=100", "-debug=net"], []] self.nodes = start_nodes(4, self.options.tmpdir, extra_args) connect_nodes(self.nodes[0], 3) connect_nodes(self.nodes[1], 3) @@ -135,7 +135,10 @@ def run_test(self): self.do_one_round() # Generate 101 more blocks, so any fees paid mature - self.nodes[3].generate(101) + self.nodes[3].generate(1) + self.sync_all() + for i in range(4): + self.nodes[3].generate(25) self.sync_all() balance0 = self.nodes[0].getbalance() diff --git a/src/args.cpp b/src/args.cpp index 6ce2a967..33574851 100644 --- a/src/args.cpp +++ b/src/args.cpp @@ -219,9 +219,9 @@ void CArgsManager::ForceSetArg(const std::string &strArg, const std::string &str mapMultiArgs[strArg].push_back(strValue); } -static fs::path pathCached; -static fs::path pathCachedNetSpecific; -static CCriticalSection csPathCached; +extern fs::path pathCached; +extern fs::path pathCachedNetSpecific; +extern CCriticalSection csPathCached; fs::path CArgsManager::GetConfigFile() { diff --git a/src/chain/chainman.cpp b/src/chain/chainman.cpp index 3294ec69..b98afb5c 100644 --- a/src/chain/chainman.cpp +++ b/src/chain/chainman.cpp @@ -94,15 +94,15 @@ CBlockIndex *CChainManager::FindForkInGlobalIndex(const CChain &chain, const CBl return chain.Genesis(); } +static std::atomic lockIBDState{false}; + bool CChainManager::IsInitialBlockDownload() { - RECURSIVEREADLOCK(cs_mapBlockIndex); const CNetworkTemplate &chainParams = pnetMan->getActivePaymentNetwork(); if (fImporting || fReindex) return true; if (fCheckpointsEnabled && chainActive.Height() < Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints())) return true; - static bool lockIBDState = false; if (lockIBDState) return false; bool state = (chainActive.Height() < pindexBestHeader.load()->nHeight - 24 * 6 || @@ -151,6 +151,7 @@ bool CChainManager::InitBlockIndex(const CNetworkTemplate &chainparams) { try { + RECURSIVEWRITELOCK(pnetMan->getChainActive()->cs_mapBlockIndex); CBlock block = chainparams.GenesisBlock(); // Start new block file unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION); diff --git a/src/globals.cpp b/src/globals.cpp index 3ea8217e..8b26e833 100644 --- a/src/globals.cpp +++ b/src/globals.cpp @@ -3,10 +3,16 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "coins.h" +#include "fs.h" #include "main.h" -#include "sync.h" +#include "net/messages.h" +#include "threaddeadlock.h" #include "txdb.h" +#include "wallet/wallet.h" +#ifdef DEBUG_LOCKORDER +LockData lockdata; +#endif /** * Global state @@ -15,6 +21,17 @@ CCriticalSection cs_main; CCriticalSection cs_orphans; CCriticalSection cs_blockstorage; +CCriticalSection cs_mapRelay; + +/** + * Every received block is assigned a unique and increasing identifier, so we + * know which one to give priority in case of a fork. + */ +CCriticalSection cs_nBlockSequenceId; +CCriticalSection cs_LastBlockFile; + +CCriticalSection cs_nTimeOffset; +int64_t nTimeOffset = 0; /** Global variable that points to the active CCoinsView */ std::unique_ptr pcoinsTip GUARDED_BY(cs_main); @@ -28,3 +45,32 @@ std::unique_ptr pblocktree GUARDED_BY(cs_main); * missing the data for the block. */ std::set setBlockIndexCandidates GUARDED_BY(cs_main); + +CCriticalSection cs_mapLocalHost; +std::map mapLocalHost; +// Connection Slot mitigation - used to determine how many connection attempts over time +CCriticalSection cs_mapInboundConnectionTracker; +std::map mapInboundConnectionTracker; + +CCriticalSection cs_proxyInfos; +proxyType proxyInfo[NET_MAX]; +proxyType nameProxy; + +CCriticalSection cs_rpcWarmup; +bool fRPCRunning = false; +bool fRPCInWarmup = true; +std::string rpcWarmupStatus("RPC server started"); + +CCriticalSection cs_nWalletUnlockTime; +int64_t nWalletUnlockTime; + +CCriticalSection csPathCached; +fs::path pathCached; +fs::path pathCachedNetSpecific; + + + +CWallet *pwalletMain = nullptr; +CNetworkManager *pnetMan = nullptr; +std::unique_ptr g_connman; +std::unique_ptr peerLogic; diff --git a/src/init.cpp b/src/init.cpp index 39072139..98b62622 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -78,11 +78,7 @@ static CZMQNotificationInterface *pzmqNotificationInterface = nullptr; #endif -CWallet *pwalletMain = nullptr; -CNetworkManager *pnetMan = nullptr; - -std::unique_ptr g_connman; -std::unique_ptr peerLogic; +extern std::unique_ptr peerLogic; bool fFeeEstimatesInitialized = false; static const bool DEFAULT_PROXYRANDOMIZE = true; diff --git a/src/main.cpp b/src/main.cpp index dcdec8a4..a7086dc4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -114,16 +114,11 @@ CBlockIndex *pindexBestInvalid; */ std::multimap mapBlocksUnlinked; -CCriticalSection cs_LastBlockFile; +extern CCriticalSection cs_nBlockSequenceId; +extern CCriticalSection cs_LastBlockFile; std::vector vinfoBlockFile; int nLastBlockFile = 0; -/** - * Every received block is assigned a unique and increasing identifier, so we - * know which one to give priority in case of a fork. - */ -CCriticalSection cs_nBlockSequenceId; - /** Blocks loaded from disk are assigned id 0, so start the counter at 1. */ uint32_t nBlockSequenceId = 1; @@ -1563,6 +1558,7 @@ const CBlockIndex *GetLastBlockIndex(const CBlockIndex *pindex, bool fProofOfSta unsigned int GetNextTargetRequired(const CBlockIndex *pindexLast, bool fProofOfStake) { + RECURSIVEREADLOCK(pnetMan->getChainActive()->cs_mapBlockIndex); arith_uint256 bnTargetLimit = UintToArith256(pnetMan->getActivePaymentNetwork()->GetConsensus().powLimit); if (fProofOfStake) diff --git a/src/net/messages.cpp b/src/net/messages.cpp index 5d0c6dfb..69fb6d87 100644 --- a/src/net/messages.cpp +++ b/src/net/messages.cpp @@ -84,7 +84,7 @@ std::map::iterator> > mapBlock cs_main); uint256 hashRecentRejectsChainTip; std::map > mapBlockSource; -CCriticalSection cs_mapRelay; +extern CCriticalSection cs_mapRelay; std::map mapRelay; std::deque::iterator> > vRelayExpiration; @@ -276,7 +276,7 @@ bool MarkBlockAsReceived(const uint256 &hash) /** Find the last common ancestor two blocks have. * Both pa and pb must be non-NULL. */ -const CBlockIndex *LastCommonAncestor(const CBlockIndex *pa, const CBlockIndex *pb) +CBlockIndex *LastCommonAncestor(CBlockIndex *pa, CBlockIndex *pb) { if (pa->nHeight > pb->nHeight) { @@ -553,8 +553,8 @@ void FindNextBlocksToDownload(NodeId nodeid, if (state->pindexLastCommonBlock == state->pindexBestKnownBlock) return; - std::vector vToFetch; - const CBlockIndex *pindexWalk = state->pindexLastCommonBlock; + std::vector vToFetch; + CBlockIndex *pindexWalk = state->pindexLastCommonBlock; // Never fetch further than the best block we know the peer has, or more than BLOCK_DOWNLOAD_WINDOW + 1 beyond the // last // linked block we have in common with this peer. The +1 is so we can detect stalling, namely if we would be able to @@ -580,7 +580,7 @@ void FindNextBlocksToDownload(NodeId nodeid, // are not yet downloaded and not in flight to vBlocks. In the mean time, update // pindexLastCommonBlock as long as all ancestors are already downloaded, or if it's // already part of our chain (and therefore don't need it even if pruned). - for (const CBlockIndex *pindex : vToFetch) + for (CBlockIndex *pindex : vToFetch) { if (!pindex->IsValid(BLOCK_VALID_TREE)) { @@ -622,7 +622,7 @@ void FindNextBlocksToDownload(NodeId nodeid, } } -bool PeerHasHeader(CNodeState *state, const CBlockIndex *pindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main) +bool PeerHasHeader(const CNodeState *state, const CBlockIndex *pindex) { if (state->pindexBestKnownBlock && pindex == state->pindexBestKnownBlock->GetAncestor(pindex->nHeight)) { @@ -699,7 +699,7 @@ PeerLogicValidation::PeerLogicValidation(CConnman *connmanIn) : connman(connmanI recentRejects.reset(new CRollingBloomFilter(120000, 0.000001)); } -void PeerLogicValidation::NewPoWValidBlock(const CBlockIndex *pindex, const CBlock *pblock) +void PeerLogicValidation::NewPoWValidBlock(CBlockIndex *pindex, const CBlock *pblock) { LOCK(cs_main); static int nHighestFastAnnounce = 0; @@ -1363,9 +1363,11 @@ bool static ProcessMessage(CNode *pfrom, { LogPrintf("received getdata for: %s peer=%d\n", vInv[0].ToString(), pfrom->id); } - - pfrom->vRecvGetData.insert(pfrom->vRecvGetData.end(), vInv.begin(), vInv.end()); - ProcessGetData(pfrom, connman, chainparams.GetConsensus()); + { + LOCK(pfrom->csRecvGetData); + pfrom->vRecvGetData.insert(pfrom->vRecvGetData.end(), vInv.begin(), vInv.end()); + ProcessGetData(pfrom, connman, chainparams.GetConsensus()); + } } else if (strCommand == NetMsgType::GETHEADERS) @@ -2058,9 +2060,12 @@ bool ProcessMessages(CNode *pfrom, CConnman &connman) // bool fMoreWork = false; - if (!pfrom->vRecvGetData.empty()) { - ProcessGetData(pfrom, connman, pnetMan->getActivePaymentNetwork()->GetConsensus()); + TRY_LOCK(pfrom->csRecvGetData, locked); + if (locked && !pfrom->vRecvGetData.empty()) + { + ProcessGetData(pfrom, connman, pnetMan->getActivePaymentNetwork()->GetConsensus()); + } } if (pfrom->fDisconnect) @@ -2068,12 +2073,6 @@ bool ProcessMessages(CNode *pfrom, CConnman &connman) return false; } - // this maintains the order of responses - if (!pfrom->vRecvGetData.empty()) - { - return true; - } - // Don't bother if send buffer is too full to respond anyway if (pfrom->fPauseSend) { @@ -2121,19 +2120,27 @@ bool ProcessMessages(CNode *pfrom, CConnman &connman) // Checksum CDataStream &vRecv = msg.vRecv; const uint256 &hash = msg.GetMessageHash(); - if (memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) != 0) - { - LogPrintf("%s(%s, %u bytes): CHECKSUM ERROR expected %s was %s\n", __func__, SanitizeString(strCommand), - nMessageSize, HexStr(hash.begin(), hash.begin() + CMessageHeader::CHECKSUM_SIZE), - HexStr(hdr.pchChecksum, hdr.pchChecksum + CMessageHeader::CHECKSUM_SIZE)); - return fMoreWork; - } + + +#if 0 // Do not waste my CPU calculating a checksum provided by an untrusted node + // TCP already has one that is sufficient for network errors. The checksum does not increase security since + // an attacker can always provide a bad message with a good checksum. + // This code is removed by comment so it is clear that it is a deliberate omission. + if (memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) != 0) + { + LogPrintf("%s(%s, %u bytes): CHECKSUM ERROR expected %s was %s\n", __func__, SanitizeString(strCommand), + nMessageSize, HexStr(hash.begin(), hash.begin() + CMessageHeader::CHECKSUM_SIZE), + HexStr(hdr.pchChecksum, hdr.pchChecksum + CMessageHeader::CHECKSUM_SIZE)); + return fMoreWork; + } +#endif // Process message bool fRet = false; try { fRet = ProcessMessage(pfrom, strCommand, vRecv, msg.nTime, connman); + LOCK(pfrom->csRecvGetData); if (!pfrom->vRecvGetData.empty()) { fMoreWork = true; @@ -2227,10 +2234,15 @@ bool SendMessages(CNode *pto, CConnman &connman) return true; } - CNodeStateAccessor nodestate(nodestateman, pto->GetId()); - if (nodestate.IsNull()) + CNodeState statem(CAddress(), ""); + const CNodeState *state = &statem; { - return true; + CNodeStateAccessor stateAccess(nodestateman, pto->GetId()); + if (state == nullptr) + { + return true; + } + statem = *stateAccess; } // Address refresh broadcast @@ -2284,14 +2296,15 @@ bool SendMessages(CNode *pto, CConnman &connman) // Download if this is a nice peer, or we have no nice peers and this one // might do. - bool fFetch = nodestate->fPreferredDownload || (nPreferredDownload.load() == 0 && !pto->fOneShot); + bool fFetch = state->fPreferredDownload || (nPreferredDownload.load() == 0 && !pto->fOneShot); - if (!nodestate->fSyncStarted && !pto->fClient && !fImporting && !fReindex) + if (!state->fSyncStarted && !pto->fClient && !fImporting && !fReindex) { if (fFetch || pnetMan->getChainActive()->pindexBestHeader.load()->GetBlockTime() > GetAdjustedTime() - 24 * 60 * 60) { - nodestate->fSyncStarted = true; + CNodeStateAccessor modableState(nodestateman, pto->GetId()); + modableState->fSyncStarted = true; const CBlockIndex *pindexStart = pnetMan->getChainActive()->pindexBestHeader; /** * If possible, start at the block preceding the currently best @@ -2332,7 +2345,7 @@ bool SendMessages(CNode *pto, CConnman &connman) // or if the peer doesn't want headers, just add all to the inv queue. LOCK(pto->cs_inventory); std::vector vHeaders; - bool fRevertToInv = ((!nodestate->fPreferHeaders && (pto->vBlockHashesToAnnounce.size() > 1)) || + bool fRevertToInv = ((!state->fPreferHeaders && (pto->vBlockHashesToAnnounce.size() > 1)) || pto->vBlockHashesToAnnounce.size() > MAX_BLOCKS_TO_ANNOUNCE); // last header queued for delivery CBlockIndex *pBestIndex = nullptr; @@ -2348,7 +2361,10 @@ bool SendMessages(CNode *pto, CConnman &connman) for (const uint256 &hash : pto->vBlockHashesToAnnounce) { CBlockIndex *pindex = pnetMan->getChainActive()->LookupBlockIndex(hash); - assert(pindex); + if (!pindex) + { + continue; + } if (pnetMan->getChainActive()->chainActive[pindex->nHeight] != pindex) { // Bail out if we reorged away from this block @@ -2375,12 +2391,12 @@ bool SendMessages(CNode *pto, CConnman &connman) // add this to the headers message vHeaders.push_back(pindex->GetBlockHeader()); } - else if (PeerHasHeader(nodestate.Get(), pindex)) + else if (PeerHasHeader(state, pindex)) { // Keep looking for the first new block. continue; } - else if (pindex->pprev == nullptr || PeerHasHeader(nodestate.Get(), pindex->pprev)) + else if (pindex->pprev == nullptr || PeerHasHeader(state, pindex->pprev)) { // Peer doesn't have this header but they do have the prior // one. @@ -2397,28 +2413,6 @@ bool SendMessages(CNode *pto, CConnman &connman) } } } - if (!fRevertToInv && !vHeaders.empty()) - { - if (nodestate->fPreferHeaders) - { - if (vHeaders.size() > 1) - { - LogPrint("net", "%s: %u headers, range (%s, %s), to peer=%d\n", __func__, vHeaders.size(), - vHeaders.front().GetHash().ToString(), vHeaders.back().GetHash().ToString(), pto->id); - } - else - { - LogPrint("net", "%s: sending header %s to peer=%d\n", __func__, - vHeaders.front().GetHash().ToString(), pto->id); - } - connman.PushMessage(pto, NetMsgType::HEADERS, vHeaders); - nodestate->pindexBestHeaderSent = pBestIndex; - } - else - { - fRevertToInv = true; - } - } if (fRevertToInv) { // If falling back to using an inv, just try to inv the tip. The @@ -2426,27 +2420,49 @@ bool SendMessages(CNode *pto, CConnman &connman) // the past. if (!pto->vBlockHashesToAnnounce.empty()) { - const uint256 &hashToAnnounce = pto->vBlockHashesToAnnounce.back(); - CBlockIndex *pindex = pnetMan->getChainActive()->LookupBlockIndex(hashToAnnounce); - assert(pindex); - - // Warn if we're announcing a block that is not on the main - // chain. This should be very rare and could be optimized out. - // Just log for now. - if (pnetMan->getChainActive()->chainActive[pindex->nHeight] != pindex) + for (const uint256 &hashToAnnounce : pto->vBlockHashesToAnnounce) { - LogPrint("net", "Announcing block %s not on main chain (tip=%s)\n", hashToAnnounce.ToString(), - pnetMan->getChainActive()->chainActive.Tip()->GetBlockHash().ToString()); - } + CBlockIndex *pindex = nullptr; + pindex = pnetMan->getChainActive()->LookupBlockIndex(hashToAnnounce); + if (!pindex) + { + continue; + } - // If the peer's chain has this block, don't inv it back. - if (!PeerHasHeader(nodestate.Get(), pindex)) - { - pto->PushInventory(CInv(MSG_BLOCK, hashToAnnounce)); - LogPrint("net", "%s: sending inv peer=%d hash=%s\n", __func__, pto->id, hashToAnnounce.ToString()); + // Warn if we're announcing a block that is not on the main + // chain. This should be very rare and could be optimized out. + // Just log for now. + if (pnetMan->getChainActive()->chainActive[pindex->nHeight] != pindex) + { + LogPrint("net", "Announcing block %s not on main chain (tip=%s)\n", hashToAnnounce.ToString(), + pnetMan->getChainActive()->chainActive.Tip()->GetBlockHash().ToString()); + } + + // If the peer's chain has this block, don't inv it back. + if (!PeerHasHeader(state, pindex)) + { + pto->PushInventory(CInv(MSG_BLOCK, hashToAnnounce)); + LogPrint( + "net", "%s: sending inv peer=%d hash=%s\n", __func__, pto->id, hashToAnnounce.ToString()); + } } } } + else if (!vHeaders.empty()) + { + if (vHeaders.size() > 1) + { + LogPrint("net", "%s: %u headers, range (%s, %s), to peer=%d\n", __func__, vHeaders.size(), + vHeaders.front().GetHash().ToString(), vHeaders.back().GetHash().ToString(), pto->id); + } + else + { + LogPrint("net", "%s: sending header %s to peer=%d\n", __func__, vHeaders.front().GetHash().ToString(), + pto->id); + } + connman.PushMessage(pto, NetMsgType::HEADERS, vHeaders); + CNodeStateAccessor(nodestateman, pto->GetId())->pindexBestHeaderSent = pBestIndex; + } pto->vBlockHashesToAnnounce.clear(); } @@ -2549,17 +2565,16 @@ bool SendMessages(CNode *pto, CConnman &connman) // downstream link being saturated. We only count validated in-flight blocks // so peers can't advertise non-existing block hashes to unreasonably // increase our timeout. - if (nodestate->vBlocksInFlight.size() > 0) + if (state->vBlocksInFlight.size() > 0) { int64_t targetSpacing = consensusParams.nTargetSpacing; if (pnetMan->getChainActive()->chainActive.Tip()->GetMedianTimePast() > SERVICE_UPGRADE_HARDFORK) { targetSpacing = 150; } - const QueuedBlock &queuedBlock = nodestate->vBlocksInFlight.front(); - int nOtherPeersWithValidatedDownloads = - nPeersWithValidatedDownloads - (nodestate->nBlocksInFlightValidHeaders > 0); - if (nNow > nodestate->nDownloadingSince + + const QueuedBlock &queuedBlock = state->vBlocksInFlight.front(); + int nOtherPeersWithValidatedDownloads = nPeersWithValidatedDownloads - (state->nBlocksInFlightValidHeaders > 0); + if (nNow > state->nDownloadingSince + targetSpacing * (BLOCK_DOWNLOAD_TIMEOUT_BASE + BLOCK_DOWNLOAD_TIMEOUT_PER_PEER * nOtherPeersWithValidatedDownloads)) { @@ -2577,12 +2592,12 @@ bool SendMessages(CNode *pto, CConnman &connman) // Message: getdata (blocks) // if (!pto->fClient && (fFetch || !pnetMan->getChainActive()->IsInitialBlockDownload()) && - nodestate->nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER) + state->nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER) { std::vector vToDownload; NodeId staller = -1; FindNextBlocksToDownload( - pto->GetId(), MAX_BLOCKS_IN_TRANSIT_PER_PEER - nodestate->nBlocksInFlight, vToDownload, staller); + pto->GetId(), MAX_BLOCKS_IN_TRANSIT_PER_PEER - state->nBlocksInFlight, vToDownload, staller); for (const CBlockIndex *pindex : vToDownload) { uint32_t nFetchFlags = GetFetchFlags(pto, pindex->pprev, consensusParams); diff --git a/src/net/messages.h b/src/net/messages.h index 9f24c9a6..f0bb7e4c 100644 --- a/src/net/messages.h +++ b/src/net/messages.h @@ -62,7 +62,7 @@ class PeerLogicValidation : public CValidationInterface public: PeerLogicValidation(CConnman *connmanIn); - void NewPoWValidBlock(const CBlockIndex *pindex, const CBlock *pblock) override; + void NewPoWValidBlock(CBlockIndex *pindex, const CBlock *pblock) override; }; struct CNodeStateStats diff --git a/src/net/net.cpp b/src/net/net.cpp index 1853ebe8..0e6dae32 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -86,8 +86,8 @@ static const uint64_t RANDOMIZER_ID_LOCALHOSTNONCE = 0xd93e69e2bbfa5735ULL; bool fDiscover = true; bool fListen = true; bool fRelayTxes = true; -CCriticalSection cs_mapLocalHost; -std::map mapLocalHost; +extern CCriticalSection cs_mapLocalHost; +extern std::map mapLocalHost; static bool vfLimited[NET_MAX] = {}; limitedmap mapAlreadyAskedFor(MAX_INV_SZ); @@ -95,8 +95,8 @@ limitedmap mapAlreadyAskedFor(MAX_INV_SZ); std::string strSubVersion; // Connection Slot mitigation - used to determine how many connection attempts over time -CCriticalSection cs_mapInboundConnectionTracker; -std::map mapInboundConnectionTracker; +extern CCriticalSection cs_mapInboundConnectionTracker; +extern std::map mapInboundConnectionTracker; // Signals for message handling static CNodeSignals g_signals; diff --git a/src/net/net.h b/src/net/net.h index d8271364..08c23c69 100644 --- a/src/net/net.h +++ b/src/net/net.h @@ -214,6 +214,7 @@ class CNode CCriticalSection cs_sendProcessing; + CCriticalSection csRecvGetData; std::deque vRecvGetData; uint64_t nRecvBytes; std::atomic nRecvVersion; diff --git a/src/net/netbase.cpp b/src/net/netbase.cpp index 4309bde6..7acce903 100644 --- a/src/net/netbase.cpp +++ b/src/net/netbase.cpp @@ -54,9 +54,9 @@ #endif // Settings -static proxyType proxyInfo[NET_MAX]; -static proxyType nameProxy; -static CCriticalSection cs_proxyInfos; +extern proxyType proxyInfo[NET_MAX]; +extern proxyType nameProxy; +extern CCriticalSection cs_proxyInfos; int nConnectTimeout = DEFAULT_CONNECT_TIMEOUT; bool fNameLookup = DEFAULT_NAME_LOOKUP; diff --git a/src/net/nodestate.cpp b/src/net/nodestate.cpp index 549bee66..8b17fc8c 100644 --- a/src/net/nodestate.cpp +++ b/src/net/nodestate.cpp @@ -12,13 +12,13 @@ CNodeState *CNodesStateManager::_GetNodeState(const NodeId id) void CNodesStateManager::InitializeNodeState(const CNode *pnode) { - LOCK(cs_main); + LOCK(cs); mapNodeState.emplace_hint(mapNodeState.end(), std::piecewise_construct, std::forward_as_tuple(pnode->GetId()), std::forward_as_tuple(pnode->addr, pnode->GetAddrName())); } void CNodesStateManager::RemoveNodeState(const NodeId id) { - LOCK(cs_main); + LOCK(cs); mapNodeState.erase(id); } diff --git a/src/net/nodestate.h b/src/net/nodestate.h index 845b1dfa..2718b5d8 100644 --- a/src/net/nodestate.h +++ b/src/net/nodestate.h @@ -1,8 +1,6 @@ #include "messages.h" #include "net.h" -extern CCriticalSection cs_main; - /** * Maintain validation-specific state about nodes, protected by cs_main, instead * by CNode's own locks. This simplifies asynchronous operation, where @@ -12,7 +10,7 @@ extern CCriticalSection cs_main; struct CNodeState { //! The peer's address - const CService address; + CService address; //! Whether we have a fully established connection. bool fCurrentlyConnected; //! Accumulated misbehaviour score for this peer. @@ -21,15 +19,15 @@ struct CNodeState //! whitelisted). bool fShouldBan; //! String name of this peer (debugging/logging purposes). - const std::string name; + std::string name; //! The best known block we know this peer has announced. - const CBlockIndex *pindexBestKnownBlock; + CBlockIndex *pindexBestKnownBlock; //! The hash of the last unknown block this peer has announced. uint256 hashLastUnknownBlock; //! The last full block we both have. - const CBlockIndex *pindexLastCommonBlock; + CBlockIndex *pindexLastCommonBlock; //! The best header we have sent our peer. - const CBlockIndex *pindexBestHeaderSent; + CBlockIndex *pindexBestHeaderSent; //! Length of current-streak of unconnecting headers announcements int nUnconnectingHeaders; //! Whether we've started headers synchronization with this peer. @@ -84,7 +82,7 @@ struct CNodeState class CNodesStateManager { protected: - // CCriticalSection cs; + CCriticalSection cs; std::map mapNodeState; friend class CNodeStateAccessor; @@ -100,16 +98,14 @@ class CNodesStateManager /** Clear the entire nodestate map */ void Clear() { - // LOCK(cs); - LOCK(cs_main); + LOCK(cs); mapNodeState.clear(); } /** Is mapNodestate empty */ bool Empty() { - // LOCK(cs); - LOCK(cs_main); + LOCK(cs); return mapNodeState.empty(); } }; @@ -123,8 +119,7 @@ class CNodeStateAccessor CNodeStateAccessor(CCriticalSection *_cs, CNodeState *_obj) : cs(_cs), obj(_obj) { cs->lock(); } CNodeStateAccessor(CNodesStateManager &ns, const NodeId id) { - // cs = &ns.cs; - cs = &cs_main; + cs = &ns.cs; cs->lock(); obj = ns._GetNodeState(id); } diff --git a/src/processblock.cpp b/src/processblock.cpp index 5f5da834..98d1b40b 100644 --- a/src/processblock.cpp +++ b/src/processblock.cpp @@ -101,7 +101,6 @@ bool DisconnectTip(CValidationState &state, const Consensus::Params &consensusPa } assert(view.Flush()); } - LogPrint("bench", "- Disconnect block: %.2fms\n", (GetTimeMicros() - nStart) * 0.001); // Write the chain state to disk, if necessary. if (!FlushStateToDisk(state, FLUSH_STATE_IF_NEEDED)) return false; @@ -139,14 +138,6 @@ bool DisconnectTip(CValidationState &state, const Consensus::Params &consensusPa return true; } -static int64_t nTimeReadFromDisk = 0; -static int64_t nTimeConnectTotal = 0; -static int64_t nTimeFlush = 0; -static int64_t nTimeChainState = 0; -static int64_t nTimePostConnect = 0; -static int64_t nTimeTotal = 0; - - /** * Connect a new block to chainActive. pblock is either NULL or a pointer to a CBlock * corresponding to pindexNew, to bypass loading it again from disk. @@ -159,8 +150,6 @@ bool ConnectTip(CValidationState &state, AssertLockHeld(cs_main); assert(pindexNew->pprev == pnetMan->getChainActive()->chainActive.Tip()); // Read block from disk. - int64_t nTime1 = GetTimeMicros(); - CBlock block; if (!pblock) { @@ -173,11 +162,6 @@ bool ConnectTip(CValidationState &state, } // Apply the block atomically to the chain state. - int64_t nTime2 = GetTimeMicros(); - nTimeReadFromDisk += nTime2 - nTime1; - int64_t nTime3; - LogPrint( - "bench", " - Load block from disk: %.2fms [%.2fs]\n", (nTime2 - nTime1) * 0.001, nTimeReadFromDisk * 0.000001); { CCoinsViewCache view(pcoinsTip.get()); bool rv = ConnectBlock(*pblock, state, pindexNew, view); @@ -189,22 +173,11 @@ bool ConnectTip(CValidationState &state, } return error("ConnectTip(): ConnectBlock %s failed", pindexNew->GetBlockHash().ToString().c_str()); } - nTime3 = GetTimeMicros(); - nTimeConnectTotal += nTime3 - nTime2; - LogPrint( - "bench", " - Connect total: %.2fms [%.2fs]\n", (nTime3 - nTime2) * 0.001, nTimeConnectTotal * 0.000001); assert(view.Flush()); } - int64_t nTime4 = GetTimeMicros(); - nTimeFlush += nTime4 - nTime3; - LogPrint("bench", " - Flush: %.2fms [%.2fs]\n", (nTime4 - nTime3) * 0.001, nTimeFlush * 0.000001); // Write the chain state to disk, if necessary. if (!FlushStateToDisk(state, FLUSH_STATE_IF_NEEDED)) return false; - int64_t nTime5 = GetTimeMicros(); - nTimeChainState += nTime5 - nTime4; - LogPrint( - "bench", " - Writing chainstate: %.2fms [%.2fs]\n", (nTime5 - nTime4) * 0.001, nTimeChainState * 0.000001); // Remove conflicting transactions from the mempool. std::list txConflicted; mempool.removeForBlock( @@ -225,13 +198,6 @@ bool ConnectTip(CValidationState &state, SyncWithWallets(ptx, pblock, txIdx); txIdx++; } - - int64_t nTime6 = GetTimeMicros(); - nTimePostConnect += nTime6 - nTime5; - nTimeTotal += nTime6 - nTime1; - LogPrint( - "bench", " - Connect postprocess: %.2fms [%.2fs]\n", (nTime6 - nTime5) * 0.001, nTimePostConnect * 0.000001); - LogPrint("bench", "- Connect block: %.2fms [%.2fs]\n", (nTime6 - nTime1) * 0.001, nTimeTotal * 0.000001); return true; } @@ -963,20 +929,14 @@ bool ConnectBlock(const CBlock &block, } } - - int64_t nTime1 = GetTimeMicros(); - nTimeCheck += nTime1 - nTimeStart; - LogPrint("bench", " - Sanity checks: %.2fms [%.2fs]\n", 0.001 * (nTime1 - nTimeStart), nTimeCheck * 0.000001); + for (auto const &tx : block.vtx) { - for (auto const &tx : block.vtx) + for (size_t o = 0; o < tx->vout.size(); o++) { - for (size_t o = 0; o < tx->vout.size(); o++) + if (view.HaveCoin(COutPoint(tx->GetHash(), o))) { - if (view.HaveCoin(COutPoint(tx->GetHash(), o))) - { - return state.DoS( - 100, error("ConnectBlock(): tried to overwrite transaction"), REJECT_INVALID, "bad-txns-BIP30"); - } + return state.DoS( + 100, error("ConnectBlock(): tried to overwrite transaction"), REJECT_INVALID, "bad-txns-BIP30"); } } } @@ -988,10 +948,6 @@ bool ConnectBlock(const CBlock &block, flags |= SCRIPT_VERIFY_CHECKSEQUENCEVERIFY; nLockTimeFlags |= LOCKTIME_VERIFY_SEQUENCE; - int64_t nTime2 = GetTimeMicros(); - nTimeForks += nTime2 - nTime1; - LogPrint("bench", " - Fork checks: %.2fms [%.2fs]\n", 0.001 * (nTime2 - nTime1), nTimeForks * 0.000001); - CBlockUndo blockundo; CCheckQueueControl control(fScriptChecks && nScriptCheckThreads ? &scriptcheckqueue : nullptr); @@ -1090,12 +1046,6 @@ bool ConnectBlock(const CBlock &block, pos.nTxOffset += ::GetSerializeSize(tx, SER_DISK, CLIENT_VERSION); } - - int64_t nTime3 = GetTimeMicros(); - nTimeConnect += nTime3 - nTime2; - LogPrint("bench", " - Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin) [%.2fs]\n", - (unsigned)block.vtx.size(), 0.001 * (nTime3 - nTime2), 0.001 * (nTime3 - nTime2) / block.vtx.size(), - nInputs <= 1 ? 0 : 0.001 * (nTime3 - nTime2) / (nInputs - 1), nTimeConnect * 0.000001); CAmount blockReward = 0; /// after 1504000 no Pow blocks are allowed @@ -1142,15 +1092,13 @@ bool ConnectBlock(const CBlock &block, { return state.DoS(100, error("%s: CheckQueue failed", __func__), REJECT_INVALID, "block-validation-failed"); } - int64_t nTime4 = GetTimeMicros(); - nTimeVerify += nTime4 - nTime2; - LogPrint("bench", " - Verify %u txins: %.2fms (%.3fms/txin) [%.2fs]\n", nInputs - 1, 0.001 * (nTime4 - nTime2), - nInputs <= 1 ? 0 : 0.001 * (nTime4 - nTime2) / (nInputs - 1), nTimeVerify * 0.000001); - - // ppcoin: track money supply and mint amount info - pindex->nMint = nValueOut - nValueIn + nFees; - pindex->nMoneySupply = (pindex->pprev ? pindex->pprev->nMoneySupply : 0) + nValueOut - nValueIn; + { + RECURSIVEWRITELOCK(pnetMan->getChainActive()->cs_mapBlockIndex); + // ppcoin: track money supply and mint amount info + pindex->nMint = nValueOut - nValueIn + nFees; + pindex->nMoneySupply = (pindex->pprev ? pindex->pprev->nMoneySupply : 0) + nValueOut - nValueIn; + } /// put the following checks in this function due to lack of pindex when checkblock is called @@ -1172,8 +1120,12 @@ bool ConnectBlock(const CBlock &block, { return error("ConnectBlock() : SetStakeEntropyBit() failed"); } - // ppcoin: record proof-of-stake hash value - pindex->hashProofOfStake = hashProofOfStake; + + { + RECURSIVEWRITELOCK(pnetMan->getChainActive()->cs_mapBlockIndex); + // ppcoin: record proof-of-stake hash value + pindex->hashProofOfStake = hashProofOfStake; + } // ppcoin: compute stake modifier uint256 nStakeModifier; @@ -1190,7 +1142,10 @@ bool ConnectBlock(const CBlock &block, return state.DoS(100, error("ConnectBlock() : ComputeNextStakeModifier() failed"), REJECT_INVALID, "bad-stakemodifier-pow"); } - pindex->SetStakeModifier(nStakeModifier); + { + RECURSIVEWRITELOCK(pnetMan->getChainActive()->cs_mapBlockIndex); + pindex->SetStakeModifier(nStakeModifier); + } if (fJustCheck) return true; @@ -1223,14 +1178,6 @@ bool ConnectBlock(const CBlock &block, // add this block to the view's block chain view.SetBestBlock(pindex->GetBlockHash()); - - int64_t nTime5 = GetTimeMicros(); - nTimeIndex += nTime5 - nTime4; - LogPrint("bench", " - Index writing: %.2fms [%.2fs]\n", 0.001 * (nTime5 - nTime4), nTimeIndex * 0.000001); - int64_t nTime6 = GetTimeMicros(); - nTimeCallbacks += nTime6 - nTime5; - LogPrint("bench", " - Callbacks: %.2fms [%.2fs]\n", 0.001 * (nTime6 - nTime5), nTimeCallbacks * 0.000001); - return true; } @@ -1608,6 +1555,5 @@ bool ProcessNewBlock(CValidationState &state, else return false; } - return true; } diff --git a/src/rpc/rpcserver.cpp b/src/rpc/rpcserver.cpp index f0f08a9a..296de1e2 100644 --- a/src/rpc/rpcserver.cpp +++ b/src/rpc/rpcserver.cpp @@ -46,10 +46,10 @@ static const int CONTINUE_EXECUTION = -1; using namespace RPCServer; -bool fRPCRunning = false; -bool fRPCInWarmup = true; -std::string rpcWarmupStatus("RPC server started"); -CCriticalSection cs_rpcWarmup; +extern bool fRPCRunning; +extern bool fRPCInWarmup; +extern std::string rpcWarmupStatus; +extern CCriticalSection cs_rpcWarmup; /* Timer-creating functions */ std::vector timerInterfaces; /* Map of name to timer. @@ -71,7 +71,6 @@ static struct CRPCSignals boost::signals2::signal Started; boost::signals2::signal Stopped; boost::signals2::signal PreCommand; - boost::signals2::signal PostCommand; } g_rpcSignals; void RPCServer::OnStarted(boost::function slot) { g_rpcSignals.Started.connect(slot); } @@ -81,11 +80,6 @@ void RPCServer::OnPreCommand(boost::function slot) g_rpcSignals.PreCommand.connect(boost::bind(slot, _1)); } -void RPCServer::OnPostCommand(boost::function slot) -{ - g_rpcSignals.PostCommand.connect(boost::bind(slot, _1)); -} - void RPCTypeCheck(const UniValue ¶ms, const std::list &typesExpected, bool fAllowNull) { unsigned int i = 0; @@ -532,8 +526,6 @@ UniValue CRPCTable::execute(const std::string &strMethod, const UniValue ¶ms { throw JSONRPCError(RPC_MISC_ERROR, e.what()); } - - g_rpcSignals.PostCommand(*pcmd); } std::string HelpExampleCli(const std::string &methodname, const std::string &args) diff --git a/src/rpc/rpcserver.h b/src/rpc/rpcserver.h index 99c7f9a1..159b491f 100644 --- a/src/rpc/rpcserver.h +++ b/src/rpc/rpcserver.h @@ -41,7 +41,6 @@ namespace RPCServer void OnStarted(boost::function slot); void OnStopped(boost::function slot); void OnPreCommand(boost::function slot); -void OnPostCommand(boost::function slot); } class CBlockIndex; diff --git a/src/rpc/rpcwallet.cpp b/src/rpc/rpcwallet.cpp index a75a7ddd..d2b63a9c 100644 --- a/src/rpc/rpcwallet.cpp +++ b/src/rpc/rpcwallet.cpp @@ -39,8 +39,8 @@ #include -int64_t nWalletUnlockTime; -static CCriticalSection cs_nWalletUnlockTime; +extern int64_t nWalletUnlockTime; +extern CCriticalSection cs_nWalletUnlockTime; std::string HelpRequiringPassphrase() { diff --git a/src/sync.cpp b/src/sync.cpp index 048252c8..ff4ef682 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2015 The Bitcoin Core developers +// Copyright (c) 2015-2018 The Bitcoin Unlimited developers +// Copyright (c) 2019 Greg Griffith +// Copyright (c) 2019 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "sync.h" @@ -27,14 +15,6 @@ #include #include -#ifdef DEBUG_LOCKCONTENTION -void PrintLockContention(const char *pszName, const char *pszFile, unsigned int nLine) -{ - LogPrintf("LOCKCONTENTION: %s\n", pszName); - LogPrintf("Locker: %s:%d\n", pszFile, nLine); -} -#endif /* DEBUG_LOCKCONTENTION */ - #ifdef DEBUG_LOCKORDER // this define covers the rest of the file void EnterCritical(const char *pszName, @@ -49,6 +29,51 @@ void EnterCritical(const char *pszName, } void LeaveCritical(void *cs) { remove_lock_critical_exit(cs); } +void AssertLockHeldInternal(const char *pszName, const char *pszFile, unsigned int nLine, void *cs) +{ + std::lock_guard lock(lockdata.dd_mutex); + uint64_t tid = getTid(); + auto self_iter = lockdata.locksheldbythread.find(tid); + if (self_iter == lockdata.locksheldbythread.end()) + { + return; + } + if (self_iter->second.empty()) + { + return; + } + for (auto &entry : self_iter->second) + { + if (entry.first == cs) + { + // found the lock so return + return; + } + } + fprintf(stderr, "Assertion failed: lock %s not held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, + _LocksHeld().c_str()); + abort(); +} + +void AssertLockNotHeldInternal(const char *pszName, const char *pszFile, unsigned int nLine, void *cs) +{ + std::lock_guard lock(lockdata.dd_mutex); + uint64_t tid = getTid(); + auto self_iter = lockdata.locksheldbythread.find(tid); + if (self_iter != lockdata.locksheldbythread.end() && self_iter->second.empty() == false) + { + for (auto &entry : self_iter->second) + { + if (entry.first == cs) + { + fprintf(stderr, "Assertion failed: lock %s held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, + _LocksHeld().c_str()); + abort(); + } + } + } +} + void AssertWriteLockHeldInternal(const char *pszName, const char *pszFile, unsigned int nLine, @@ -131,14 +156,7 @@ CSharedCriticalSection::~CSharedCriticalSection() DeleteLock((void *)this); } - -void CSharedCriticalSection::lock_shared() { boost::shared_mutex::lock_shared(); } -void CSharedCriticalSection::unlock_shared() { boost::shared_mutex::unlock_shared(); } -bool CSharedCriticalSection::try_lock_shared() { return boost::shared_mutex::try_lock_shared(); } -void CSharedCriticalSection::lock() { boost::shared_mutex::lock(); } -void CSharedCriticalSection::unlock() { boost::shared_mutex::unlock(); } -bool CSharedCriticalSection::try_lock() { return boost::shared_mutex::try_lock(); } -CRecursiveSharedCriticalSection::CRecursiveSharedCriticalSection() : name(nullptr) {} +CRecursiveSharedCriticalSection::CRecursiveSharedCriticalSection() : name(NULL) {} CRecursiveSharedCriticalSection::CRecursiveSharedCriticalSection(const char *n) : name(n) { // print the address of named critical sections so they can be found in the mutrace output diff --git a/src/sync.h b/src/sync.h index 91ce779d..c4ddbce4 100644 --- a/src/sync.h +++ b/src/sync.h @@ -1,6 +1,8 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin Core developers // Copyright (c) 2015-2018 The Bitcoin Unlimited developers +// Copyright (c) 2019 Greg Griffith +// Copyright (c) 2019 The Eccoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -24,38 +26,6 @@ #include #include -//////////////////////////////////////////////// -// // -// THE SIMPLE DEFINITION, EXCLUDING DEBUG CODE // -// // -//////////////////////////////////////////////// - -/* -CCriticalSection mutex; - boost::recursive_mutex mutex; - -LOCK(mutex); - boost::unique_lock criticalblock(mutex); - -LOCK2(mutex1, mutex2); - boost::unique_lock criticalblock1(mutex1); - boost::unique_lock criticalblock2(mutex2); - -TRY_LOCK(mutex, name); - boost::unique_lock name(mutex, boost::try_to_lock_t); - -ENTER_CRITICAL_SECTION(mutex); // no RAII - mutex.lock(); - -LEAVE_CRITICAL_SECTION(mutex); // no RAII - mutex.unlock(); - */ - -/////////////////////////////// -// // -// THE ACTUAL IMPLEMENTATION // -// // -/////////////////////////////// /** * Template mixin that adds -Wthread-safety locking @@ -73,7 +43,6 @@ class LOCKABLE AnnotatedMixin : public PARENT /** * Wrapped boost mutex: supports recursive locking, but no waiting - * TODO: We should move away from using the recursive lock by default. */ #ifndef DEBUG_LOCKORDER typedef AnnotatedMixin CCriticalSection; @@ -140,15 +109,15 @@ class CSharedCriticalSection : public AnnotatedMixin { public: const char *name; - CSharedCriticalSection(const char *name); CSharedCriticalSection(); + CSharedCriticalSection(const char *name); ~CSharedCriticalSection(); - void lock_shared(); - bool try_lock_shared(); - void unlock_shared(); - void lock(); - void unlock(); - bool try_lock(); + void lock_shared() { boost::shared_mutex::lock_shared(); } + void unlock_shared() { boost::shared_mutex::unlock_shared(); } + bool try_lock_shared() { return boost::shared_mutex::try_lock_shared(); } + void lock() { boost::shared_mutex::lock(); } + void unlock() { boost::shared_mutex::unlock(); } + bool try_lock() { return boost::shared_mutex::try_lock(); } }; #define SCRITSEC(zzname) CSharedCriticalSection zzname(#zzname) #endif @@ -198,17 +167,6 @@ class CDeferredSharedLocker ~CDeferredSharedLocker() { unlock(); } }; -// This class unlocks a shared lock for the duration of its life -class CSharedUnlocker -{ - CSharedCriticalSection &cs; - -public: - CSharedUnlocker(CSharedCriticalSection &c) : cs(c) { cs.unlock_shared(); } - ~CSharedUnlocker() { cs.lock_shared(); } -}; - - /** Wrapped boost mutex: supports waiting but not recursive locking */ typedef AnnotatedMixin CWaitableCriticalSection; @@ -272,10 +230,6 @@ void static inline AssertRecursiveWriteLockHeldinternal(const char *pszName, #define AssertWriteLockHeld(cs) AssertWriteLockHeldInternal(#cs, __FILE__, __LINE__, &cs) #define AssertRecursiveWriteLockHeld(cs) AssertRecursiveWriteLockHeldInternal(#cs, __FILE__, __LINE__, &cs) -#ifdef DEBUG_LOCKCONTENTION -void PrintLockContention(const char *pszName, const char *pszFile, unsigned int nLine); -#endif - #define LOCK_WARN_TIME (500ULL * 1000ULL * 1000ULL) /** Wrapper around std::unique_lock */ @@ -302,22 +256,13 @@ class SCOPED_LOCKABLE CMutexLock file = pszFile; line = nLine; EnterCritical(pszName, pszFile, nLine, (void *)(lock.mutex()), type, true, false); -#ifdef DEBUG_LOCKCONTENTION - if (!lock.try_lock()) - { - PrintLockContention(pszName, pszFile, nLine); -#endif - lock.lock(); - SetWaitingToHeld((void *)(lock.mutex()), getTid(), true); -#ifdef DEBUG_LOCKCONTENTION - } -#endif - + lock.lock(); + SetWaitingToHeld((void *)(lock.mutex()), true); #ifdef DEBUG_LOCKTIME lockedTime = GetStopwatch(); if (lockedTime - startWait > LOCK_WARN_TIME) { - LOG(LCK, "Lock %s at %s:%d waited for %d ms\n", pszName, pszFile, nLine, (lockedTime - startWait)); + LogPrint("lock", "Lock %s at %s:%d waited for %d ms\n", pszName, pszFile, nLine, (lockedTime - startWait)); } #endif } @@ -343,7 +288,7 @@ class SCOPED_LOCKABLE CMutexLock bool owned = lock.owns_lock(); if (owned) { - SetWaitingToHeld((void *)(lock.mutex()), getTid(), false); + SetWaitingToHeld((void *)(lock.mutex()), false); } return owned; } @@ -389,7 +334,8 @@ class SCOPED_LOCKABLE CMutexLock uint64_t doneTime = GetStopwatch(); if (doneTime - lockedTime > LOCK_WARN_TIME) { - LOG(LCK, "Lock %s at %s:%d remained locked for %d ms\n", name, file, line, doneTime - lockedTime); + LogPrint( + "lock", "Lock %s at %s:%d remained locked for %d ms\n", name, file, line, doneTime - lockedTime); } #endif } @@ -420,23 +366,13 @@ class SCOPED_LOCKABLE CMutexReadLock file = pszFile; line = nLine; EnterCritical(pszName, pszFile, nLine, (void *)(lock.mutex()), type, false, false); -// LOG(LCK,"try ReadLock %p %s by %d\n", lock.mutex(), name ? name : "", boost::this_thread::get_id()); -#ifdef DEBUG_LOCKCONTENTION - if (!lock.try_lock()) - { - PrintLockContention(pszName, pszFile, nLine); -#endif - lock.lock(); - SetWaitingToHeld((void *)(lock.mutex()), getTid(), false); -#ifdef DEBUG_LOCKCONTENTION - } -#endif -// LOG(LCK,"ReadLock %p %s taken by %d\n", lock.mutex(), name ? name : "", boost::this_thread::get_id()); + lock.lock(); + SetWaitingToHeld((void *)(lock.mutex()), false); #ifdef DEBUG_LOCKTIME lockedTime = GetStopwatch(); if (lockedTime - startWait > LOCK_WARN_TIME) { - LOG(LCK, "Lock %s at %s:%d waited for %d ms\n", pszName, pszFile, nLine, (lockedTime - startWait)); + LogPrint("lock", "Lock %s at %s:%d waited for %d ms\n", pszName, pszFile, nLine, (lockedTime - startWait)); } #endif } @@ -461,7 +397,7 @@ class SCOPED_LOCKABLE CMutexReadLock bool owned = lock.owns_lock(); if (owned) { - SetWaitingToHeld((void *)(lock.mutex()), getTid(), false); + SetWaitingToHeld((void *)(lock.mutex()), false); } return owned; } @@ -507,7 +443,8 @@ class SCOPED_LOCKABLE CMutexReadLock int64_t doneTime = GetStopwatch(); if (doneTime - lockedTime > LOCK_WARN_TIME) { - LOG(LCK, "Lock %s at %s:%d remained locked for %d ms\n", name, file, line, doneTime - lockedTime); + LogPrint( + "lock", "Lock %s at %s:%d remained locked for %d ms\n", name, file, line, doneTime - lockedTime); } #endif } diff --git a/src/test/deadlock_tests/test1-4.cpp b/src/test/deadlock_tests/test1-4.cpp index b8ebc183..76936905 100644 --- a/src/test/deadlock_tests/test1-4.cpp +++ b/src/test/deadlock_tests/test1-4.cpp @@ -17,6 +17,8 @@ BOOST_FIXTURE_TEST_SUITE(self_deadlock_tests, EmptySuite) +#ifdef DEBUG_LOCKORDER // this ifdef covers the rest of the file + BOOST_AUTO_TEST_CASE(TEST_1_SM) { CSharedCriticalSection shared_mutex; @@ -52,4 +54,10 @@ BOOST_AUTO_TEST_CASE(TEST_4) BOOST_CHECK_THROW(WRITELOCK(shared_mutex), std::logic_error); } +#else + +BOOST_AUTO_TEST_CASE(EMPTY_TEST_1_4) {} + +#endif + BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/deadlock_tests/test5.cpp b/src/test/deadlock_tests/test5.cpp index e2accc46..f0c28797 100644 --- a/src/test/deadlock_tests/test5.cpp +++ b/src/test/deadlock_tests/test5.cpp @@ -18,6 +18,8 @@ BOOST_FIXTURE_TEST_SUITE(test5, EmptySuite) +#ifdef DEBUG_LOCKORDER // this ifdef covers the rest of the file + CSharedCriticalSection mutexA; CSharedCriticalSection mutexB; @@ -45,4 +47,10 @@ BOOST_AUTO_TEST_CASE(TEST_5) thread2.join(); } +#else + +BOOST_AUTO_TEST_CASE(EMPTY_TEST_5) {} + +#endif + BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/deadlock_tests/test6.cpp b/src/test/deadlock_tests/test6.cpp index f4586d6d..d849e9b8 100644 --- a/src/test/deadlock_tests/test6.cpp +++ b/src/test/deadlock_tests/test6.cpp @@ -18,6 +18,8 @@ BOOST_FIXTURE_TEST_SUITE(test6, EmptySuite) +#ifdef DEBUG_LOCKORDER // this ifdef covers the rest of the file + CSharedCriticalSection mutexA; CSharedCriticalSection mutexB; @@ -45,4 +47,10 @@ BOOST_AUTO_TEST_CASE(TEST_6) thread2.join(); } +#else + +BOOST_AUTO_TEST_CASE(EMPTY_TEST_6) {} + +#endif + BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/deadlock_tests/test7.cpp b/src/test/deadlock_tests/test7.cpp index 108fda3b..571e3f23 100644 --- a/src/test/deadlock_tests/test7.cpp +++ b/src/test/deadlock_tests/test7.cpp @@ -18,6 +18,8 @@ BOOST_FIXTURE_TEST_SUITE(test7, EmptySuite) +#ifdef DEBUG_LOCKORDER // this ifdef covers the rest of the file + CSharedCriticalSection mutexA; CSharedCriticalSection mutexB; CSharedCriticalSection mutexC; @@ -58,4 +60,10 @@ BOOST_AUTO_TEST_CASE(TEST_7) thread3.join(); } +#else + +BOOST_AUTO_TEST_CASE(EMPTY_TEST_7) {} + +#endif + BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/deadlock_tests/test8.cpp b/src/test/deadlock_tests/test8.cpp index b35d399a..92593c00 100644 --- a/src/test/deadlock_tests/test8.cpp +++ b/src/test/deadlock_tests/test8.cpp @@ -18,6 +18,8 @@ BOOST_FIXTURE_TEST_SUITE(test8, EmptySuite) +#ifdef DEBUG_LOCKORDER // this ifdef covers the rest of the file + CSharedCriticalSection mutexA; CSharedCriticalSection mutexB; CSharedCriticalSection mutexC; @@ -58,4 +60,10 @@ BOOST_AUTO_TEST_CASE(TEST_8) thread3.join(); } +#else + +BOOST_AUTO_TEST_CASE(EMPTY_TEST_8) {} + +#endif + BOOST_AUTO_TEST_SUITE_END() diff --git a/src/threaddeadlock.cpp b/src/threaddeadlock.cpp index 50302afd..c11d6a80 100644 --- a/src/threaddeadlock.cpp +++ b/src/threaddeadlock.cpp @@ -21,42 +21,6 @@ #ifdef DEBUG_LOCKORDER // covers the entire file -// pair ( cs : lock location ) -typedef std::pair LockStackEntry; -typedef std::vector LockStack; - -// cs : set of thread ids -typedef std::map > ReadLocksHeld; -// cs : set of thread ids -typedef std::map > WriteLocksHeld; - -// cs : set of thread ids -typedef std::map > ReadLocksWaiting; -// cs : set of thread ids -typedef std::map > WriteLocksWaiting; - -// thread id : vector of locks held (both shared and exclusive, waiting and held) -typedef std::map LocksHeldByThread; - - -struct LockData -{ - // Very ugly hack: as the global constructs and destructors run single - // threaded, we use this boolean to know whether LockData still exists, - // as DeleteLock can get called by global CCriticalSection destructors - // after LockData disappears. - bool available; - LockData() : available(true) {} - ~LockData() { available = false; } - ReadLocksWaiting readlockswaiting; - WriteLocksWaiting writelockswaiting; - - ReadLocksHeld readlocksheld; - WriteLocksHeld writelocksheld; - LocksHeldByThread locksheldbythread; - std::mutex dd_mutex; -} static lockdata; - void potential_deadlock_detected(LockStackEntry now, LockStack &deadlocks, std::set &threads) { LogPrintf("POTENTIAL DEADLOCK DETECTED\n"); @@ -343,7 +307,7 @@ bool HasAnyOwners(void *c) return false; } -void AddNewLock(LockStackEntry &newEntry, const uint64_t &tid) +void AddNewLock(LockStackEntry newEntry, const uint64_t &tid) { auto it = lockdata.locksheldbythread.find(tid); if (it == lockdata.locksheldbythread.end()) @@ -390,8 +354,11 @@ void AddNewWaitingLock(void *c, const uint64_t &tid, bool &isExclusive) } } -void SetWaitingToHeld(void *c, const uint64_t &tid, bool isExclusive) +void SetWaitingToHeld(void *c, bool isExclusive) { + std::lock_guard lock(lockdata.dd_mutex); + + const uint64_t tid = getTid(); if (isExclusive) { auto it = lockdata.writelockswaiting.find(c); @@ -697,6 +664,11 @@ void remove_lock_critical_exit(void *cs) std::string _LocksHeld() { + if (!lockdata.available) + { + // lockdata was already deleted + return ""; + } std::string result; uint64_t tid = getTid(); auto self_iter = lockdata.locksheldbythread.find(tid); @@ -716,49 +688,4 @@ std::string LocksHeld() return _LocksHeld(); } -void AssertLockHeldInternal(const char *pszName, const char *pszFile, unsigned int nLine, void *cs) -{ - std::lock_guard lock(lockdata.dd_mutex); - uint64_t tid = getTid(); - auto self_iter = lockdata.locksheldbythread.find(tid); - if (self_iter == lockdata.locksheldbythread.end()) - { - return; - } - if (self_iter->second.empty()) - { - return; - } - for (auto &entry : self_iter->second) - { - if (entry.first == cs) - { - // found the lock so return - return; - } - } - fprintf(stderr, "Assertion failed: lock %s not held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, - _LocksHeld().c_str()); - abort(); -} - -void AssertLockNotHeldInternal(const char *pszName, const char *pszFile, unsigned int nLine, void *cs) -{ - std::lock_guard lock(lockdata.dd_mutex); - uint64_t tid = getTid(); - auto self_iter = lockdata.locksheldbythread.find(tid); - if (self_iter != lockdata.locksheldbythread.end() && self_iter->second.empty() == false) - { - for (auto &entry : self_iter->second) - { - if (entry.first == cs) - { - fprintf(stderr, "Assertion failed: lock %s held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, - _LocksHeld().c_str()); - abort(); - } - } - } -} - #endif // DEBUG_LOCKORDER diff --git a/src/threaddeadlock.h b/src/threaddeadlock.h index e38d356d..d921f356 100644 --- a/src/threaddeadlock.h +++ b/src/threaddeadlock.h @@ -8,6 +8,9 @@ #ifndef ECCOIN_THREAD_DEADLOCK_H #define ECCOIN_THREAD_DEADLOCK_H +#include +#include +#include #include #include "util/utilstrencodings.h" @@ -19,9 +22,9 @@ enum LockType RECRUSIVESHARED, // CRecursiveSharedCriticalSection }; +#ifdef DEBUG_LOCKORDER #include #include // for syscall definition - #ifdef __linux__ inline uint64_t getTid(void) { @@ -37,8 +40,6 @@ inline uint64_t getTid(void) } #endif -#ifdef DEBUG_LOCKORDER // covers the entire file - struct CLockLocation { CLockLocation(const char *pszName, const char *pszFile, int nLine, bool fTryIn, bool fExclusiveIn) @@ -70,17 +71,56 @@ struct CLockLocation bool fWaiting; // determines if lock is held or is waiting to be held }; +// pair ( cs : lock location ) +typedef std::pair LockStackEntry; +typedef std::vector LockStack; + +// cs : set of thread ids +typedef std::map > ReadLocksHeld; +// cs : set of thread ids +typedef std::map > WriteLocksHeld; + +// cs : set of thread ids +typedef std::map > ReadLocksWaiting; +// cs : set of thread ids +typedef std::map > WriteLocksWaiting; + +// thread id : vector of locks held (both shared and exclusive, waiting and held) +typedef std::map LocksHeldByThread; + + +struct LockData +{ + // Very ugly hack: as the global constructs and destructors run single + // threaded, we use this boolean to know whether LockData still exists, + // as DeleteLock can get called by global CCriticalSection destructors + // after LockData disappears. + bool available; + LockData() : available(true) {} + ~LockData() { available = false; } + ReadLocksWaiting readlockswaiting; + WriteLocksWaiting writelockswaiting; + + ReadLocksHeld readlocksheld; + WriteLocksHeld writelocksheld; + LocksHeldByThread locksheldbythread; + std::mutex dd_mutex; +}; + +extern LockData lockdata; + void push_lock(void *c, const CLockLocation &locklocation, LockType type, bool isExclusive, bool fTry); void DeleteLock(void *cs); void _remove_lock_critical_exit(void *cs); void remove_lock_critical_exit(void *cs); std::string LocksHeld(); -void SetWaitingToHeld(void *c, const uint64_t &tid, bool isExclusive); +void SetWaitingToHeld(void *c, bool isExclusive); bool HasAnyOwners(void *c); +std::string _LocksHeld(); #else // NOT DEBUG_LOCKORDER -static inline void SetWaitingToHeld(void *c, const uint64_t &tid, bool isExclusive) {} +static inline void SetWaitingToHeld(void *c, bool isExclusive) {} #endif // END DEBUG_LOCKORDER diff --git a/src/timedata.cpp b/src/timedata.cpp index bdf39356..b7c82b9d 100644 --- a/src/timedata.cpp +++ b/src/timedata.cpp @@ -26,8 +26,8 @@ #include "util/util.h" #include "util/utilstrencodings.h" -static CCriticalSection cs_nTimeOffset; -static int64_t nTimeOffset = 0; +extern CCriticalSection cs_nTimeOffset; +extern int64_t nTimeOffset; /** * "Never go to sea with two chronometers; take one or three." diff --git a/src/util/util.cpp b/src/util/util.cpp index e3b6b284..a27b850d 100644 --- a/src/util/util.cpp +++ b/src/util/util.cpp @@ -118,19 +118,22 @@ bool fDaemon = false; bool fServer = false; std::string strMiscWarning; +// None of this is needed with OpenSSL 1.1.0 +#if OPENSSL_VERSION_NUMBER < 0x10100000L /** Init OpenSSL library multithreading support */ -static CCriticalSection **ppmutexOpenSSL; +static std::mutex **ppmutexOpenSSL; void locking_callback(int mode, int i, const char *file, int line) NO_THREAD_SAFETY_ANALYSIS { if (mode & CRYPTO_LOCK) { - ENTER_CRITICAL_SECTION(*ppmutexOpenSSL[i]); + (*ppmutexOpenSSL[i]).lock(); } else { - LEAVE_CRITICAL_SECTION(*ppmutexOpenSSL[i]); + (*ppmutexOpenSSL[i]).unlock(); } } +#endif // Init class CInit @@ -138,10 +141,11 @@ class CInit public: CInit() { +#if OPENSSL_VERSION_NUMBER < 0x10100000L // Init OpenSSL library multithreading support - ppmutexOpenSSL = (CCriticalSection **)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(CCriticalSection *)); + ppmutexOpenSSL = (std::mutex **)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(std::mutex *)); for (int i = 0; i < CRYPTO_num_locks(); i++) - ppmutexOpenSSL[i] = new CCriticalSection(); + ppmutexOpenSSL[i] = new std::mutex(); CRYPTO_set_locking_callback(locking_callback); // OpenSSL can optionally load a config file which lists optional loadable modules and engines. @@ -150,6 +154,9 @@ class CInit // or corrupt. Explicitly tell OpenSSL not to try to load the file. The result for our libs will be // that the config appears to have been loaded and there are no modules/engines available. OPENSSL_no_config(); +#else + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS | OPENSSL_INIT_ADD_ALL_DIGESTS, nullptr); +#endif #ifdef WIN32 // Seed OpenSSL PRNG with current contents of the screen @@ -161,16 +168,26 @@ class CInit } ~CInit() { +#if OPENSSL_VERSION_NUMBER < 0x10100000L // Securely erase the memory used by the PRNG RAND_cleanup(); // Shutdown OpenSSL library multithreading support - CRYPTO_set_locking_callback(NULL); + CRYPTO_set_locking_callback(nullptr); for (int i = 0; i < CRYPTO_num_locks(); i++) delete ppmutexOpenSSL[i]; OPENSSL_free(ppmutexOpenSSL); +#else + // Adding this on the side of caution, perhaps unnecessary according to OpenSSL 1.1 docs: + // "Deinitialises OpenSSL (both libcrypto and libssl). All resources allocated by OpenSSL are freed. + // Typically there should be no need to call this function directly as it is initiated automatically on + // application exit. This is done via the standard C library atexit() function." + // https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_cleanup.html + OPENSSL_cleanup(); +#endif } } instance_of_cinit; + static const int screenWidth = 79; static const int optIndent = 2; static const int msgIndent = 7; diff --git a/src/validationinterface.h b/src/validationinterface.h index df30fad9..4e0b70bf 100644 --- a/src/validationinterface.h +++ b/src/validationinterface.h @@ -58,7 +58,7 @@ class CValidationInterface virtual void ResendWalletTransactions(int64_t nBestBlockTime, CConnman *connman) {} virtual void BlockChecked(const CBlock &, const CValidationState &) {} virtual void GetScriptForMining(boost::shared_ptr &){}; - virtual void NewPoWValidBlock(const CBlockIndex *pindex, const CBlock *block) {} + virtual void NewPoWValidBlock(CBlockIndex *pindex, const CBlock *block) {} friend void ::RegisterValidationInterface(CValidationInterface *); friend void ::UnregisterValidationInterface(CValidationInterface *); friend void ::UnregisterAllValidationInterfaces(); @@ -85,7 +85,7 @@ struct CMainSignals * has been received and connected to the headers tree, though not validated * yet. */ - boost::signals2::signal NewPoWValidBlock; + boost::signals2::signal NewPoWValidBlock; }; CMainSignals &GetMainSignals(); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index da9a701c..52ca9c30 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2096,6 +2096,7 @@ bool CWallet::CreateTransaction(const std::vector &vecSend, if (fWalletUnlockStakingOnly) { LogPrintf("CreateTransaction() : Error: Wallet unlocked for staking only, unable to create transaction.\n"); + return false; } CAmount nValue = 0; unsigned int nSubtractFeeFromAmount = 0; diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index acf0ca94..64c04054 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -35,6 +35,8 @@ #include #include +extern CCriticalSection cs_main; + // // CWalletDB // @@ -730,6 +732,7 @@ void ThreadFlushWalletDB(const std::string &strFile) if (nLastFlushed != nWalletDBUpdated && GetTime() - nLastWalletUpdate >= 2) { + LOCK(cs_main); TRY_LOCK(bitdb.cs_db, lockDb); if (lockDb) { From b1cf008c5080d421dded64f88610c1be7aaf1cf7 Mon Sep 17 00:00:00 2001 From: Griffith <8345264+Greg-Griffith@users.noreply.github.com> Date: Tue, 6 Aug 2019 12:15:30 -0700 Subject: [PATCH 7/8] restore mit licensing to source code (#234) --- COPYING | 26 + LICENSE | 674 ------------------------ src/amount.cpp | 25 +- src/amount.h | 25 +- src/args.cpp | 25 +- src/args.h | 25 +- src/arith_uint256.cpp | 25 +- src/arith_uint256.h | 26 +- src/base58.cpp | 23 +- src/base58.h | 25 +- src/blockgeneration/blockgeneration.cpp | 25 +- src/blockgeneration/blockgeneration.h | 25 +- src/blockgeneration/compare.h | 25 +- src/blockgeneration/miner.cpp | 25 +- src/blockgeneration/miner.h | 25 +- src/blockgeneration/minter.cpp | 25 +- src/blockgeneration/minter.h | 25 +- src/blockstorage/blockstorage.cpp | 7 + src/blockstorage/blockstorage.h | 6 + src/bloom.cpp | 23 +- src/bloom.h | 23 +- src/chain/block.cpp | 25 +- src/chain/block.h | 25 +- src/chain/blockindex.cpp | 26 +- src/chain/blockindex.h | 26 +- src/chain/chain.cpp | 25 +- src/chain/chain.h | 25 +- src/chain/chainman.cpp | 21 +- src/chain/chainman.h | 21 +- src/chain/checkpoints.cpp | 25 +- src/chain/checkpoints.h | 25 +- src/chain/outpoint.h | 25 +- src/chain/tx.cpp | 25 +- src/chain/tx.h | 25 +- src/chain/txin.h | 25 +- src/chain/txout.h | 25 +- src/checkqueue.h | 23 +- src/clientversion.cpp | 24 +- src/clientversion.h | 23 +- src/coins.cpp | 25 +- src/coins.h | 25 +- src/compat.h | 25 +- src/compat/byteswap.h | 23 +- src/compat/ecc_endian.h | 23 +- src/compat/glibc_compat.cpp | 1 + src/compat/glibc_sanity.cpp | 23 +- src/compat/glibcxx_sanity.cpp | 23 +- src/compat/sanity.h | 23 +- src/compat/strnlen.cpp | 23 +- src/compressor.cpp | 25 +- src/compressor.h | 25 +- src/consensus/consensus.h | 25 +- src/consensus/merkle.cpp | 25 +- src/consensus/merkle.h | 25 +- src/consensus/params.h | 25 +- src/consensus/validation.h | 25 +- src/core_io.h | 25 +- src/core_memusage.h | 23 +- src/core_read.cpp | 23 +- src/core_write.cpp | 23 +- src/crypto/chacha20.cpp | 21 +- src/crypto/chacha20.h | 21 +- src/crypto/common.h | 21 +- src/crypto/hash.cpp | 25 +- src/crypto/hash.h | 25 +- src/crypto/hmac_sha256.cpp | 21 +- src/crypto/hmac_sha256.h | 21 +- src/crypto/hmac_sha512.cpp | 21 +- src/crypto/hmac_sha512.h | 21 +- src/crypto/pbkdf2.cpp | 21 +- src/crypto/pbkdf2.h | 21 +- src/crypto/ripemd160.cpp | 21 +- src/crypto/ripemd160.h | 21 +- src/crypto/scrypt.h | 29 + src/crypto/sha1.cpp | 21 +- src/crypto/sha1.h | 22 +- src/crypto/sha256.cpp | 22 +- src/crypto/sha256.h | 22 +- src/crypto/sha512.cpp | 21 +- src/crypto/sha512.h | 22 +- src/dbwrapper.cpp | 23 +- src/dbwrapper.h | 24 +- src/eccoind.cpp | 23 +- src/fs.cpp | 6 + src/fs.h | 6 + src/globals.cpp | 1 + src/httprpc.cpp | 23 +- src/httprpc.h | 23 +- src/httpserver.cpp | 23 +- src/httpserver.h | 23 +- src/init.cpp | 25 +- src/init.h | 25 +- src/kernel.cpp | 23 +- src/kernel.h | 23 +- src/key.cpp | 25 +- src/key.h | 27 +- src/keystore.cpp | 25 +- src/keystore.h | 25 +- src/limitedmap.h | 23 +- src/main.cpp | 25 +- src/main.h | 25 +- src/memusage.h | 23 +- src/merkleblock.cpp | 25 +- src/merkleblock.h | 25 +- src/net/addrdb.cpp | 26 +- src/net/addrdb.h | 26 +- src/net/addrman.cpp | 24 +- src/net/addrman.h | 24 +- src/net/messages.cpp | 26 +- src/net/messages.h | 25 +- src/net/net.cpp | 26 +- src/net/net.h | 25 +- src/net/netaddress.cpp | 26 +- src/net/netaddress.h | 26 +- src/net/netbase.cpp | 26 +- src/net/netbase.h | 26 +- src/net/nodestate.cpp | 8 + src/net/nodestate.h | 9 + src/net/protocol.cpp | 26 +- src/net/protocol.h | 26 +- src/networks/netman.cpp | 21 +- src/networks/netman.h | 21 +- src/networks/network.h | 21 +- src/networks/networktemplate.h | 21 +- src/policy/fees.cpp | 25 +- src/policy/fees.h | 25 +- src/policy/policy.cpp | 25 +- src/policy/policy.h | 25 +- src/pow.cpp | 25 +- src/pow.h | 25 +- src/prevector.h | 21 +- src/processblock.cpp | 25 +- src/processblock.h | 25 +- src/processheader.cpp | 25 +- src/processheader.h | 25 +- src/processtx.cpp | 25 +- src/processtx.h | 25 +- src/pubkey.cpp | 27 +- src/pubkey.h | 27 +- src/random.cpp | 25 +- src/random.h | 25 +- src/reverselock.h | 21 +- src/rpc/events.h | 23 +- src/rpc/rpcblockchain.cpp | 25 +- src/rpc/rpcclient.cpp | 25 +- src/rpc/rpcclient.h | 25 +- src/rpc/rpcdump.cpp | 25 +- src/rpc/rpcmining.cpp | 25 +- src/rpc/rpcmisc.cpp | 25 +- src/rpc/rpcnet.cpp | 25 +- src/rpc/rpcprotocol.cpp | 25 +- src/rpc/rpcprotocol.h | 25 +- src/rpc/rpcrawtransaction.cpp | 25 +- src/rpc/rpcserver.cpp | 25 +- src/rpc/rpcserver.h | 25 +- src/rpc/rpcwallet.cpp | 25 +- src/script/bitcoinconsensus.cpp | 25 +- src/script/bitcoinconsensus.h | 25 +- src/script/interpreter.cpp | 25 +- src/script/interpreter.h | 25 +- src/script/script.cpp | 25 +- src/script/script.h | 25 +- src/script/script_error.cpp | 25 +- src/script/script_error.h | 25 +- src/script/sigcache.cpp | 25 +- src/script/sigcache.h | 25 +- src/script/sign.cpp | 25 +- src/script/sign.h | 25 +- src/script/stakescript.cpp | 25 +- src/script/stakescript.h | 25 +- src/script/standard.cpp | 25 +- src/script/standard.h | 25 +- src/serialize.h | 25 +- src/streams.h | 25 +- src/support/allocators/secure.h | 23 +- src/support/allocators/zeroafterfree.h | 23 +- src/support/cleanse.cpp | 25 +- src/support/cleanse.h | 25 +- src/support/pagelocker.cpp | 25 +- src/support/pagelocker.h | 25 +- src/sync.cpp | 1 + src/sync.h | 1 + src/threaddeadlock.cpp | 4 +- src/threaddeadlock.h | 5 +- src/threadgroup.h | 5 + src/threadsafety.h | 26 +- src/timedata.cpp | 24 +- src/timedata.h | 24 +- src/torcontrol.cpp | 23 +- src/torcontrol.h | 21 +- src/txdb.cpp | 26 +- src/txdb.h | 26 +- src/txmempool.cpp | 26 +- src/txmempool.h | 25 +- src/uint256.cpp | 25 +- src/uint256.h | 26 +- src/undo.h | 26 +- src/util/logger.cpp | 7 + src/util/logger.h | 8 +- src/util/util.cpp | 25 +- src/util/util.h | 25 +- src/util/utilmoneystr.cpp | 25 +- src/util/utilmoneystr.h | 25 +- src/util/utilstrencodings.cpp | 25 +- src/util/utilstrencodings.h | 25 +- src/util/utiltime.cpp | 25 +- src/util/utiltime.h | 25 +- src/validationinterface.cpp | 25 +- src/validationinterface.h | 25 +- src/verifydb.cpp | 25 +- src/verifydb.h | 25 +- src/version.h | 25 +- src/wallet/crypter.cpp | 25 +- src/wallet/crypter.h | 25 +- src/wallet/db.cpp | 25 +- src/wallet/db.h | 25 +- src/wallet/wallet.cpp | 25 +- src/wallet/wallet.h | 25 +- src/wallet/wallet_ismine.cpp | 25 +- src/wallet/wallet_ismine.h | 25 +- src/wallet/walletdb.cpp | 25 +- src/wallet/walletdb.h | 25 +- 222 files changed, 1295 insertions(+), 4472 deletions(-) create mode 100644 COPYING delete mode 100644 LICENSE diff --git a/COPYING b/COPYING new file mode 100644 index 00000000..6aa09965 --- /dev/null +++ b/COPYING @@ -0,0 +1,26 @@ +The MIT License (MIT) + +Copyright (c) 2009 Satoshi Nakamoto +Copyright (c) 2009-2016 Bitcoin Developers +Copyright (c) 2009-2016 The Bitcoin Core developers +Copyright (c) 2015-2019 The Bitcoin Unlimited developers +Copyright (c) 2014-2019 The Eccoin developers + + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 94a9ed02..00000000 --- a/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/src/amount.cpp b/src/amount.cpp index 874961c4..74fbaffc 100644 --- a/src/amount.cpp +++ b/src/amount.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "amount.h" diff --git a/src/amount.h b/src/amount.h index d82b827a..c617e3f6 100644 --- a/src/amount.h +++ b/src/amount.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_AMOUNT_H #define BITCOIN_AMOUNT_H diff --git a/src/args.cpp b/src/args.cpp index 33574851..31739721 100644 --- a/src/args.cpp +++ b/src/args.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "args.h" #include "util/util.h" diff --git a/src/args.h b/src/args.h index 47ff03e5..3fc9c39e 100644 --- a/src/args.h +++ b/src/args.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef ECCOIN_ARGS_H #define ECCOIN_ARGS_H diff --git a/src/arith_uint256.cpp b/src/arith_uint256.cpp index ab0e79dc..1f1c06f1 100644 --- a/src/arith_uint256.cpp +++ b/src/arith_uint256.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "arith_uint256.h" diff --git a/src/arith_uint256.h b/src/arith_uint256.h index 797e8a28..81253406 100644 --- a/src/arith_uint256.h +++ b/src/arith_uint256.h @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef BITCOIN_ARITH_UINT256_H #define BITCOIN_ARITH_UINT256_H diff --git a/src/base58.cpp b/src/base58.cpp index b540d2dc..fb2804ac 100644 --- a/src/base58.cpp +++ b/src/base58.cpp @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2014-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2014-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "base58.h" diff --git a/src/base58.h b/src/base58.h index 0d9aab22..2386801c 100644 --- a/src/base58.h +++ b/src/base58.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. /** * Why base-58 instead of standard base-64 encoding? diff --git a/src/blockgeneration/blockgeneration.cpp b/src/blockgeneration/blockgeneration.cpp index 8354be76..843d00f5 100644 --- a/src/blockgeneration/blockgeneration.cpp +++ b/src/blockgeneration/blockgeneration.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "blockgeneration.h" #include "compare.h" diff --git a/src/blockgeneration/blockgeneration.h b/src/blockgeneration/blockgeneration.h index 7d7af4ab..cc11d898 100644 --- a/src/blockgeneration/blockgeneration.h +++ b/src/blockgeneration/blockgeneration.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "chain/chain.h" #include "consensus/params.h" diff --git a/src/blockgeneration/compare.h b/src/blockgeneration/compare.h index 00b6f640..d9802e6b 100644 --- a/src/blockgeneration/compare.h +++ b/src/blockgeneration/compare.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef ECCOIN_COMPARE_H #define ECCOIN_COMPARE_H diff --git a/src/blockgeneration/miner.cpp b/src/blockgeneration/miner.cpp index 37761025..64630331 100644 --- a/src/blockgeneration/miner.cpp +++ b/src/blockgeneration/miner.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "miner.h" #include "args.h" diff --git a/src/blockgeneration/miner.h b/src/blockgeneration/miner.h index 4284b0ae..d15969ac 100644 --- a/src/blockgeneration/miner.h +++ b/src/blockgeneration/miner.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef ECCOIN_MINER_H #define ECCOIN_MINER_H diff --git a/src/blockgeneration/minter.cpp b/src/blockgeneration/minter.cpp index df7615af..e70044f2 100644 --- a/src/blockgeneration/minter.cpp +++ b/src/blockgeneration/minter.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "minter.h" diff --git a/src/blockgeneration/minter.h b/src/blockgeneration/minter.h index f8c4b910..ae4cd55b 100644 --- a/src/blockgeneration/minter.h +++ b/src/blockgeneration/minter.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef ECCOIN_MINTER_H #define ECCOIN_MINTER_H diff --git a/src/blockstorage/blockstorage.cpp b/src/blockstorage/blockstorage.cpp index 4b595e21..1f752faa 100644 --- a/src/blockstorage/blockstorage.cpp +++ b/src/blockstorage/blockstorage.cpp @@ -1,3 +1,10 @@ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2019 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "blockstorage.h" #include "clientversion.h" diff --git a/src/blockstorage/blockstorage.h b/src/blockstorage/blockstorage.h index 0fa22f80..30deb433 100644 --- a/src/blockstorage/blockstorage.h +++ b/src/blockstorage/blockstorage.h @@ -1,3 +1,9 @@ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2019 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_BLOCK_STORAGE_H #define BITCOIN_BLOCK_STORAGE_H diff --git a/src/bloom.cpp b/src/bloom.cpp index f5cbbcbb..1aaf1de3 100644 --- a/src/bloom.cpp +++ b/src/bloom.cpp @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 20012-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 20012-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "bloom.h" diff --git a/src/bloom.h b/src/bloom.h index c7f73eac..df9fd29c 100644 --- a/src/bloom.h +++ b/src/bloom.h @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2012-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2012-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_BLOOM_H #define BITCOIN_BLOOM_H diff --git a/src/chain/block.cpp b/src/chain/block.cpp index 85710ced..cffad4fe 100644 --- a/src/chain/block.cpp +++ b/src/chain/block.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "chain/chain.h" #include "crypto/common.h" diff --git a/src/chain/block.h b/src/chain/block.h index 1d25cb66..8dba807d 100644 --- a/src/chain/block.h +++ b/src/chain/block.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_PRIMITIVES_BLOCK_H #define BITCOIN_PRIMITIVES_BLOCK_H diff --git a/src/chain/blockindex.cpp b/src/chain/blockindex.cpp index 862a94c0..7ef15185 100644 --- a/src/chain/blockindex.cpp +++ b/src/chain/blockindex.cpp @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "blockindex.h" diff --git a/src/chain/blockindex.h b/src/chain/blockindex.h index 7f4c7a3c..a3299a51 100644 --- a/src/chain/blockindex.h +++ b/src/chain/blockindex.h @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef BLOCKINDEX_H #define BLOCKINDEX_H diff --git a/src/chain/chain.cpp b/src/chain/chain.cpp index b2e8bdf4..54a950eb 100644 --- a/src/chain/chain.cpp +++ b/src/chain/chain.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "chain.h" diff --git a/src/chain/chain.h b/src/chain/chain.h index b08ff61f..dfad6f8d 100644 --- a/src/chain/chain.h +++ b/src/chain/chain.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CHAIN_H #define BITCOIN_CHAIN_H diff --git a/src/chain/chainman.cpp b/src/chain/chainman.cpp index b98afb5c..7b0edb11 100644 --- a/src/chain/chainman.cpp +++ b/src/chain/chainman.cpp @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2017-2018 Greg Griffith - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2017-2018 Greg Griffith +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "chainman.h" diff --git a/src/chain/chainman.h b/src/chain/chainman.h index 38c55825..559752bc 100644 --- a/src/chain/chainman.h +++ b/src/chain/chainman.h @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2017-2018 Greg Griffith - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2017-2018 Greg Griffith +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef CHAINMAN_H #define CHAINMAN_H diff --git a/src/chain/checkpoints.cpp b/src/chain/checkpoints.cpp index 6fe33f58..9589241b 100644 --- a/src/chain/checkpoints.cpp +++ b/src/chain/checkpoints.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "checkpoints.h" diff --git a/src/chain/checkpoints.h b/src/chain/checkpoints.h index 515d9f30..f61753a4 100644 --- a/src/chain/checkpoints.h +++ b/src/chain/checkpoints.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CHECKPOINTS_H #define BITCOIN_CHECKPOINTS_H diff --git a/src/chain/outpoint.h b/src/chain/outpoint.h index 22ac4475..1d7635bd 100644 --- a/src/chain/outpoint.h +++ b/src/chain/outpoint.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef OUTPOINT_H #define OUTPOINT_H diff --git a/src/chain/tx.cpp b/src/chain/tx.cpp index f111539a..aec15d73 100644 --- a/src/chain/tx.cpp +++ b/src/chain/tx.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "chain/tx.h" diff --git a/src/chain/tx.h b/src/chain/tx.h index 15256b14..de384585 100644 --- a/src/chain/tx.h +++ b/src/chain/tx.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_PRIMITIVES_TRANSACTION_H #define BITCOIN_PRIMITIVES_TRANSACTION_H diff --git a/src/chain/txin.h b/src/chain/txin.h index f8c394f9..894b4147 100644 --- a/src/chain/txin.h +++ b/src/chain/txin.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef TXIN_H #define TXIN_H diff --git a/src/chain/txout.h b/src/chain/txout.h index 99f86718..fd282a76 100644 --- a/src/chain/txout.h +++ b/src/chain/txout.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef TXOUT_H #define TXOUT_H diff --git a/src/checkqueue.h b/src/checkqueue.h index aea7d0d4..b376be1c 100644 --- a/src/checkqueue.h +++ b/src/checkqueue.h @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2012-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2012-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CHECKQUEUE_H #define BITCOIN_CHECKQUEUE_H diff --git a/src/clientversion.cpp b/src/clientversion.cpp index 2873a45d..e0d79139 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -1,21 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2012-2014 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2012-2014 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "clientversion.h" #include "tinyformat.h" diff --git a/src/clientversion.h b/src/clientversion.h index 3f54e4bb..bc006d67 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CLIENTVERSION_H #define BITCOIN_CLIENTVERSION_H diff --git a/src/coins.cpp b/src/coins.cpp index 9f95dd17..519248cc 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "coins.h" diff --git a/src/coins.h b/src/coins.h index 7a3e96d0..e974f692 100644 --- a/src/coins.h +++ b/src/coins.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_COINS_H #define BITCOIN_COINS_H diff --git a/src/compat.h b/src/compat.h index 97faffd1..76f750b9 100644 --- a/src/compat.h +++ b/src/compat.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_COMPAT_H #define BITCOIN_COMPAT_H diff --git a/src/compat/byteswap.h b/src/compat/byteswap.h index f53d23dc..31d03e9d 100644 --- a/src/compat/byteswap.h +++ b/src/compat/byteswap.h @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2014-2017 The Bitcoin Core developers - * Copyright (c) 20117-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2014-2017 The Bitcoin Core developers +// Copyright (c) 20117-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_COMPAT_BYTESWAP_H #define BITCOIN_COMPAT_BYTESWAP_H diff --git a/src/compat/ecc_endian.h b/src/compat/ecc_endian.h index cd3c5022..4382f812 100644 --- a/src/compat/ecc_endian.h +++ b/src/compat/ecc_endian.h @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2014-2017 The Bitcoin Core developers - * Copyright (c) 2017-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2014-2017 The Bitcoin Core developers +// Copyright (c) 2017-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_COMPAT_ENDIAN_H #define BITCOIN_COMPAT_ENDIAN_H diff --git a/src/compat/glibc_compat.cpp b/src/compat/glibc_compat.cpp index f1846c10..ae55ada0 100644 --- a/src/compat/glibc_compat.cpp +++ b/src/compat/glibc_compat.cpp @@ -1,3 +1,4 @@ +// This file is part of the Eccoin project // Copyright (c) 2009-2014 The Bitcoin Core developers // Copyright (c) 2015-2018 The Bitcoin Unlimited developers // Distributed under the MIT software license, see the accompanying diff --git a/src/compat/glibc_sanity.cpp b/src/compat/glibc_sanity.cpp index 0d02a8c2..54e7176a 100644 --- a/src/compat/glibc_sanity.cpp +++ b/src/compat/glibc_sanity.cpp @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include diff --git a/src/compat/glibcxx_sanity.cpp b/src/compat/glibcxx_sanity.cpp index 69a26201..7b458069 100644 --- a/src/compat/glibcxx_sanity.cpp +++ b/src/compat/glibcxx_sanity.cpp @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include #include diff --git a/src/compat/sanity.h b/src/compat/sanity.h index d0af85ef..c4078aef 100644 --- a/src/compat/sanity.h +++ b/src/compat/sanity.h @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2017 The Bitcoin Core developers - * Copyright (c) 2017-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2017 The Bitcoin Core developers +// Copyright (c) 2017-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_COMPAT_SANITY_H #define BITCOIN_COMPAT_SANITY_H diff --git a/src/compat/strnlen.cpp b/src/compat/strnlen.cpp index 31c593da..8f49642b 100644 --- a/src/compat/strnlen.cpp +++ b/src/compat/strnlen.cpp @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include diff --git a/src/compressor.cpp b/src/compressor.cpp index a25cacc3..cbb141da 100644 --- a/src/compressor.cpp +++ b/src/compressor.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "compressor.h" diff --git a/src/compressor.h b/src/compressor.h index 3199372e..22e617eb 100644 --- a/src/compressor.h +++ b/src/compressor.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_COMPRESSOR_H #define BITCOIN_COMPRESSOR_H diff --git a/src/consensus/consensus.h b/src/consensus/consensus.h index 77100ec5..99a248d0 100644 --- a/src/consensus/consensus.h +++ b/src/consensus/consensus.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2017 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2017 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CONSENSUS_CONSENSUS_H #define BITCOIN_CONSENSUS_CONSENSUS_H diff --git a/src/consensus/merkle.cpp b/src/consensus/merkle.cpp index ee08f329..abdb7c74 100644 --- a/src/consensus/merkle.cpp +++ b/src/consensus/merkle.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "merkle.h" #include "crypto/hash.h" diff --git a/src/consensus/merkle.h b/src/consensus/merkle.h index fbb20300..a098fc9a 100644 --- a/src/consensus/merkle.h +++ b/src/consensus/merkle.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_MERKLE #define BITCOIN_MERKLE diff --git a/src/consensus/params.h b/src/consensus/params.h index 8351af58..06e0364e 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CONSENSUS_PARAMS_H #define BITCOIN_CONSENSUS_PARAMS_H diff --git a/src/consensus/validation.h b/src/consensus/validation.h index 15c12534..516974bb 100644 --- a/src/consensus/validation.h +++ b/src/consensus/validation.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CONSENSUS_VALIDATION_H #define BITCOIN_CONSENSUS_VALIDATION_H diff --git a/src/core_io.h b/src/core_io.h index 8cd55c09..d7c15fc0 100644 --- a/src/core_io.h +++ b/src/core_io.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CORE_IO_H #define BITCOIN_CORE_IO_H diff --git a/src/core_memusage.h b/src/core_memusage.h index 171030a8..901b2066 100644 --- a/src/core_memusage.h +++ b/src/core_memusage.h @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2015-2017 The Bitcoin Core developers - * Copyright (c) 2017-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2015-2017 The Bitcoin Core developers +// Copyright (c) 2017-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CORE_MEMUSAGE_H #define BITCOIN_CORE_MEMUSAGE_H diff --git a/src/core_read.cpp b/src/core_read.cpp index 63a28146..b1a9f8e9 100644 --- a/src/core_read.cpp +++ b/src/core_read.cpp @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "core_io.h" diff --git a/src/core_write.cpp b/src/core_write.cpp index 0cfcaa1b..9bd628e5 100644 --- a/src/core_write.cpp +++ b/src/core_write.cpp @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "core_io.h" diff --git a/src/crypto/chacha20.cpp b/src/crypto/chacha20.cpp index a989981a..9bda1089 100644 --- a/src/crypto/chacha20.cpp +++ b/src/crypto/chacha20.cpp @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2017-2018 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2017-2018 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. // Based on the public domain implementation 'merged' by D. J. Bernstein // See https://cr.yp.to/chacha.html. diff --git a/src/crypto/chacha20.h b/src/crypto/chacha20.h index e4d8efd0..24c51fda 100644 --- a/src/crypto/chacha20.h +++ b/src/crypto/chacha20.h @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2017-2018 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2017-2018 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CRYPTO_CHACHA20_H #define BITCOIN_CRYPTO_CHACHA20_H diff --git a/src/crypto/common.h b/src/crypto/common.h index adb541d2..1fd28b6a 100644 --- a/src/crypto/common.h +++ b/src/crypto/common.h @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2014-2017 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2014-2017 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CRYPTO_COMMON_H #define BITCOIN_CRYPTO_COMMON_H diff --git a/src/crypto/hash.cpp b/src/crypto/hash.cpp index ec0d36d7..30fd3aa9 100644 --- a/src/crypto/hash.cpp +++ b/src/crypto/hash.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "crypto/hash.h" #include "crypto/common.h" diff --git a/src/crypto/hash.h b/src/crypto/hash.h index 137fe820..5d8356c8 100644 --- a/src/crypto/hash.h +++ b/src/crypto/hash.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_HASH_H #define BITCOIN_HASH_H diff --git a/src/crypto/hmac_sha256.cpp b/src/crypto/hmac_sha256.cpp index 2e738257..7f19a52e 100644 --- a/src/crypto/hmac_sha256.cpp +++ b/src/crypto/hmac_sha256.cpp @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2014-2018 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2014-2018 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "crypto/hmac_sha256.h" diff --git a/src/crypto/hmac_sha256.h b/src/crypto/hmac_sha256.h index 8f0f9e9e..a0e01e89 100644 --- a/src/crypto/hmac_sha256.h +++ b/src/crypto/hmac_sha256.h @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2014-2018 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2014-2018 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CRYPTO_HMAC_SHA256_H #define BITCOIN_CRYPTO_HMAC_SHA256_H diff --git a/src/crypto/hmac_sha512.cpp b/src/crypto/hmac_sha512.cpp index a55a88fd..34852ab7 100644 --- a/src/crypto/hmac_sha512.cpp +++ b/src/crypto/hmac_sha512.cpp @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2014-2018 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2014-2018 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "crypto/hmac_sha512.h" diff --git a/src/crypto/hmac_sha512.h b/src/crypto/hmac_sha512.h index 55edfe45..e6a81a25 100644 --- a/src/crypto/hmac_sha512.h +++ b/src/crypto/hmac_sha512.h @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2014-2018 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2014-2018 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CRYPTO_HMAC_SHA512_H #define BITCOIN_CRYPTO_HMAC_SHA512_H diff --git a/src/crypto/pbkdf2.cpp b/src/crypto/pbkdf2.cpp index 09123029..0413b518 100644 --- a/src/crypto/pbkdf2.cpp +++ b/src/crypto/pbkdf2.cpp @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2013 The NovaCoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2013 The NovaCoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include #include "pbkdf2.h" diff --git a/src/crypto/pbkdf2.h b/src/crypto/pbkdf2.h index 8b759cb3..2d928c96 100644 --- a/src/crypto/pbkdf2.h +++ b/src/crypto/pbkdf2.h @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2013 The NovaCoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2013 The NovaCoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef PBKDF2_H #define PBKDF2_H diff --git a/src/crypto/ripemd160.cpp b/src/crypto/ripemd160.cpp index 2ec7ad95..d8c03261 100644 --- a/src/crypto/ripemd160.cpp +++ b/src/crypto/ripemd160.cpp @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2014-2018 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2014-2018 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "crypto/ripemd160.h" diff --git a/src/crypto/ripemd160.h b/src/crypto/ripemd160.h index ce2b59e3..310aa413 100644 --- a/src/crypto/ripemd160.h +++ b/src/crypto/ripemd160.h @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2014-2018 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2014-2018 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CRYPTO_RIPEMD160_H #define BITCOIN_CRYPTO_RIPEMD160_H diff --git a/src/crypto/scrypt.h b/src/crypto/scrypt.h index f5a20628..cf38be9c 100644 --- a/src/crypto/scrypt.h +++ b/src/crypto/scrypt.h @@ -1,3 +1,32 @@ +/*- + * Copyright 2009 Colin Percival, 2011 ArtForz, 2011 pooler, 2013 Balthazar + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file was originally written by Colin Percival as part of the Tarsnap + * online backup system. + */ + #ifndef SCRYPT_H #define SCRYPT_H diff --git a/src/crypto/sha1.cpp b/src/crypto/sha1.cpp index 68f30435..8f028446 100644 --- a/src/crypto/sha1.cpp +++ b/src/crypto/sha1.cpp @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2014-2018 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2014-2018 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "crypto/sha1.h" diff --git a/src/crypto/sha1.h b/src/crypto/sha1.h index 6084c913..475ea269 100644 --- a/src/crypto/sha1.h +++ b/src/crypto/sha1.h @@ -1,20 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2014-2018 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2014-2018 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef BITCOIN_CRYPTO_SHA1_H #define BITCOIN_CRYPTO_SHA1_H diff --git a/src/crypto/sha256.cpp b/src/crypto/sha256.cpp index 7081bd15..8102189c 100644 --- a/src/crypto/sha256.cpp +++ b/src/crypto/sha256.cpp @@ -1,20 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2014-2018 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2014-2018 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "crypto/sha256.h" diff --git a/src/crypto/sha256.h b/src/crypto/sha256.h index 852875a1..9d5abc6e 100644 --- a/src/crypto/sha256.h +++ b/src/crypto/sha256.h @@ -1,20 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2014-2018 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2014-2018 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef BITCOIN_CRYPTO_SHA256_H #define BITCOIN_CRYPTO_SHA256_H diff --git a/src/crypto/sha512.cpp b/src/crypto/sha512.cpp index abacc1ba..e9599263 100644 --- a/src/crypto/sha512.cpp +++ b/src/crypto/sha512.cpp @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2014-2018 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2014-2018 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "crypto/sha512.h" diff --git a/src/crypto/sha512.h b/src/crypto/sha512.h index 551437ae..726540e4 100644 --- a/src/crypto/sha512.h +++ b/src/crypto/sha512.h @@ -1,20 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2014-2017 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2014-2017 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef BITCOIN_CRYPTO_SHA512_H #define BITCOIN_CRYPTO_SHA512_H diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp index 78ae2bb7..ab9b0046 100644 --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2012-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2012-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "dbwrapper.h" diff --git a/src/dbwrapper.h b/src/dbwrapper.h index 9eb2d348..ac8efc78 100644 --- a/src/dbwrapper.h +++ b/src/dbwrapper.h @@ -1,22 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2012-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - +// This file is part of the Eccoin project +// Copyright (c) 2012-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_DBWRAPPER_H #define BITCOIN_DBWRAPPER_H diff --git a/src/eccoind.cpp b/src/eccoind.cpp index 22a5e4dc..1c0807b7 100644 --- a/src/eccoind.cpp +++ b/src/eccoind.cpp @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "args.h" #include "clientversion.h" diff --git a/src/fs.cpp b/src/fs.cpp index a81e6efe..8ecfc7e8 100644 --- a/src/fs.cpp +++ b/src/fs.cpp @@ -1,3 +1,9 @@ +// This file is part of the Eccoin project +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "fs.h" #include diff --git a/src/fs.h b/src/fs.h index 619f2ffb..420317f8 100644 --- a/src/fs.h +++ b/src/fs.h @@ -1,3 +1,9 @@ +// This file is part of the Eccoin project +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef ECCOIN_FS_H #define ECCOIN_FS_H diff --git a/src/globals.cpp b/src/globals.cpp index 8b26e833..7edb2d45 100644 --- a/src/globals.cpp +++ b/src/globals.cpp @@ -1,3 +1,4 @@ +// This file is part of the Eccoin project // Copyright (c) 2019 The Eccoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/httprpc.cpp b/src/httprpc.cpp index b76b79e1..2847f81b 100644 --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2015-2017 The Bitcoin Core developers - * Copyright (c) 2017-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2015-2017 The Bitcoin Core developers +// Copyright (c) 2017-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "httprpc.h" diff --git a/src/httprpc.h b/src/httprpc.h index 9097b413..fb1b3f79 100644 --- a/src/httprpc.h +++ b/src/httprpc.h @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2015-2017 The Bitcoin Core developers - * Copyright (c) 2017-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2015-2017 The Bitcoin Core developers +// Copyright (c) 2017-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_HTTPRPC_H #define BITCOIN_HTTPRPC_H diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 8b013ebd..dd6c2ab4 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2015-2017 The Bitcoin Core developers - * Copyright (c) 2017-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2015-2017 The Bitcoin Core developers +// Copyright (c) 2017-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "compat.h" diff --git a/src/httpserver.h b/src/httpserver.h index fb976ea0..a3e132d3 100644 --- a/src/httpserver.h +++ b/src/httpserver.h @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2015-2017 The Bitcoin Core developers - * Copyright (c) 2017-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2015-2017 The Bitcoin Core developers +// Copyright (c) 2017-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_HTTPSERVER_H #define BITCOIN_HTTPSERVER_H diff --git a/src/init.cpp b/src/init.cpp index 98b62622..f3d32df8 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "init.h" diff --git a/src/init.h b/src/init.h index e4daa57d..e4f702d4 100644 --- a/src/init.h +++ b/src/init.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_INIT_H #define BITCOIN_INIT_H diff --git a/src/kernel.cpp b/src/kernel.cpp index fd3ec153..ac9c82a5 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2012-2013 The PPCoin developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2012-2013 The PPCoin developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include diff --git a/src/kernel.h b/src/kernel.h index 64cde891..c0845174 100644 --- a/src/kernel.h +++ b/src/kernel.h @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2012-2013 The PPCoin developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2012-2013 The PPCoin developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef PPCOIN_KERNEL_H #define PPCOIN_KERNEL_H diff --git a/src/key.cpp b/src/key.cpp index 2d240111..6b797302 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2017 The Bitcoin Core developers - * Copyright (c) 2015-2017 The Bitcoin Unlimited developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2017 The Bitcoin Core developers +// Copyright (c) 2015-2017 The Bitcoin Unlimited developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "key.h" diff --git a/src/key.h b/src/key.h index 6c27ddbf..0f2d6497 100644 --- a/src/key.h +++ b/src/key.h @@ -1,23 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2015-2017 The Bitcoin Unlimited developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2015-2017 The Bitcoin Unlimited developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_KEY_H #define BITCOIN_KEY_H diff --git a/src/keystore.cpp b/src/keystore.cpp index ecdae4a8..f3f02a53 100644 --- a/src/keystore.cpp +++ b/src/keystore.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "keystore.h" diff --git a/src/keystore.h b/src/keystore.h index 9d1e9c1f..3802ddb2 100644 --- a/src/keystore.h +++ b/src/keystore.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_KEYSTORE_H #define BITCOIN_KEYSTORE_H diff --git a/src/limitedmap.h b/src/limitedmap.h index aab08d7e..535ea698 100644 --- a/src/limitedmap.h +++ b/src/limitedmap.h @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2015-2017 The Bitcoin Core developers - * Copyright (c) 2017-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2015-2017 The Bitcoin Core developers +// Copyright (c) 2017-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_LIMITEDMAP_H #define BITCOIN_LIMITEDMAP_H diff --git a/src/main.cpp b/src/main.cpp index a7086dc4..e1fb8f37 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "main.h" diff --git a/src/main.h b/src/main.h index 4616ee74..317ef4e3 100644 --- a/src/main.h +++ b/src/main.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_MAIN_H #define BITCOIN_MAIN_H diff --git a/src/memusage.h b/src/memusage.h index 04054f58..424e6124 100644 --- a/src/memusage.h +++ b/src/memusage.h @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2015-2017 The Bitcoin Core developers - * Copyright (c) 2017-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2015-2017 The Bitcoin Core developers +// Copyright (c) 2017-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_MEMUSAGE_H #define BITCOIN_MEMUSAGE_H diff --git a/src/merkleblock.cpp b/src/merkleblock.cpp index 1064210f..7b8e74d4 100644 --- a/src/merkleblock.cpp +++ b/src/merkleblock.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "merkleblock.h" diff --git a/src/merkleblock.h b/src/merkleblock.h index 5032aa95..6003ea5b 100644 --- a/src/merkleblock.h +++ b/src/merkleblock.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_MERKLEBLOCK_H #define BITCOIN_MERKLEBLOCK_H diff --git a/src/net/addrdb.cpp b/src/net/addrdb.cpp index f04316e3..e3827861 100644 --- a/src/net/addrdb.cpp +++ b/src/net/addrdb.cpp @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "addrdb.h" diff --git a/src/net/addrdb.h b/src/net/addrdb.h index 46538344..75fc03e7 100644 --- a/src/net/addrdb.h +++ b/src/net/addrdb.h @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef BITCOIN_ADDRDB_H #define BITCOIN_ADDRDB_H diff --git a/src/net/addrman.cpp b/src/net/addrman.cpp index c158f868..9988d903 100644 --- a/src/net/addrman.cpp +++ b/src/net/addrman.cpp @@ -1,21 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2012 Pieter Wuille - * Copyright (c) 2012-2016 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2012 Pieter Wuille +// Copyright (c) 2012-2016 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "net/addrman.h" diff --git a/src/net/addrman.h b/src/net/addrman.h index 2e33bd0b..ae4c0705 100644 --- a/src/net/addrman.h +++ b/src/net/addrman.h @@ -1,21 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2012 Pieter Wuille - * Copyright (c) 2012-2016 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2012 Pieter Wuille +// Copyright (c) 2012-2016 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef BITCOIN_ADDRMAN_H #define BITCOIN_ADDRMAN_H diff --git a/src/net/messages.cpp b/src/net/messages.cpp index 69fb6d87..05eb38cc 100644 --- a/src/net/messages.cpp +++ b/src/net/messages.cpp @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "net/messages.h" diff --git a/src/net/messages.h b/src/net/messages.h index f0bb7e4c..d734392c 100644 --- a/src/net/messages.h +++ b/src/net/messages.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef MESSAGES_H #define MESSAGES_H diff --git a/src/net/net.cpp b/src/net/net.cpp index 0e6dae32..556d2954 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "net/net.h" diff --git a/src/net/net.h b/src/net/net.h index 08c23c69..3f4bc4bd 100644 --- a/src/net/net.h +++ b/src/net/net.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_NET_H #define BITCOIN_NET_H diff --git a/src/net/netaddress.cpp b/src/net/netaddress.cpp index 3710f5a7..196471a2 100644 --- a/src/net/netaddress.cpp +++ b/src/net/netaddress.cpp @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifdef HAVE_CONFIG_H #include "config/bitcoin-config.h" diff --git a/src/net/netaddress.h b/src/net/netaddress.h index d91e020c..9bd9403e 100644 --- a/src/net/netaddress.h +++ b/src/net/netaddress.h @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef BITCOIN_NETADDRESS_H #define BITCOIN_NETADDRESS_H diff --git a/src/net/netbase.cpp b/src/net/netbase.cpp index 7acce903..446ed0e9 100644 --- a/src/net/netbase.cpp +++ b/src/net/netbase.cpp @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifdef HAVE_CONFIG_H #include "config/bitcoin-config.h" diff --git a/src/net/netbase.h b/src/net/netbase.h index 47b81d7c..49109d2e 100644 --- a/src/net/netbase.h +++ b/src/net/netbase.h @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef BITCOIN_NETBASE_H #define BITCOIN_NETBASE_H diff --git a/src/net/nodestate.cpp b/src/net/nodestate.cpp index 8b17fc8c..792a7100 100644 --- a/src/net/nodestate.cpp +++ b/src/net/nodestate.cpp @@ -1,3 +1,11 @@ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2016 The Bitcoin Unlimited developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "nodestate.h" CNodesStateManager nodestateman; diff --git a/src/net/nodestate.h b/src/net/nodestate.h index 2718b5d8..cd7c491c 100644 --- a/src/net/nodestate.h +++ b/src/net/nodestate.h @@ -1,3 +1,12 @@ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2016 The Bitcoin Unlimited developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + + #include "messages.h" #include "net.h" diff --git a/src/net/protocol.cpp b/src/net/protocol.cpp index 5452d649..f966e216 100644 --- a/src/net/protocol.cpp +++ b/src/net/protocol.cpp @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "net/protocol.h" diff --git a/src/net/protocol.h b/src/net/protocol.h index 293d3789..b7f26121 100644 --- a/src/net/protocol.h +++ b/src/net/protocol.h @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef __cplusplus #error This header can only be compiled as C++. diff --git a/src/networks/netman.cpp b/src/networks/netman.cpp index 2e09cc5e..8d019dfc 100644 --- a/src/networks/netman.cpp +++ b/src/networks/netman.cpp @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2017-2018 Greg Griffith - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2017-2018 Greg Griffith +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "netman.h" #include "args.h" diff --git a/src/networks/netman.h b/src/networks/netman.h index a1d73050..2df438fe 100644 --- a/src/networks/netman.h +++ b/src/networks/netman.h @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2017-2018 Greg Griffith - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2017-2018 Greg Griffith +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CHAINPARAMSBASE_H #define BITCOIN_CHAINPARAMSBASE_H diff --git a/src/networks/network.h b/src/networks/network.h index 38e719dd..6fcd1d32 100644 --- a/src/networks/network.h +++ b/src/networks/network.h @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2017-2018 Greg Griffith - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2017-2018 Greg Griffith +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef NETWORK_H #define NETWORK_H diff --git a/src/networks/networktemplate.h b/src/networks/networktemplate.h index fd1a4b7c..765a443d 100644 --- a/src/networks/networktemplate.h +++ b/src/networks/networktemplate.h @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2017-2018 Greg Griffith - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2017-2018 Greg Griffith +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CHAINPARAMS_H #define BITCOIN_CHAINPARAMS_H diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp index 8e2d50dd..e402c0fa 100644 --- a/src/policy/fees.cpp +++ b/src/policy/fees.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "policy/fees.h" #include "policy/policy.h" diff --git a/src/policy/fees.h b/src/policy/fees.h index bd2b5793..38bbdd9f 100644 --- a/src/policy/fees.h +++ b/src/policy/fees.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_POLICYESTIMATOR_H #define BITCOIN_POLICYESTIMATOR_H diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp index da01ac11..79115f04 100644 --- a/src/policy/policy.cpp +++ b/src/policy/policy.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. // NOTE: This file is intended to be customised by the end user, and includes only local node policy logic diff --git a/src/policy/policy.h b/src/policy/policy.h index 85b7955f..7909a552 100644 --- a/src/policy/policy.h +++ b/src/policy/policy.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_POLICY_POLICY_H #define BITCOIN_POLICY_POLICY_H diff --git a/src/pow.cpp b/src/pow.cpp index 03ac9a5d..297c3768 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "pow.h" diff --git a/src/pow.h b/src/pow.h index 22761b12..edcaaf12 100644 --- a/src/pow.h +++ b/src/pow.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_POW_H #define BITCOIN_POW_H diff --git a/src/prevector.h b/src/prevector.h index 822bbb26..65f65431 100644 --- a/src/prevector.h +++ b/src/prevector.h @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2015-2016 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2015-2016 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef _BITCOIN_PREVECTOR_H_ #define _BITCOIN_PREVECTOR_H_ diff --git a/src/processblock.cpp b/src/processblock.cpp index 98d1b40b..a9e13a01 100644 --- a/src/processblock.cpp +++ b/src/processblock.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include #include diff --git a/src/processblock.h b/src/processblock.h index 81178c0b..420efd11 100644 --- a/src/processblock.h +++ b/src/processblock.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef PROCESSBLOCK_H #define PROCESSBLOCK_H diff --git a/src/processheader.cpp b/src/processheader.cpp index 75b8ccc0..5a7b90eb 100644 --- a/src/processheader.cpp +++ b/src/processheader.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "processheader.h" #include "init.h" diff --git a/src/processheader.h b/src/processheader.h index 0c7175a4..962a0dff 100644 --- a/src/processheader.h +++ b/src/processheader.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef PROCESSHEADER_H #define PROCESSHEADER_H diff --git a/src/processtx.cpp b/src/processtx.cpp index fdb42b6d..af4c3425 100644 --- a/src/processtx.cpp +++ b/src/processtx.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "base58.h" #include "consensus/consensus.h" diff --git a/src/processtx.h b/src/processtx.h index c51c25bf..aa63dd7f 100644 --- a/src/processtx.h +++ b/src/processtx.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef TXVALIDATION_H #define TXVALIDATION_H diff --git a/src/pubkey.cpp b/src/pubkey.cpp index 84f5b109..a27608bb 100644 --- a/src/pubkey.cpp +++ b/src/pubkey.cpp @@ -1,23 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2015 The Bitcoin Core developers - * Copyright (c) 2015-2017 The Bitcoin Unlimited developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2015 The Bitcoin Core developers +// Copyright (c) 2015-2017 The Bitcoin Unlimited developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "pubkey.h" diff --git a/src/pubkey.h b/src/pubkey.h index 6cbce09f..66de56c2 100644 --- a/src/pubkey.h +++ b/src/pubkey.h @@ -1,23 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2015-2017 The Bitcoin Unlimited developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2015-2017 The Bitcoin Unlimited developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_PUBKEY_H #define BITCOIN_PUBKEY_H diff --git a/src/random.cpp b/src/random.cpp index 0d351638..1cf5b8a4 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "random.h" diff --git a/src/random.h b/src/random.h index 5e9d5554..c59eac57 100644 --- a/src/random.h +++ b/src/random.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_RANDOM_H #define BITCOIN_RANDOM_H diff --git a/src/reverselock.h b/src/reverselock.h index 8902bd27..7cd11519 100644 --- a/src/reverselock.h +++ b/src/reverselock.h @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2015-2016 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2015-2016 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_REVERSELOCK_H #define BITCOIN_REVERSELOCK_H diff --git a/src/rpc/events.h b/src/rpc/events.h index d9ffe56c..5bbd6ef0 100644 --- a/src/rpc/events.h +++ b/src/rpc/events.h @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2016-2017 The Bitcoin Core developers - * Copyright (c) 2017-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2016-2017 The Bitcoin Core developers +// Copyright (c) 2017-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_SUPPORT_EVENTS_H #define BITCOIN_SUPPORT_EVENTS_H diff --git a/src/rpc/rpcblockchain.cpp b/src/rpc/rpcblockchain.cpp index ffe80c57..91668fb0 100644 --- a/src/rpc/rpcblockchain.cpp +++ b/src/rpc/rpcblockchain.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "amount.h" #include "args.h" diff --git a/src/rpc/rpcclient.cpp b/src/rpc/rpcclient.cpp index 4a05bcc4..ca12fb57 100644 --- a/src/rpc/rpcclient.cpp +++ b/src/rpc/rpcclient.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "rpcclient.h" diff --git a/src/rpc/rpcclient.h b/src/rpc/rpcclient.h index 925b41e0..ac251334 100644 --- a/src/rpc/rpcclient.h +++ b/src/rpc/rpcclient.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_RPCCLIENT_H #define BITCOIN_RPCCLIENT_H diff --git a/src/rpc/rpcdump.cpp b/src/rpc/rpcdump.cpp index fa1557b0..6387e32e 100644 --- a/src/rpc/rpcdump.cpp +++ b/src/rpc/rpcdump.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "base58.h" #include "chain/chain.h" diff --git a/src/rpc/rpcmining.cpp b/src/rpc/rpcmining.cpp index 47ac5fc7..0fce87fb 100644 --- a/src/rpc/rpcmining.cpp +++ b/src/rpc/rpcmining.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "amount.h" #include "args.h" diff --git a/src/rpc/rpcmisc.cpp b/src/rpc/rpcmisc.cpp index 3865a7ab..95549441 100644 --- a/src/rpc/rpcmisc.cpp +++ b/src/rpc/rpcmisc.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "args.h" #include "base58.h" diff --git a/src/rpc/rpcnet.cpp b/src/rpc/rpcnet.cpp index ed088c0b..e72dccf8 100644 --- a/src/rpc/rpcnet.cpp +++ b/src/rpc/rpcnet.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "rpcserver.h" diff --git a/src/rpc/rpcprotocol.cpp b/src/rpc/rpcprotocol.cpp index e25c5ce7..49c2ae5a 100644 --- a/src/rpc/rpcprotocol.cpp +++ b/src/rpc/rpcprotocol.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "rpcprotocol.h" diff --git a/src/rpc/rpcprotocol.h b/src/rpc/rpcprotocol.h index c60c1268..4f5a8b39 100644 --- a/src/rpc/rpcprotocol.h +++ b/src/rpc/rpcprotocol.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_RPCPROTOCOL_H #define BITCOIN_RPCPROTOCOL_H diff --git a/src/rpc/rpcrawtransaction.cpp b/src/rpc/rpcrawtransaction.cpp index 272e7cf4..346379e5 100644 --- a/src/rpc/rpcrawtransaction.cpp +++ b/src/rpc/rpcrawtransaction.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "base58.h" #include "blockstorage/blockstorage.h" diff --git a/src/rpc/rpcserver.cpp b/src/rpc/rpcserver.cpp index 296de1e2..23583b13 100644 --- a/src/rpc/rpcserver.cpp +++ b/src/rpc/rpcserver.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "rpcserver.h" diff --git a/src/rpc/rpcserver.h b/src/rpc/rpcserver.h index 159b491f..15d80acc 100644 --- a/src/rpc/rpcserver.h +++ b/src/rpc/rpcserver.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_RPCSERVER_H #define BITCOIN_RPCSERVER_H diff --git a/src/rpc/rpcwallet.cpp b/src/rpc/rpcwallet.cpp index d2b63a9c..235db65e 100644 --- a/src/rpc/rpcwallet.cpp +++ b/src/rpc/rpcwallet.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "amount.h" #include "base58.h" diff --git a/src/script/bitcoinconsensus.cpp b/src/script/bitcoinconsensus.cpp index f84bf7b4..94ff4f32 100644 --- a/src/script/bitcoinconsensus.cpp +++ b/src/script/bitcoinconsensus.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "bitcoinconsensus.h" diff --git a/src/script/bitcoinconsensus.h b/src/script/bitcoinconsensus.h index 7a2372f1..0748cd4b 100644 --- a/src/script/bitcoinconsensus.h +++ b/src/script/bitcoinconsensus.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_BITCOINCONSENSUS_H #define BITCOIN_BITCOINCONSENSUS_H diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 4cabb81c..721efeca 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "interpreter.h" diff --git a/src/script/interpreter.h b/src/script/interpreter.h index 2191dfe2..2e49e8f7 100644 --- a/src/script/interpreter.h +++ b/src/script/interpreter.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_SCRIPT_INTERPRETER_H #define BITCOIN_SCRIPT_INTERPRETER_H diff --git a/src/script/script.cpp b/src/script/script.cpp index bb39b773..d7a3906f 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "script.h" #include "interpreter.h" diff --git a/src/script/script.h b/src/script/script.h index 26dc5dfc..b50f67f5 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_SCRIPT_SCRIPT_H #define BITCOIN_SCRIPT_SCRIPT_H diff --git a/src/script/script_error.cpp b/src/script/script_error.cpp index 230f592c..37a31daa 100644 --- a/src/script/script_error.cpp +++ b/src/script/script_error.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "script_error.h" diff --git a/src/script/script_error.h b/src/script/script_error.h index 4c53082f..58eb9b12 100644 --- a/src/script/script_error.h +++ b/src/script/script_error.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_SCRIPT_SCRIPT_ERROR_H #define BITCOIN_SCRIPT_SCRIPT_ERROR_H diff --git a/src/script/sigcache.cpp b/src/script/sigcache.cpp index 0a090b11..97d4606d 100644 --- a/src/script/sigcache.cpp +++ b/src/script/sigcache.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "sigcache.h" diff --git a/src/script/sigcache.h b/src/script/sigcache.h index b74e40fd..13f97d92 100644 --- a/src/script/sigcache.h +++ b/src/script/sigcache.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_SCRIPT_SIGCACHE_H #define BITCOIN_SCRIPT_SIGCACHE_H diff --git a/src/script/sign.cpp b/src/script/sign.cpp index 668ce80e..49abe0c3 100644 --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "script/sign.h" diff --git a/src/script/sign.h b/src/script/sign.h index 26f52f90..25d8ed98 100644 --- a/src/script/sign.h +++ b/src/script/sign.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_SCRIPT_SIGN_H #define BITCOIN_SCRIPT_SIGN_H diff --git a/src/script/stakescript.cpp b/src/script/stakescript.cpp index 3696b801..22b55486 100644 --- a/src/script/stakescript.cpp +++ b/src/script/stakescript.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "stakescript.h" #include "args.h" diff --git a/src/script/stakescript.h b/src/script/stakescript.h index 0616f922..e57ec3db 100644 --- a/src/script/stakescript.h +++ b/src/script/stakescript.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef STAKESCRIPT_H #define STAKESCRIPT_H diff --git a/src/script/standard.cpp b/src/script/standard.cpp index 85fe1311..53847de5 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "script/standard.h" diff --git a/src/script/standard.h b/src/script/standard.h index 6d3ecbe5..91717d13 100644 --- a/src/script/standard.h +++ b/src/script/standard.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_SCRIPT_STANDARD_H #define BITCOIN_SCRIPT_STANDARD_H diff --git a/src/serialize.h b/src/serialize.h index 1bb489d8..80a8255c 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_SERIALIZE_H #define BITCOIN_SERIALIZE_H diff --git a/src/streams.h b/src/streams.h index 45ab5a38..e84edd82 100644 --- a/src/streams.h +++ b/src/streams.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_STREAMS_H #define BITCOIN_STREAMS_H diff --git a/src/support/allocators/secure.h b/src/support/allocators/secure.h index 62f6c8cf..a30222a4 100644 --- a/src/support/allocators/secure.h +++ b/src/support/allocators/secure.h @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2017 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2017 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_SUPPORT_ALLOCATORS_SECURE_H #define BITCOIN_SUPPORT_ALLOCATORS_SECURE_H diff --git a/src/support/allocators/zeroafterfree.h b/src/support/allocators/zeroafterfree.h index e1f0e799..bbee50a8 100644 --- a/src/support/allocators/zeroafterfree.h +++ b/src/support/allocators/zeroafterfree.h @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2017 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2017 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_SUPPORT_ALLOCATORS_ZEROAFTERFREE_H #define BITCOIN_SUPPORT_ALLOCATORS_ZEROAFTERFREE_H diff --git a/src/support/cleanse.cpp b/src/support/cleanse.cpp index db4b320e..06f66609 100644 --- a/src/support/cleanse.cpp +++ b/src/support/cleanse.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "cleanse.h" diff --git a/src/support/cleanse.h b/src/support/cleanse.h index 62973e1a..754178c5 100644 --- a/src/support/cleanse.h +++ b/src/support/cleanse.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_SUPPORT_CLEANSE_H #define BITCOIN_SUPPORT_CLEANSE_H diff --git a/src/support/pagelocker.cpp b/src/support/pagelocker.cpp index 3f115b8f..555a7009 100644 --- a/src/support/pagelocker.cpp +++ b/src/support/pagelocker.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "support/pagelocker.h" diff --git a/src/support/pagelocker.h b/src/support/pagelocker.h index 2baee8ac..32944291 100644 --- a/src/support/pagelocker.h +++ b/src/support/pagelocker.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_SUPPORT_PAGELOCKER_H #define BITCOIN_SUPPORT_PAGELOCKER_H diff --git a/src/sync.cpp b/src/sync.cpp index ff4ef682..a4c4d0a6 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -1,3 +1,4 @@ +// This file is part of the Eccoin project // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin Core developers // Copyright (c) 2015-2018 The Bitcoin Unlimited developers diff --git a/src/sync.h b/src/sync.h index c4ddbce4..8986a9a0 100644 --- a/src/sync.h +++ b/src/sync.h @@ -1,3 +1,4 @@ +// This file is part of the Eccoin project // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin Core developers // Copyright (c) 2015-2018 The Bitcoin Unlimited developers diff --git a/src/threaddeadlock.cpp b/src/threaddeadlock.cpp index c11d6a80..a88474ba 100644 --- a/src/threaddeadlock.cpp +++ b/src/threaddeadlock.cpp @@ -1,7 +1,9 @@ +// This file is part of the Eccoin project // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin Core developers -// Copyright (c) 2015-2019 The Bitcoin Unlimited developers +// Copyright (c) 2015-2018 The Bitcoin Unlimited developers // Copyright (c) 2019 Greg Griffith +// Copyright (c) 2019 The Eccoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/threaddeadlock.h b/src/threaddeadlock.h index d921f356..87c3ab9d 100644 --- a/src/threaddeadlock.h +++ b/src/threaddeadlock.h @@ -1,10 +1,11 @@ +// This file is part of the Eccoin project // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin Core developers -// Copyright (c) 2015-2019 The Bitcoin Unlimited developers +// Copyright (c) 2015-2018 The Bitcoin Unlimited developers // Copyright (c) 2019 Greg Griffith +// Copyright (c) 2019 The Eccoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. - #ifndef ECCOIN_THREAD_DEADLOCK_H #define ECCOIN_THREAD_DEADLOCK_H diff --git a/src/threadgroup.h b/src/threadgroup.h index ad920e1f..ce69a747 100644 --- a/src/threadgroup.h +++ b/src/threadgroup.h @@ -1,3 +1,8 @@ +// This file is part of the Eccoin project +// Copyright (c) 2019 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef ECCOIN_THREAD_GROUP_H #define ECCOIN_THREAD_GROUP_H diff --git a/src/threadsafety.h b/src/threadsafety.h index e5b8a67b..a8b42e65 100644 --- a/src/threadsafety.h +++ b/src/threadsafety.h @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef BITCOIN_THREADSAFETY_H #define BITCOIN_THREADSAFETY_H diff --git a/src/timedata.cpp b/src/timedata.cpp index b7c82b9d..d24a4fb4 100644 --- a/src/timedata.cpp +++ b/src/timedata.cpp @@ -1,21 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2014-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2014-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "timedata.h" diff --git a/src/timedata.h b/src/timedata.h index 627868f9..db8fc09c 100644 --- a/src/timedata.h +++ b/src/timedata.h @@ -1,21 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2014-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2014-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef BITCOIN_TIMEDATA_H #define BITCOIN_TIMEDATA_H diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp index 7102b72c..af832ba8 100644 --- a/src/torcontrol.cpp +++ b/src/torcontrol.cpp @@ -1,21 +1,8 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2015-2017 The Bitcoin Core developers - * Copyright (c) 2017 The Zcash developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2015-2017 The Bitcoin Core developers +// Copyright (c) 2017 The Zcash developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "torcontrol.h" diff --git a/src/torcontrol.h b/src/torcontrol.h index 803b2609..58466bb3 100644 --- a/src/torcontrol.h +++ b/src/torcontrol.h @@ -1,20 +1,7 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2015-2017 The Bitcoin Core developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2015-2017 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. /** diff --git a/src/txdb.cpp b/src/txdb.cpp index fd5880da..92b27747 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "txdb.h" diff --git a/src/txdb.h b/src/txdb.h index 08770551..e0f941df 100644 --- a/src/txdb.h +++ b/src/txdb.h @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef BITCOIN_TXDB_H #define BITCOIN_TXDB_H diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 270e483c..81fc15ac 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "txmempool.h" diff --git a/src/txmempool.h b/src/txmempool.h index cca8cfbe..6ff08e32 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2015 The Bitcoin Core developers - * Copyright (c) 2015-2018 The Bitcoin Unlimited developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2015 The Bitcoin Core developers +// Copyright (c) 2015-2018 The Bitcoin Unlimited developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_TXMEMPOOL_H #define BITCOIN_TXMEMPOOL_H diff --git a/src/uint256.cpp b/src/uint256.cpp index f9867888..7dba4735 100644 --- a/src/uint256.cpp +++ b/src/uint256.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "uint256.h" diff --git a/src/uint256.h b/src/uint256.h index f9fc3117..d0ef19ed 100644 --- a/src/uint256.h +++ b/src/uint256.h @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef BITCOIN_UINT256_H #define BITCOIN_UINT256_H diff --git a/src/undo.h b/src/undo.h index 848790d7..c3b5db2f 100644 --- a/src/undo.h +++ b/src/undo.h @@ -1,22 +1,10 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef BITCOIN_UNDO_H #define BITCOIN_UNDO_H diff --git a/src/util/logger.cpp b/src/util/logger.cpp index 88371f20..0e10c072 100644 --- a/src/util/logger.cpp +++ b/src/util/logger.cpp @@ -1,3 +1,10 @@ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2015 The Bitcoin Core developers +// Copyright (c) 2015-2018 The Bitcoin Unlimited developers +// Copyright (c) 2018-2019 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "args.h" #include "logger.h" diff --git a/src/util/logger.h b/src/util/logger.h index 63d5b3bb..cda3510e 100644 --- a/src/util/logger.h +++ b/src/util/logger.h @@ -1,4 +1,10 @@ - +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2015 The Bitcoin Core developers +// Copyright (c) 2015-2018 The Bitcoin Unlimited developers +// Copyright (c) 2018-2019 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef ECCOIN_LOGGER_H #define ECCOIN_LOGGER_H diff --git a/src/util/util.cpp b/src/util/util.cpp index a27b850d..2c9435d2 100644 --- a/src/util/util.cpp +++ b/src/util/util.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "util/util.h" #include "args.h" diff --git a/src/util/util.h b/src/util/util.h index 056886c4..1685cff6 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. /** * Server/client environment: argument handling, config file parsing, diff --git a/src/util/utilmoneystr.cpp b/src/util/utilmoneystr.cpp index 14f561ce..e3b4f4fb 100644 --- a/src/util/utilmoneystr.cpp +++ b/src/util/utilmoneystr.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "util/utilmoneystr.h" diff --git a/src/util/utilmoneystr.h b/src/util/utilmoneystr.h index e51df262..b45295dc 100644 --- a/src/util/utilmoneystr.h +++ b/src/util/utilmoneystr.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. /** * Money parsing/formatting utilities. diff --git a/src/util/utilstrencodings.cpp b/src/util/utilstrencodings.cpp index 003ec968..842e0985 100644 --- a/src/util/utilstrencodings.cpp +++ b/src/util/utilstrencodings.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "util/utilstrencodings.h" diff --git a/src/util/utilstrencodings.h b/src/util/utilstrencodings.h index e6f9a615..df51f7d8 100644 --- a/src/util/utilstrencodings.h +++ b/src/util/utilstrencodings.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. /** * Utilities for converting data from/to strings. diff --git a/src/util/utiltime.cpp b/src/util/utiltime.cpp index f4707734..a5c93958 100644 --- a/src/util/utiltime.cpp +++ b/src/util/utiltime.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "util/utiltime.h" #include diff --git a/src/util/utiltime.h b/src/util/utiltime.h index 595163c5..1327944b 100644 --- a/src/util/utiltime.h +++ b/src/util/utiltime.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_UTILTIME_H #define BITCOIN_UTILTIME_H diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp index 80a5d715..9325ae74 100644 --- a/src/validationinterface.cpp +++ b/src/validationinterface.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "validationinterface.h" diff --git a/src/validationinterface.h b/src/validationinterface.h index 4e0b70bf..be39c926 100644 --- a/src/validationinterface.h +++ b/src/validationinterface.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_VALIDATIONINTERFACE_H #define BITCOIN_VALIDATIONINTERFACE_H diff --git a/src/verifydb.cpp b/src/verifydb.cpp index 7bf48e87..24026907 100644 --- a/src/verifydb.cpp +++ b/src/verifydb.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "verifydb.h" diff --git a/src/verifydb.h b/src/verifydb.h index e15745ba..5d3e745c 100644 --- a/src/verifydb.h +++ b/src/verifydb.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef VERIFYDB_H #define VERIFYDB_H diff --git a/src/version.h b/src/version.h index 94c36676..33c3bb78 100644 --- a/src/version.h +++ b/src/version.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_VERSION_H #define BITCOIN_VERSION_H diff --git a/src/wallet/crypter.cpp b/src/wallet/crypter.cpp index c4cf6ad7..d6ed60cf 100644 --- a/src/wallet/crypter.cpp +++ b/src/wallet/crypter.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "crypter.h" diff --git a/src/wallet/crypter.h b/src/wallet/crypter.h index ba82a518..ba58dc1e 100644 --- a/src/wallet/crypter.h +++ b/src/wallet/crypter.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_WALLET_CRYPTER_H #define BITCOIN_WALLET_CRYPTER_H diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp index 91069ed9..595a5989 100644 --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "db.h" diff --git a/src/wallet/db.h b/src/wallet/db.h index 297af727..98b3f02c 100644 --- a/src/wallet/db.h +++ b/src/wallet/db.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_WALLET_DB_H #define BITCOIN_WALLET_DB_H diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 52ca9c30..ed37faf2 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "wallet/wallet.h" diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index a56f523e..bc11fb5d 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_WALLET_WALLET_H #define BITCOIN_WALLET_WALLET_H diff --git a/src/wallet/wallet_ismine.cpp b/src/wallet/wallet_ismine.cpp index 6b38f658..da6beda1 100644 --- a/src/wallet/wallet_ismine.cpp +++ b/src/wallet/wallet_ismine.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "wallet_ismine.h" diff --git a/src/wallet/wallet_ismine.h b/src/wallet/wallet_ismine.h index 8e135f64..733f3725 100644 --- a/src/wallet/wallet_ismine.h +++ b/src/wallet/wallet_ismine.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_WALLET_WALLET_ISMINE_H #define BITCOIN_WALLET_WALLET_ISMINE_H diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index 64c04054..5530ed5e 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "wallet/walletdb.h" diff --git a/src/wallet/walletdb.h b/src/wallet/walletdb.h index cd5b1f4a..3f8f8451 100644 --- a/src/wallet/walletdb.h +++ b/src/wallet/walletdb.h @@ -1,22 +1,9 @@ -/* - * This file is part of the Eccoin project - * Copyright (c) 2009-2010 Satoshi Nakamoto - * Copyright (c) 2009-2016 The Bitcoin Core developers - * Copyright (c) 2014-2018 The Eccoin developers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// This file is part of the Eccoin project +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2016 The Bitcoin Core developers +// Copyright (c) 2014-2018 The Eccoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_WALLET_WALLETDB_H #define BITCOIN_WALLET_WALLETDB_H From 8af55b360759129381f78fddfc3d0549d1904ad2 Mon Sep 17 00:00:00 2001 From: Griffith <8345264+Greg-Griffith@users.noreply.github.com> Date: Tue, 6 Aug 2019 12:23:31 -0700 Subject: [PATCH 8/8] bump version to 0.2.5.17 (#235) --- configure.ac | 2 +- contrib/gitian-descriptors/gitian-arm.yml | 2 +- contrib/gitian-descriptors/gitian-linux.yml | 2 +- contrib/gitian-descriptors/gitian-osx.yml | 2 +- contrib/gitian-descriptors/gitian-win.yml | 2 +- src/clientversion.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 3eacc0c5..69538460 100644 --- a/configure.ac +++ b/configure.ac @@ -12,7 +12,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 2) define(_CLIENT_VERSION_REVISION, 5) -define(_CLIENT_VERSION_BUILD, 16) # version 99 here indicates an unreleased version +define(_CLIENT_VERSION_BUILD, 17) # version 99 here indicates an unreleased version define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2019) define(_COPYRIGHT_HOLDERS,[The %s developers]) diff --git a/contrib/gitian-descriptors/gitian-arm.yml b/contrib/gitian-descriptors/gitian-arm.yml index 1f332bb2..49f98a97 100644 --- a/contrib/gitian-descriptors/gitian-arm.yml +++ b/contrib/gitian-descriptors/gitian-arm.yml @@ -1,5 +1,5 @@ --- -name: "eccoin-linux-0.2.5.16" +name: "eccoin-linux-0.2.5.17" enable_cache: true suites: - "bionic" diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index 417d9f99..0ecee992 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -1,5 +1,5 @@ --- -name: "eccoin-linux-0.2.5.16" +name: "eccoin-linux-0.2.5.17" enable_cache: true suites: - "bionic" diff --git a/contrib/gitian-descriptors/gitian-osx.yml b/contrib/gitian-descriptors/gitian-osx.yml index cd71fa3b..d81af90d 100644 --- a/contrib/gitian-descriptors/gitian-osx.yml +++ b/contrib/gitian-descriptors/gitian-osx.yml @@ -1,5 +1,5 @@ --- -name: "eccoin-osx-0.2.5.16" +name: "eccoin-osx-0.2.5.17" enable_cache: true suites: - "bionic" diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index 96aa4d69..1575c0a5 100644 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -1,5 +1,5 @@ --- -name: "eccoin-win-0.2.5.16" +name: "eccoin-win-0.2.5.17" enable_cache: true suites: - "bionic" diff --git a/src/clientversion.h b/src/clientversion.h index bc006d67..8f7aa136 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -21,7 +21,7 @@ #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 2 #define CLIENT_VERSION_REVISION 5 -#define CLIENT_VERSION_BUILD 16 +#define CLIENT_VERSION_BUILD 17 //! Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true