Skip to content

Commit

Permalink
Resolve compilation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar committed Dec 13, 2019
1 parent ae58710 commit 4dfa903
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/bitcoin-tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ static CAmount AmountFromValue(const UniValue& value)
{
if (!value.isNum() && !value.isStr())
throw runtime_error("Amount is not a number or string");
CAmount amount = roundint64(amount * COIN);
CAmount amount;
if (!ParseFixedPoint(value.getValStr(), 8, &amount))
throw runtime_error("Invalid amount");
if (!MoneyRange(amount))
Expand Down
5 changes: 1 addition & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1967,7 +1967,6 @@ bool CheckTxInputs(const CTransaction& tx, CValidationState& state, const CCoins
return state.Invalid(false, 0, "", "Inputs unavailable");

CAmount nValueIn = 0;
CAmount nFees = 0;
for (unsigned int i = 0; i < tx.vin.size(); i++)
{
const COutPoint &prevout = tx.vin[i].prevout;
Expand Down Expand Up @@ -2056,8 +2055,6 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsVi
valid = 0;

if (valid){ // prev out is already checked in CheckTxInputs
CBlockIndex* pblockindex = mapBlockIndex[hashBlock];

// Check transaction timestamp
if (txPrev.nTime > tx.nTime)
return state.DoS(100, false, REJECT_INVALID, "tx-timestamp-earlier-as-output");
Expand Down Expand Up @@ -2448,7 +2445,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
LogPrint("bench", " - Sanity checks: %.2fms [%.2fs]\n", 0.001 * (nTime1 - nTimeStart), nTimeCheck * 0.000001);

/* Work around duplicate transactions (BIP30) */
for (int i = 0; i < block.vtx.size(); i++) {
for (unsigned int i = 0; i < block.vtx.size(); i++) {
uint256 hash = block.GetTxHash(i);
CCoins coins;
view.GetCoins(hash, coins);
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/mining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ UniValue estimatesmartpriority(const UniValue& params, bool fHelp)

UniValue staking(const UniValue& params, bool fHelp)
{
if (fHelp || !(params.size() >= 0 && params.size() <= 1))
if (fHelp || params.size() > 1)
throw runtime_error(
"staking bool\n"
"Turns staking on or off\n"
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ CAmount AmountFromValue(const UniValue& value, int decimal)
{
if (!value.isNum() && !value.isStr())
throw JSONRPCError(RPC_TYPE_ERROR, "Amount is not a number or string");
CAmount amount = roundint64(amount * COIN);
CAmount amount;
if (!ParseFixedPoint(value.getValStr(), decimal, &amount))
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount");
if (!MoneyRange(amount))
Expand Down
4 changes: 0 additions & 4 deletions src/smessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,6 @@ bool SecureMsgReceiveData(CNode* pfrom, std::string strCommand, CDataStream& vRe
return false;
}

uint32_t nBuckets = smsgBuckets.size();
uint32_t nLocked = 0; // no. of locked buckets on this node
uint32_t nInvBuckets; // no. of bucket headers sent by peer in smsgInv
memcpy(&nInvBuckets, &vchData[0], 4);
Expand Down Expand Up @@ -1816,7 +1815,6 @@ bool SecureMsgScanBlock(CBlock& block)
bool ScanChainForPublicKeys(CBlockIndex* pindexStart)
{
LogPrintf("Scanning block chain for public keys.\n");
int64_t nStart = GetTimeMillis();

// -- public keys are in txin.scriptSig
// matching addresses are in scriptPubKey of txin's referenced output
Expand Down Expand Up @@ -1886,7 +1884,6 @@ bool SecureMsgScanBuckets()
if (!fSecMsgEnabled || pwalletMain->IsLocked())
return false;

int64_t mStart = GetTimeMillis();
int64_t now = GetTime();
uint32_t nFiles = 0;
uint32_t nMessages = 0;
Expand Down Expand Up @@ -2805,7 +2802,6 @@ int SecureMsgSetHash(uint8_t *pHeader, uint8_t *pPayload, uint32_t nPayload)

SecureMessage* psmsg = (SecureMessage*) pHeader;

int64_t nStart = GetTimeMillis();
uint8_t civ[32];
uint8_t sha256Hash[32];

Expand Down
16 changes: 0 additions & 16 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3698,19 +3698,6 @@ std::string static EncodeDumpTime(int64_t nTime) {
return DateTimeStrFormat("%Y-%m-%dT%H:%M:%SZ", nTime);
}

std::string static EncodeDumpString(const std::string &str) {
std::stringstream ret;
BOOST_FOREACH(unsigned char c, str) {
if (c <= 32 || c >= 128 || c == '%') {
ret << '%' << HexStr(&c, &c + 1);
}
else {
ret << c;
}
}
return ret.str();
}

std::string DecodeDumpString(const std::string &str) {
std::stringstream ret;
for (unsigned int pos = 0; pos < str.length(); pos++) {
Expand Down Expand Up @@ -3762,7 +3749,6 @@ bool CWallet::ExportWallet(CWallet *pwallet, const string& strDest) {
const CKeyID &keyid = it->second;
std::string strTime = EncodeDumpTime(it->first);
std::string strAddr = CBitcoinAddress(keyid).ToString();
bool IsCompressed;

CKey key;
if (pwallet->GetKey(keyid, key)) {
Expand Down Expand Up @@ -3817,7 +3803,6 @@ bool CWallet::ImportWallet(CWallet *pwallet, const string& strLocation) {
if (!vchSecret.SetString(vstr[0]))
continue;

bool fCompressed;
CKey key;
CKey secret = CBitcoinSecret(vchSecret).GetKey();
CKeyID keyid = secret.GetPubKey().GetID();
Expand Down Expand Up @@ -3990,7 +3975,6 @@ void CWallet::GetStakeWeight(uint64_t& nMinWeight, uint64_t& nMaxWeight, uint64_

nMinWeightInputs = 0, nMaxWeightInputs = 0, nAvgWeightInputs = 0;

int64_t nCurrentTime = GetTime();
uint64_t nStakeMaxAge = 15 * 24 * 60 * 60;

LOCK2(cs_main, cs_wallet);
Expand Down

0 comments on commit 4dfa903

Please sign in to comment.