Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show All 14 Lines | |||||
#include <outputtype.h> | #include <outputtype.h> | ||||
#include <policy/fees.h> | #include <policy/fees.h> | ||||
#include <rpc/rawtransaction_util.h> | #include <rpc/rawtransaction_util.h> | ||||
#include <rpc/server.h> | #include <rpc/server.h> | ||||
#include <rpc/util.h> | #include <rpc/util.h> | ||||
#include <script/descriptor.h> | #include <script/descriptor.h> | ||||
#include <util/bip32.h> | #include <util/bip32.h> | ||||
#include <util/error.h> | #include <util/error.h> | ||||
#include <util/message.h> // For MessageSign() | |||||
#include <util/moneystr.h> | #include <util/moneystr.h> | ||||
#include <util/string.h> | #include <util/string.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <util/translation.h> | #include <util/translation.h> | ||||
#include <util/url.h> | #include <util/url.h> | ||||
#include <util/validation.h> | |||||
#include <wallet/coincontrol.h> | #include <wallet/coincontrol.h> | ||||
#include <wallet/psbtwallet.h> | #include <wallet/psbtwallet.h> | ||||
#include <wallet/rpcwallet.h> | #include <wallet/rpcwallet.h> | ||||
#include <wallet/wallet.h> | #include <wallet/wallet.h> | ||||
#include <wallet/walletdb.h> | #include <wallet/walletdb.h> | ||||
#include <wallet/walletutil.h> | #include <wallet/walletutil.h> | ||||
#include <univalue.h> | #include <univalue.h> | ||||
▲ Show 20 Lines • Show All 592 Lines • ▼ Show 20 Lines | static UniValue signmessage(const Config &config, | ||||
} | } | ||||
CKey key; | CKey key; | ||||
CKeyID keyID(*pkhash); | CKeyID keyID(*pkhash); | ||||
if (!provider->GetKey(keyID, key)) { | if (!provider->GetKey(keyID, key)) { | ||||
throw JSONRPCError(RPC_WALLET_ERROR, "Private key not available"); | throw JSONRPCError(RPC_WALLET_ERROR, "Private key not available"); | ||||
} | } | ||||
CHashWriter ss(SER_GETHASH, 0); | std::string signature; | ||||
ss << strMessageMagic; | |||||
ss << strMessage; | |||||
std::vector<uint8_t> vchSig; | if (!MessageSign(key, strMessage, signature)) { | ||||
if (!key.SignCompact(ss.GetHash(), vchSig)) { | |||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Sign failed"); | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Sign failed"); | ||||
} | } | ||||
return EncodeBase64(vchSig.data(), vchSig.size()); | return signature; | ||||
} | } | ||||
static Amount GetReceived(const CWallet &wallet, const UniValue ¶ms, | static Amount GetReceived(const CWallet &wallet, const UniValue ¶ms, | ||||
bool by_label) | bool by_label) | ||||
EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet) { | EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet) { | ||||
std::set<CTxDestination> address_set; | std::set<CTxDestination> address_set; | ||||
if (by_label) { | if (by_label) { | ||||
▲ Show 20 Lines • Show All 4,227 Lines • Show Last 20 Lines |