Address some linter complaints

This commit is contained in:
Steven Roose 2019-05-15 16:11:50 +01:00
parent ad3d496d78
commit d21e0563c1
No known key found for this signature in database
GPG key ID: 2F2A88D7F8D68E87
2 changed files with 0 additions and 68 deletions

View file

@ -445,7 +445,6 @@ BOOST_AUTO_TEST_CASE(PeginSpentTest)
tx.vin.resize(1);
tx.vout.resize(1);
tx.vout[0].nValue = 0;
const uint256 tx1Hash(tx.GetHash());
pool.addUnchecked(entry.PeginsSpent(setPeginsSpent).FromTx(tx));
BOOST_CHECK(pool.mapPeginsSpentToTxid.empty());

View file

@ -1198,73 +1198,6 @@ public:
bool operator()(const T& dest) { return false; }
};
static UniValue addwitnessaddress(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
{
std::string msg = "addwitnessaddress \"address\" ( p2sh )\n"
"\nDEPRECATED: set the address_type argument of getnewaddress, or option -addresstype=[bech32|p2sh-segwit] instead.\n"
"Add a witness address for a script (with pubkey or redeemscript known). Requires a new wallet backup.\n"
"It returns the witness script.\n"
"\nArguments:\n"
"1. \"address\" (string, required) An address known to the wallet\n"
"2. p2sh (bool, optional, default=true) Embed inside P2SH\n"
"\nResult:\n"
"\"witnessaddress\", (string) The value of the new address (P2SH or BIP173).\n"
"}\n"
;
throw std::runtime_error(msg);
}
if (!IsDeprecatedRPCEnabled("addwitnessaddress")) {
throw JSONRPCError(RPC_METHOD_DEPRECATED, "addwitnessaddress is deprecated and will be fully removed in v0.17. "
"To use addwitnessaddress in v0.16, restart the daemon with -deprecatedrpc=addwitnessaddress.\n"
"Projects should transition to using the address_type argument of getnewaddress, or option -addresstype=[bech32|p2sh-segwit] instead.\n");
}
CTxDestination dest = DecodeDestination(request.params[0].get_str());
if (!IsValidDestination(dest)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
}
bool p2sh = true;
if (!request.params[1].isNull()) {
p2sh = request.params[1].get_bool();
}
Witnessifier w(pwallet);
bool ret = boost::apply_visitor(w, dest);
if (!ret) {
throw JSONRPCError(RPC_WALLET_ERROR, "Public key or redeemscript not known to wallet, or the key is uncompressed");
}
CScript witprogram = GetScriptForDestination(w.result);
if (p2sh) {
w.result = ScriptHash(witprogram);
}
if (w.already_witness) {
if (!(dest == w.result)) {
throw JSONRPCError(RPC_WALLET_ERROR, "Cannot convert between witness address types");
}
} else {
pwallet->AddCScript(witprogram); // Implicit for single-key now, but necessary for multisig and for compatibility with older software
pwallet->SetAddressBook(w.result, "", "receive");
}
return EncodeDestination(w.result);
}
struct tallyitem
{
CAmountMap mapAmount;