pulled in a few minor keepers from the other rebase branch

This commit is contained in:
Brannon King 2019-05-07 14:10:12 -06:00
parent 21f065aff9
commit c7cabf0e96
14 changed files with 36 additions and 47 deletions

View file

@ -7,13 +7,15 @@ if(EXISTS "build/boost")
set(BOOST_ROOT "build/boost" CACHE PATH "Boost library path")
set(Boost_NO_SYSTEM_PATHS on CACHE BOOL "Do not search system for Boost")
endif()
find_package(Boost REQUIRED COMPONENTS filesystem program_options thread chrono locale)
find_package(Boost REQUIRED COMPONENTS filesystem thread chrono locale)
file(GLOB sources
src/*.h src/*.cpp
src/wallet/*.h src/wallet/*.cpp
src/support/*.h src/support/*.cpp src/support/allocators/*.h
src/script/*.h src/script/*.cpp
src/index/*.h src/index/*.cpp
src/interfaces/*.h src/interfaces/*.cpp
src/rpc/*.h src/rpc/*.cpp
src/primitives/*.h src/primitives/*.cpp
src/policy/*.h src/policy/*.cpp
@ -50,8 +52,5 @@ add_executable(lbrycrd-tx src/bitcoin-tx.cpp ${sources})
add_executable(lbrycrdd src/bitcoind.cpp ${sources})
file(GLOB tests src/test/*.cpp)
foreach(test ${tests})
get_filename_component(filename ${test} NAME_WE)
add_executable(${filename} ${test} ${sources})
target_include_directories(${filename} PRIVATE src/test)
endforeach(test)
add_executable(test_lbrycrd ${tests} ${sources})
target_include_directories(test_lbrycrd PRIVATE src/test)

View file

@ -56,7 +56,6 @@ If you encounter any errors, please check `doc/build-*.md` for further instructi
Contributions to this project are welcome, encouraged, and compensated. For more details, see [lbry.io/faq/contributing](https://lbry.io/faq/contributing)
The codebase is in C++03. C++11 is currently not supported but we will be migrating to it in the near future. Recommended GCC version is 4.8 or greater.
We follow the same coding guidelines as documented by Bitcoin Core, see [here](/doc/developer-notes.md). To run an automated code formatting check, try:
`git diff -U0 master -- '*.h' '*.cpp' | ./contrib/devtools/clang-format-diff.py -p1`. This will check any commits not on master for proper code formatting.
We try to avoid altering parts of the code that is inherited from Bitcoin Core unless absolutely necessary. This will make it easier to merge changes from Bitcoin Core. If commits are expected not to be merged upstream (i.e. we broke up a commit from Bitcoin Core in order to use a single feature in it), the commit message must contain the string "NOT FOR UPSTREAM MERGE".

View file

@ -8,7 +8,7 @@ define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2019)
define(_COPYRIGHT_HOLDERS,[The %s developers])
define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[LBRYcrd Core]])
AC_INIT([LBRYcrd Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/bitcoin/bitcoin/issues],[bitcoin],[https://bitcoincore.org/])
AC_INIT([LBRYcrd Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/lbryio/lbrycrd/issues],[lbrycrd],[https://lbry.com/])
AC_CONFIG_SRCDIR([src/validation.cpp])
AC_CONFIG_HEADERS([src/config/bitcoin-config.h])
AC_CONFIG_AUX_DIR([build-aux])
@ -646,7 +646,9 @@ if test x$ac_cv_sys_large_files != x &&
CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files"
fi
AX_CHECK_LINK_FLAG([[-static-libstdc++]], [LDFLAGS="$LDFLAGS -static-libstdc++"])
if test x$enable_static != x; then
AX_CHECK_LINK_FLAG([[-static-libstdc++]], [LDFLAGS="$LDFLAGS -static-libstdc++"])
fi
AX_CHECK_LINK_FLAG([[-Wl,--large-address-aware]], [LDFLAGS="$LDFLAGS -Wl,--large-address-aware"])
AX_GCC_FUNC_ATTRIBUTE([visibility])
@ -1337,7 +1339,7 @@ fi
AM_CONDITIONAL([ENABLE_ZMQ], [test "x$use_zmq" = "xyes"])
AC_MSG_CHECKING([whether to build test_bitcoin])
AC_MSG_CHECKING([whether to build test_lbrycrd])
if test x$use_tests = xyes; then
AC_MSG_RESULT([yes])
BUILD_TEST="yes"

View file

@ -16,14 +16,14 @@ BEGIN
BEGIN
BLOCK "040904E4" // U.S. English - multilingual (hex)
BEGIN
VALUE "CompanyName", "Bitcoin"
VALUE "FileDescription", "bitcoin-cli (JSON-RPC client for " PACKAGE_NAME ")"
VALUE "CompanyName", "LBRY"
VALUE "FileDescription", "lbrycrd-cli (JSON-RPC client for " PACKAGE_NAME ")"
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", "bitcoin-cli"
VALUE "InternalName", "lbrycrd-cli"
VALUE "LegalCopyright", COPYRIGHT_STR
VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php."
VALUE "OriginalFilename", "bitcoin-cli.exe"
VALUE "ProductName", "bitcoin-cli"
VALUE "OriginalFilename", "lbrycrd-cli.exe"
VALUE "ProductName", "lbrycrd-cli"
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END
END

View file

@ -48,7 +48,7 @@ static void SetupCliArgs()
gArgs.AddArg("-rpcport=<port>", strprintf("Connect to JSON-RPC on <port> (default: %u or testnet: %u)", defaultBaseParams->RPCPort(), testnetBaseParams->RPCPort()), false, OptionsCategory::OPTIONS);
gArgs.AddArg("-rpcuser=<user>", "Username for JSON-RPC connections", false, OptionsCategory::OPTIONS);
gArgs.AddArg("-rpcwait", "Wait for RPC server to start", false, OptionsCategory::OPTIONS);
gArgs.AddArg("-rpcwallet=<walletname>", "Send RPC for non-default wallet on RPC server (needs to exactly match corresponding -wallet option passed to bitcoind)", false, OptionsCategory::OPTIONS);
gArgs.AddArg("-rpcwallet=<walletname>", "Send RPC for non-default wallet on RPC server (needs to exactly match corresponding -wallet option passed to lbrycrdd)", false, OptionsCategory::OPTIONS);
gArgs.AddArg("-stdin", "Read extra arguments from standard input, one per line until EOF/Ctrl-D (recommended for sensitive information such as passphrases). When combined with -stdinrpcpass, the first line from standard input is used for the RPC password.", false, OptionsCategory::OPTIONS);
gArgs.AddArg("-stdinrpcpass", "Read RPC password from standard input as a single line. When combined with -stdin, the first line from standard input is used for the RPC password.", false, OptionsCategory::OPTIONS);
@ -379,7 +379,7 @@ static UniValue CallRPC(BaseRequestHandler *rh, const std::string& strMethod, co
if (response.error != -1) {
responseErrorMessage = strprintf(" (error code %d - \"%s\")", response.error, http_errorstring(response.error));
}
throw CConnectionFailed(strprintf("Could not connect to the server %s:%d%s\n\nMake sure the bitcoind server is running and that you are connecting to the correct RPC port.", host, port, responseErrorMessage));
throw CConnectionFailed(strprintf("Could not connect to the server %s:%d%s\n\nMake sure the lbrycrdd server is running and that you are connecting to the correct RPC port.", host, port, responseErrorMessage));
} else if (response.status == HTTP_UNAUTHORIZED) {
if (failedToGetAuthCookie) {
throw std::runtime_error(strprintf(

View file

@ -16,14 +16,14 @@ BEGIN
BEGIN
BLOCK "040904E4" // U.S. English - multilingual (hex)
BEGIN
VALUE "CompanyName", "Bitcoin"
VALUE "FileDescription", "bitcoin-tx (CLI Bitcoin transaction editor utility)"
VALUE "CompanyName", "LBRY"
VALUE "FileDescription", "lbrycrd-tx (CLI LBRYcrd transaction editor utility)"
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", "bitcoin-tx"
VALUE "InternalName", "lbrycrd-tx"
VALUE "LegalCopyright", COPYRIGHT_STR
VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php."
VALUE "OriginalFilename", "bitcoin-tx.exe"
VALUE "ProductName", "bitcoin-tx"
VALUE "OriginalFilename", "lbrycrd-tx.exe"
VALUE "ProductName", "lbrycrd-tx"
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END
END

View file

@ -16,14 +16,14 @@ BEGIN
BEGIN
BLOCK "040904E4" // U.S. English - multilingual (hex)
BEGIN
VALUE "CompanyName", "Bitcoin"
VALUE "FileDescription", "bitcoind (Bitcoin node with a JSON-RPC server)"
VALUE "CompanyName", "LBRY"
VALUE "FileDescription", "lbrycrdd (LBRYcrd node with a JSON-RPC server)"
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", "bitcoind"
VALUE "InternalName", "lbrycrdd"
VALUE "LegalCopyright", COPYRIGHT_STR
VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php."
VALUE "OriginalFilename", "bitcoind.exe"
VALUE "ProductName", "bitcoind"
VALUE "OriginalFilename", "lbrycrdd.exe"
VALUE "ProductName", "lbrycrdd"
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END
END

View file

@ -61,7 +61,7 @@ static bool AppInit(int argc, char* argv[])
//
// Parameters
//
// If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main()
// If Qt is used, parameters/lbrycrd.conf are parsed in qt/bitcoin.cpp's main()
SetupServerArgs();
std::string error;
if (!gArgs.ParseParameters(argc, argv, error)) {
@ -114,7 +114,7 @@ static bool AppInit(int argc, char* argv[])
}
}
// -server defaults to true for bitcoind but not for the GUI so do this here
// -server defaults to true for lbrycrdd but not for the GUI so do this here
gArgs.SoftSetBoolArg("-server", true);
// Set this early so that parameter interactions go to console
InitLogging();
@ -185,7 +185,7 @@ int main(int argc, char* argv[])
{
SetupEnvironment();
// Connect bitcoind signal handlers
// Connect lbrycrdd signal handlers
noui_connect();
return (AppInit(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE);

View file

@ -2290,11 +2290,6 @@ int CClaimTrieCacheBase::getNumBlocksOfContinuousOwnership(const std::string& na
const CClaimTrieNode* CClaimTrieCacheBase::getNodeForName(const std::string& name) const
{
/* CClaimTrieNode* node = nullptr; */
/* nodeCacheType::const_iterator itCache = cache.find(name); */
/* if (itCache != cache.end()) */
/* node = itCache->second; */
/* return (node ? node : base->getNodeForName(name)); */
const CClaimTrieNode* node = nullptr;
nodeCacheType::const_iterator itCache = cache.find(name);
if (itCache != cache.end()) {

View file

@ -55,7 +55,7 @@ void InitOnce(OnceType* once, void (*initializer)()) {
bool HasAcceleratedCRC32C() {
#if (defined(__x86_64__) || defined(__i386__)) && defined(__GNUC__)
unsigned int eax, ebx, ecx, edx;
unsigned int eax, ebx, ecx = 0, edx;
__get_cpuid(1, &eax, &ebx, &ecx, &edx);
return (ecx & (1 << 20)) != 0;
#else

View file

@ -52,7 +52,7 @@ bool ConsumeDecimalNumber(Slice* in, uint64_t* val) {
unsigned char c = (*in)[0];
if (c >= '0' && c <= '9') {
++digits;
const int delta = (c - '0');
const unsigned int delta = (c - '0');
static const uint64_t kMaxUint64 = ~static_cast<uint64_t>(0);
if (v > kMaxUint64/10 ||
(v == kMaxUint64/10 && delta > kMaxUint64%10)) {

View file

@ -297,8 +297,8 @@ struct ClaimTrieChainFixture
CTransaction GetCoinbase()
{
assert(static_cast<size_t>(coinbase_txs_used + 1) < coinbase_txs.size());
return coinbase_txs[coinbase_txs_used++];
auto tx = coinbase_txs.at(coinbase_txs_used++);
return tx;
}
//create i blocks

View file

@ -279,8 +279,8 @@ BOOST_AUTO_TEST_CASE(recursive_prune_test)
BOOST_CHECK_EQUAL(1, cc.cacheSize());
nodeCacheType::iterator it = cc.getCache(std::string("t"));
BOOST_CHECK_EQUAL(10, it->second->nHeightOfLastTakeover);
BOOST_CHECK_EQUAL(1, it->second->claims.size());
BOOST_CHECK_EQUAL(0, it->second->children.size());
BOOST_CHECK_EQUAL(1U, it->second->claims.size());
BOOST_CHECK_EQUAL(0U, it->second->children.size());
}
BOOST_AUTO_TEST_CASE(iteratetrie_test)

View file

@ -2112,14 +2112,12 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
std::string value(vvchParams[1].begin(), vvchParams[1].end());
if (op == OP_CLAIM_NAME)
{
assert(vvchParams.size() == 2);
claimId = ClaimIdHash(txin.prevout.hash, txin.prevout.n);
LogPrintf("+++ %s[%lu]: OP_CLAIM_NAME \"%s\"with claimId %s and tx prevout %s at index %d\n",
__func__, pindex->nHeight, name, claimId.GetHex(), txin.prevout.hash.GetHex(), txin.prevout.n);
}
else if (op == OP_UPDATE_CLAIM)
{
assert(vvchParams.size() == 3);
claimId = uint160(vvchParams[1]);
LogPrintf("+++ %s[%lu]: OP_UPDATE_CLAIM \"%s\" with claimId %s and tx prevout %s at index %d\n",
__func__, pindex->nHeight, name, claimId.GetHex(), txin.prevout.hash.GetHex(), txin.prevout.n);
@ -2140,7 +2138,6 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
}
else if (op == OP_SUPPORT_CLAIM)
{
assert(vvchParams.size() == 2);
uint160 supportedClaimId(vvchParams[1]);
LogPrintf("+++ %s[%lu]: OP_SUPPORT_CLAIM \"%s\" with claimId %s and tx prevout %s at index %d\n",
__func__, pindex->nHeight, name,
@ -2168,7 +2165,6 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
std::string name(vvchParams[0].begin(), vvchParams[0].end());
if (op == OP_CLAIM_NAME)
{
assert(vvchParams.size() == 2);
LogPrintf("%s: Inserting %s into the claim trie. Tx: %s, nOut: %d\n",
__func__, name, tx.GetHash().GetHex(), j);
if (!trieCache.addClaim(name, COutPoint(tx.GetHash(), j), ClaimIdHash(tx.GetHash(), j), txout.nValue, pindex->nHeight))
@ -2178,7 +2174,6 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
}
else if (op == OP_UPDATE_CLAIM)
{
assert(vvchParams.size() == 3);
uint160 claimId(vvchParams[1]);
LogPrintf("%s: Got a claim update. Name: %s, claimId: %s, new txid: %s, nOut: %d\n",
__func__, name, claimId.GetHex(), tx.GetHash().GetHex(), j);
@ -2200,7 +2195,6 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
}
else if (op == OP_SUPPORT_CLAIM)
{
assert(vvchParams.size() == 2);
uint160 supportedClaimId(vvchParams[1]);
if (!trieCache.addSupport(name, COutPoint(tx.GetHash(), j), txout.nValue, supportedClaimId, pindex->nHeight))
{