Skip to content

Commit

Permalink
BUILD: Fix minor issues preventing docker build from working
Browse files Browse the repository at this point in the history
A few instances of unused variables, unused code etc. other builds ignore these but docker build treats them as errors
  • Loading branch information
mjmacleod committed Apr 15, 2023
1 parent 7b574ed commit 4a54983
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 57 deletions.
1 change: 1 addition & 0 deletions developer-tools/docker-build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ RUN apt-get update && apt-get install -y \
git \
ca-certificates \
ccache \
gawk \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down
2 changes: 1 addition & 1 deletion developer-tools/docker-build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

MAKEJOBS=-j3
HOST=x86_64-unknown-linux-gnu
DEP_OPTS="NO_UPNP=1 DEBUG=1 ALLOW_HOST_PACKAGES=1"
DEP_OPTS="NO_UPNP=1 ALLOW_HOST_PACKAGES=1"

make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS

Expand Down
4 changes: 4 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,11 @@ Munt_daemon_LDADD = \
$(LIB_SERVER) \
$(LIB_RPC) \
$(LIB_NODE) \
$(CRYPTOPP_LIBS) \
$(CRYPTO_LIBS) \
$(LIB_WALLET) \
$(CRYPTOPP_LIBS) \
$(CRYPTO_LIBS) \
$(LIB_COMMON) \
$(LIBUNIVALUE) \
$(LIB_UTIL) \
Expand Down
3 changes: 2 additions & 1 deletion src/Makefile.bench.include
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ bench_bench_munt_LDADD = \
$(LIBLEVELDB) \
$(LIBMEMENV) \
$(LIBSECP256K1) \
$(LIBUNIVALUE)
$(LIBUNIVALUE) \
$(LIBMUNT_COMMON)

if ENABLE_ZMQ
bench_bench_munt_LDADD += $(LIBMUNT_ZMQ) $(ZMQ_LIBS)
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ test_test_munt_fuzzy_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)

test_test_munt_fuzzy_LDADD = $(LIB_SERVER) $(LIB_NODE) $(LIB_SERVER) $(LIB_NODE) $(MINIUPNPC_LIBS)
if ENABLE_WALLET
test_test_munt_fuzzy_LDADD += $(LIB_WALLET)
test_test_munt_fuzzy_LDADD += $(CRYPTOPP_LIBS) $(CRYPTO_LIBS) $(LIB_WALLET)
endif
if ENABLE_ZMQ
test_test_munt_fuzzy_LDADD += $(LIB_ZMQ) $(ZMQ_LIBS)
Expand Down
2 changes: 1 addition & 1 deletion src/blockfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ void getBlockFilterBirthAndRanges(uint64_t nHardBirthDate, uint64_t& nSoftBirthD
uint64_t nCrossOver = Params().IsTestnet() ? 200000 : 500000;
uint32_t nRanges=0;
dataFile.seekg(nStaticFilterOffset);
while (((uint64_t)dataFile.tellg() - nStaticFilterOffset < nStaticFilterLength) && (dataFile.peek() != EOF))
while (((uint64_t)dataFile.tellg() - nStaticFilterOffset < nStaticFilterLength) && (dataFile.peek()))
{
int nInterval = nInterval1;
if (nStartIndex >= nCrossOver)
Expand Down
2 changes: 1 addition & 1 deletion src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits
return CreateGenesisBlock(ParseHex("4f6e206a616e756172692031737420746865204475746368206c6f73742074686572652062656c6f7665642047756c64656e"), genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
}

CChainParams::CChainParams(): fIsOfficialTestnetV1(false), fIsTestnet(false), fIsRegtestLegacy(false), fIsRegtest(false) {}
CChainParams::CChainParams(): fIsOfficialTestnetV1(false), fIsTestnet(false), fIsRegtest(false), fIsRegtestLegacy(false) {}

void CChainParams::UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
{
Expand Down
20 changes: 0 additions & 20 deletions src/crypto/sha256.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,26 +202,6 @@ bool SelfTest() {
{0x3e4c4039ul, 0xbb6fca8cul, 0x6f27d2f7ul, 0x301e44a4ul, 0x8352ba14ul, 0x5769ce37ul, 0x48a1155ful, 0xc0e1c4c6ul},
{0xfe2fa9ddul, 0x69d0862bul, 0x1ae0db23ul, 0x471f9244ul, 0xf55c0145ul, 0xc30f9c3bul, 0x40a84ea0ul, 0x5b8a266cul},
};
// Expected output for each of the individual 8 64-byte messages under full double SHA256 (including padding).
static const unsigned char result_d64[256] = {
0x09, 0x3a, 0xc4, 0xd0, 0x0f, 0xf7, 0x57, 0xe1, 0x72, 0x85, 0x79, 0x42, 0xfe, 0xe7, 0xe0, 0xa0,
0xfc, 0x52, 0xd7, 0xdb, 0x07, 0x63, 0x45, 0xfb, 0x53, 0x14, 0x7d, 0x17, 0x22, 0x86, 0xf0, 0x52,
0x48, 0xb6, 0x11, 0x9e, 0x6e, 0x48, 0x81, 0x6d, 0xcc, 0x57, 0x1f, 0xb2, 0x97, 0xa8, 0xd5, 0x25,
0x9b, 0x82, 0xaa, 0x89, 0xe2, 0xfd, 0x2d, 0x56, 0xe8, 0x28, 0x83, 0x0b, 0xe2, 0xfa, 0x53, 0xb7,
0xd6, 0x6b, 0x07, 0x85, 0x83, 0xb0, 0x10, 0xa2, 0xf5, 0x51, 0x3c, 0xf9, 0x60, 0x03, 0xab, 0x45,
0x6c, 0x15, 0x6e, 0xef, 0xb5, 0xac, 0x3e, 0x6c, 0xdf, 0xb4, 0x92, 0x22, 0x2d, 0xce, 0xbf, 0x3e,
0xe9, 0xe5, 0xf6, 0x29, 0x0e, 0x01, 0x4f, 0xd2, 0xd4, 0x45, 0x65, 0xb3, 0xbb, 0xf2, 0x4c, 0x16,
0x37, 0x50, 0x3c, 0x6e, 0x49, 0x8c, 0x5a, 0x89, 0x2b, 0x1b, 0xab, 0xc4, 0x37, 0xd1, 0x46, 0xe9,
0x3d, 0x0e, 0x85, 0xa2, 0x50, 0x73, 0xa1, 0x5e, 0x54, 0x37, 0xd7, 0x94, 0x17, 0x56, 0xc2, 0xd8,
0xe5, 0x9f, 0xed, 0x4e, 0xae, 0x15, 0x42, 0x06, 0x0d, 0x74, 0x74, 0x5e, 0x24, 0x30, 0xce, 0xd1,
0x9e, 0x50, 0xa3, 0x9a, 0xb8, 0xf0, 0x4a, 0x57, 0x69, 0x78, 0x67, 0x12, 0x84, 0x58, 0xbe, 0xc7,
0x36, 0xaa, 0xee, 0x7c, 0x64, 0xa3, 0x76, 0xec, 0xff, 0x55, 0x41, 0x00, 0x2a, 0x44, 0x68, 0x4d,
0xb6, 0x53, 0x9e, 0x1c, 0x95, 0xb7, 0xca, 0xdc, 0x7f, 0x7d, 0x74, 0x27, 0x5c, 0x8e, 0xa6, 0x84,
0xb5, 0xac, 0x87, 0xa9, 0xf3, 0xff, 0x75, 0xf2, 0x34, 0xcd, 0x1a, 0x3b, 0x82, 0x2c, 0x2b, 0x4e,
0x6a, 0x46, 0x30, 0xa6, 0x89, 0x86, 0x23, 0xac, 0xf8, 0xa5, 0x15, 0xe9, 0x0a, 0xaa, 0x1e, 0x9a,
0xd7, 0x93, 0x6b, 0x28, 0xe4, 0x3b, 0xfd, 0x59, 0xc6, 0xed, 0x7c, 0x5f, 0xa5, 0x41, 0xcb, 0x51
};


// Test Transform() for 0 through 8 transformations.
for (size_t i = 0; i <= 8; ++i) {
Expand Down
4 changes: 2 additions & 2 deletions src/policy/policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ int64_t GetVirtualTransactionSizeDiscounted(int64_t nWeight, uint64_t numCoinbas
uint64_t coinbaseInputsToDiscount=(numCoinbaseInputs>2?numCoinbaseInputs-2:numCoinbaseInputs);
uint64_t weightDiscount = STANDARD_COINBASE_INPUT_SIZE_DISCOUNT * coinbaseInputsToDiscount;
uint64_t sigOpCostDiscount = STANDARD_COINBASE_SIGOP_COST_DISCOUNT * coinbaseInputsToDiscount;
uint64_t discountedWeight = nWeight>weightDiscount?nWeight-weightDiscount:nWeight;
uint64_t discountedSigOps = nSigOpCost>sigOpCostDiscount?nSigOpCost-sigOpCostDiscount:nSigOpCost;
uint64_t discountedWeight = (uint64_t)nWeight>weightDiscount?(uint64_t)nWeight-weightDiscount:(uint64_t)nWeight;
uint64_t discountedSigOps = (uint64_t)nSigOpCost>sigOpCostDiscount?(uint64_t)nSigOpCost-sigOpCostDiscount:(uint64_t)nSigOpCost;

return (std::max(discountedWeight, discountedSigOps * nBytesPerSigOp));
}
Expand Down
12 changes: 0 additions & 12 deletions src/script/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,6 @@ bool static IsCompressedOrUncompressedPubKey(const valtype &vchPubKey) {
return true;
}

bool static IsCompressedPubKey(const valtype &vchPubKey) {
if (vchPubKey.size() != 33) {
// Non-canonical public key: invalid length for compressed key
return false;
}
if (vchPubKey[0] != 0x02 && vchPubKey[0] != 0x03) {
// Non-canonical public key: invalid prefix for compressed key
return false;
}
return true;
}

/**
* A canonical signature exists of: <30> <total len> <02> <len R> <R> <02> <len S> <S> <hashtype>
* Where R and S are not negative (their first byte has its highest bit not set), and not
Expand Down
4 changes: 3 additions & 1 deletion src/test/coins_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ BOOST_AUTO_TEST_CASE(indexbased_simulation_test)
bool found = false;
for (const auto& [hashOutPoint, indexOutPoint] : allCoins)
{
(unused) hashOutPoint;
if (removedTransaction.vin[inputIndex].GetPrevOut() == COutPoint(std::get<0>(indexOutPoint), std::get<1>(indexOutPoint), std::get<2>(indexOutPoint)))
{
found = true;
Expand Down Expand Up @@ -966,7 +967,7 @@ BOOST_AUTO_TEST_CASE(indexbased_simulation_test)
std::vector<COutPoint> allCoinsIndexBasedTracked;
for (const auto& [key, value] : allCoins)
{
(unused) value;
(unused) key;
allCoinsIndexBasedTracked.push_back(COutPoint(std::get<0>(value), std::get<1>(value), std::get<2>(value)));
}
std::sort(allCoinsIndexBasedTracked.begin(), allCoinsIndexBasedTracked.end());
Expand All @@ -980,6 +981,7 @@ BOOST_AUTO_TEST_CASE(indexbased_simulation_test)
std::vector<COutPoint> allCoinsIndexBasedUTXODirect;
for (const auto& [outPoint, coins] : utxoAllCoinsIndexBased)
{
(unused) coins;
allCoinsIndexBasedUTXODirect.push_back(outPoint);
}
BOOST_REQUIRE_EQUAL_COLLECTIONS(allCoinsIndexBasedUTXODirect.begin(), allCoinsIndexBasedUTXODirect.end(), allCoinsIndexBasedTracked.begin(), allCoinsIndexBasedTracked.end());
Expand Down
17 changes: 0 additions & 17 deletions src/unity/generic/init_generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,23 +253,6 @@ void ServerShutdown(node::NodeContext& nodeContext)
{
}

static void OnRPCStarted()
{
}

static void OnRPCStopped()
{
}

static void OnRPCPreCommand(const CRPCCommand& cmd)
{
}

static bool AppInitServers()
{
return true;
}

bool InitRPCWarmup()
{
return true;
Expand Down
1 change: 1 addition & 0 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,7 @@ void CWallet::HandleTransactionsLoaded()
{
for (const auto& [hash, wtx] : mapWallet)
{
(unused) hash;
for (const CTxIn& txin : wtx.tx->vin)
{
const CWalletTx* prevtx = GetWalletTx(txin.GetPrevOut());
Expand Down

0 comments on commit 4a54983

Please sign in to comment.