mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
backport: bitcoin#10583 - [RPC] Split part of validateaddress into getaddressinfo (#3880)
* [rpc] split wallet and non-wallet parts of DescribeAddressVisitor * [rpc] Move DescribeAddressVisitor to rpc/util * Create getaddressinfo RPC and deprecate parts of validateaddress Moves the parts of validateaddress which require the wallet into getaddressinfo which is part of the wallet RPCs. Mark those parts of validateaddress which require the wallet as deprecated. Validateaddress will call getaddressinfo for the data that both share for right now. Moves IsMine functions to libbitcoin_common and then links libbitcoin_wallet before libbitcoin_common in order to prevent linker errors since IsMine is no longer used in libbitcoin_server. * scripted-diff: validateaddress to getaddressinfo in tests Change all instances of validateaddress to getaddressinfo since it seems that no test actually uses validateaddress for actually validating addresses. -BEGIN VERIFY SCRIPT- find ./test/functional -path '*py' -not -path ./test/functional/wallet_disable.py -not -path ./test/functional/rpc_deprecated.py -not -path ./test/functional/wallet_address_types.py -exec sed -i'' -e 's/validateaddress/getaddressinfo/g' {} \; -END VERIFY SCRIPT- * wallet: Add missing description of "hdchainid" * Update src/wallet/rpcwallet.cpp Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: John Newbery <john@johnnewbery.com> Co-authored-by: Andrew Chow <achow101-github@achow101.com> Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
This commit is contained in:
parent
ef173b9056
commit
122078b9ec
@ -229,10 +229,10 @@ BITCOIN_CORE_H = \
|
||||
rpc/util.h \
|
||||
saltedhasher.h \
|
||||
scheduler.h \
|
||||
script/ismine.h \
|
||||
script/sigcache.h \
|
||||
script/sign.h \
|
||||
script/standard.h \
|
||||
script/ismine.h \
|
||||
spork.h \
|
||||
stacktraces.h \
|
||||
streams.h \
|
||||
@ -360,7 +360,6 @@ libdash_server_a_SOURCES = \
|
||||
rpc/privatesend.cpp \
|
||||
rpc/util.cpp \
|
||||
script/sigcache.cpp \
|
||||
script/ismine.cpp \
|
||||
spork.cpp \
|
||||
statsd_client.cpp \
|
||||
timedata.cpp \
|
||||
@ -537,6 +536,7 @@ libdash_common_a_SOURCES = \
|
||||
protocol.cpp \
|
||||
saltedhasher.cpp \
|
||||
scheduler.cpp \
|
||||
script/ismine.cpp \
|
||||
script/sign.cpp \
|
||||
script/standard.cpp \
|
||||
warnings.cpp \
|
||||
@ -602,10 +602,10 @@ endif
|
||||
|
||||
dashd_LDADD = \
|
||||
$(LIBBITCOIN_SERVER) \
|
||||
$(LIBBITCOIN_WALLET) \
|
||||
$(LIBBITCOIN_COMMON) \
|
||||
$(LIBUNIVALUE) \
|
||||
$(LIBBITCOIN_UTIL) \
|
||||
$(LIBBITCOIN_WALLET) \
|
||||
$(LIBBITCOIN_ZMQ) \
|
||||
$(LIBBITCOIN_CONSENSUS) \
|
||||
$(LIBBITCOIN_CRYPTO) \
|
||||
|
@ -43,6 +43,7 @@ bench_bench_dash_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CLFAGS) $
|
||||
bench_bench_dash_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
bench_bench_dash_LDADD = \
|
||||
$(LIBBITCOIN_SERVER) \
|
||||
$(LIBBITCOIN_WALLET) \
|
||||
$(LIBBITCOIN_COMMON) \
|
||||
$(LIBBITCOIN_UTIL) \
|
||||
$(LIBBITCOIN_CONSENSUS) \
|
||||
@ -59,7 +60,6 @@ endif
|
||||
|
||||
if ENABLE_WALLET
|
||||
bench_bench_dash_SOURCES += bench/coin_selection.cpp
|
||||
bench_bench_dash_LDADD += $(LIBBITCOIN_WALLET) $(LIBBITCOIN_CRYPTO)
|
||||
endif
|
||||
|
||||
bench_bench_dash_LDADD += $(BACKTRACE_LIB) $(BOOST_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(BLS_LIBS)
|
||||
|
124
src/rpc/misc.cpp
124
src/rpc/misc.cpp
@ -114,51 +114,6 @@ UniValue mnsync(const JSONRPCRequest& request)
|
||||
return "failure";
|
||||
}
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
class DescribeAddressVisitor : public boost::static_visitor<UniValue>
|
||||
{
|
||||
public:
|
||||
CWallet * const pwallet;
|
||||
|
||||
explicit DescribeAddressVisitor(CWallet *_pwallet) : pwallet(_pwallet) {}
|
||||
|
||||
UniValue operator()(const CNoDestination &dest) const { return UniValue(UniValue::VOBJ); }
|
||||
|
||||
UniValue operator()(const CKeyID &keyID) const {
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
CPubKey vchPubKey;
|
||||
obj.pushKV("isscript", false);
|
||||
if (pwallet && pwallet->GetPubKey(keyID, vchPubKey)) {
|
||||
obj.pushKV("pubkey", HexStr(vchPubKey));
|
||||
obj.pushKV("iscompressed", vchPubKey.IsCompressed());
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
UniValue operator()(const CScriptID &scriptID) const {
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
CScript subscript;
|
||||
obj.pushKV("isscript", true);
|
||||
if (pwallet && pwallet->GetCScript(scriptID, subscript)) {
|
||||
std::vector<CTxDestination> addresses;
|
||||
txnouttype whichType;
|
||||
int nRequired;
|
||||
ExtractDestinations(subscript, whichType, addresses, nRequired);
|
||||
obj.pushKV("script", GetTxnOutputType(whichType));
|
||||
obj.pushKV("hex", HexStr(subscript.begin(), subscript.end()));
|
||||
UniValue a(UniValue::VARR);
|
||||
for (const CTxDestination& addr : addresses) {
|
||||
a.push_back(EncodeDestination(addr));
|
||||
}
|
||||
obj.pushKV("addresses", a);
|
||||
if (whichType == TX_MULTISIG)
|
||||
obj.pushKV("sigsrequired", nRequired);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
Used for updating/reading spork settings on the network
|
||||
*/
|
||||
@ -241,44 +196,24 @@ UniValue validateaddress(const JSONRPCRequest& request)
|
||||
throw std::runtime_error(
|
||||
"validateaddress \"address\"\n"
|
||||
"\nReturn information about the given dash address.\n"
|
||||
"DEPRECATION WARNING: Parts of this command have been deprecated and moved to getaddressinfo. Clients must\n"
|
||||
"transition to using getaddressinfo to access this information before upgrading to v0.18. The following deprecated\n"
|
||||
"fields have moved to getaddressinfo and will only be shown here with -deprecatedrpc=validateaddress: ismine, iswatchonly,\n"
|
||||
"script, hex, pubkeys, sigsrequired, pubkey, addresses, embedded, iscompressed, account, timestamp, hdkeypath.\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"address\" (string, required) The dash address to validate\n"
|
||||
"1. \"address\" (string, required) The dash address to validate\n"
|
||||
"\nResult:\n"
|
||||
"{\n"
|
||||
" \"isvalid\" : true|false, (boolean) If the address is valid or not. If not, this is the only property returned.\n"
|
||||
" \"address\" : \"address\", (string) The dash address validated\n"
|
||||
" \"scriptPubKey\" : \"hex\", (string) The hex encoded scriptPubKey generated by the address\n"
|
||||
" \"ismine\" : true|false, (boolean) If the address is yours or not\n"
|
||||
" \"iswatchonly\" : true|false, (boolean) If the address is watchonly\n"
|
||||
" \"isscript\" : true|false, (boolean) If the key is a script\n"
|
||||
" \"script\" : \"type\" (string, optional) The output script type. Possible types: nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata\n"
|
||||
" \"hex\" : \"hex\", (string, optional) The redeemscript for the p2sh address\n"
|
||||
" \"addresses\" (string, optional) Array of addresses associated with the known redeemscript\n"
|
||||
" [\n"
|
||||
" \"address\"\n"
|
||||
" ,...\n"
|
||||
" ]\n"
|
||||
" \"sigsrequired\" : xxxxx (numeric, optional) Number of signatures required to spend multisig output\n"
|
||||
" \"pubkey\" : \"publickeyhex\", (string) The hex value of the raw public key\n"
|
||||
" \"iscompressed\" : true|false, (boolean) If the address is compressed\n"
|
||||
" \"account\" : \"account\" (string) DEPRECATED. The account associated with the address, \"\" is the default account\n"
|
||||
" \"timestamp\" : timestamp, (number, optional) The creation time of the key if available in seconds since epoch (Jan 1 1970 GMT)\n"
|
||||
" \"hdkeypath\" : \"keypath\" (string, optional) The HD keypath if the key is HD and available\n"
|
||||
" \"hdchainid\" : \"<hash>\" (string, optional) The ID of the HD chain\n"
|
||||
"}\n"
|
||||
"\nExamples:\n"
|
||||
+ HelpExampleCli("validateaddress", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\"")
|
||||
+ HelpExampleRpc("validateaddress", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\"")
|
||||
);
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
|
||||
|
||||
LOCK2(cs_main, pwallet ? &pwallet->cs_wallet : nullptr);
|
||||
#else
|
||||
LOCK(cs_main);
|
||||
#endif
|
||||
|
||||
CTxDestination dest = DecodeDestination(request.params[0].get_str());
|
||||
bool isValid = IsValidDestination(dest);
|
||||
|
||||
@ -286,47 +221,22 @@ UniValue validateaddress(const JSONRPCRequest& request)
|
||||
ret.pushKV("isvalid", isValid);
|
||||
if (isValid)
|
||||
{
|
||||
std::string currentAddress = EncodeDestination(dest);
|
||||
ret.pushKV("address", currentAddress);
|
||||
|
||||
CScript scriptPubKey = GetScriptForDestination(dest);
|
||||
ret.pushKV("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end()));
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
isminetype mine = pwallet ? IsMine(*pwallet, dest) : ISMINE_NO;
|
||||
ret.pushKV("ismine", bool(mine & ISMINE_SPENDABLE));
|
||||
ret.pushKV("iswatchonly", bool(mine & ISMINE_WATCH_ONLY));
|
||||
UniValue detail = boost::apply_visitor(DescribeAddressVisitor(pwallet), dest);
|
||||
ret.pushKVs(detail);
|
||||
if (pwallet && pwallet->mapAddressBook.count(dest)) {
|
||||
ret.pushKV("account", pwallet->mapAddressBook[dest].name);
|
||||
}
|
||||
if (pwallet) {
|
||||
const CKeyMetadata* meta = nullptr;
|
||||
const CKeyID *keyID = boost::get<CKeyID>(&dest);
|
||||
if (const CKeyID* key_id = boost::get<CKeyID>(&dest)) {
|
||||
auto it = pwallet->mapKeyMetadata.find(*key_id);
|
||||
if (it != pwallet->mapKeyMetadata.end()) {
|
||||
meta = &it->second;
|
||||
}
|
||||
}
|
||||
if (!meta) {
|
||||
auto it = pwallet->m_script_metadata.find(CScriptID(scriptPubKey));
|
||||
if (it != pwallet->m_script_metadata.end()) {
|
||||
meta = &it->second;
|
||||
}
|
||||
}
|
||||
if (meta) {
|
||||
ret.pushKV("timestamp", meta->nCreateTime);
|
||||
}
|
||||
|
||||
CHDChain hdChainCurrent;
|
||||
if (keyID && pwallet->mapHdPubKeys.count(*keyID) && pwallet->GetHDChain(hdChainCurrent)) {
|
||||
ret.pushKV("hdkeypath", pwallet->mapHdPubKeys[*keyID].GetKeyPath());
|
||||
ret.pushKV("hdchainid", hdChainCurrent.GetID().GetHex());
|
||||
}
|
||||
if (HasWallets() && IsDeprecatedRPCEnabled("validateaddress")) {
|
||||
ret.pushKVs(getaddressinfo(request));
|
||||
}
|
||||
#endif
|
||||
if (ret["address"].isNull()) {
|
||||
std::string currentAddress = EncodeDestination(dest);
|
||||
ret.pushKV("address", currentAddress);
|
||||
|
||||
CScript scriptPubKey = GetScriptForDestination(dest);
|
||||
ret.pushKV("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end()));;
|
||||
|
||||
UniValue detail = DescribeAddress(dest);
|
||||
ret.pushKVs(detail);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -66,3 +66,29 @@ CScript CreateMultisigRedeemscript(const int required, const std::vector<CPubKey
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
class DescribeAddressVisitor : public boost::static_visitor<UniValue>
|
||||
{
|
||||
public:
|
||||
|
||||
explicit DescribeAddressVisitor() {}
|
||||
|
||||
UniValue operator()(const CNoDestination &dest) const { return UniValue(UniValue::VOBJ); }
|
||||
|
||||
UniValue operator()(const CKeyID &keyID) const {
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.pushKV("isscript", false);
|
||||
return obj;
|
||||
}
|
||||
|
||||
UniValue operator()(const CScriptID &scriptID) const {
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.pushKV("isscript", true);
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
||||
UniValue DescribeAddress(const CTxDestination& dest)
|
||||
{
|
||||
return boost::apply_visitor(DescribeAddressVisitor(), dest);
|
||||
}
|
||||
|
@ -5,6 +5,13 @@
|
||||
#ifndef BITCOIN_RPC_UTIL_H
|
||||
#define BITCOIN_RPC_UTIL_H
|
||||
|
||||
#include <pubkey.h>
|
||||
#include <script/standard.h>
|
||||
#include <univalue.h>
|
||||
#include <utilstrencodings.h>
|
||||
|
||||
#include <boost/variant/static_visitor.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -16,4 +23,6 @@ CPubKey HexToPubKey(const std::string& hex_in);
|
||||
CPubKey AddrToPubKey(CKeyStore* const keystore, const std::string& addr_in);
|
||||
CScript CreateMultisigRedeemscript(const int required, const std::vector<CPubKey>& pubkeys);
|
||||
|
||||
UniValue DescribeAddress(const CTxDestination& dest);
|
||||
|
||||
#endif // BITCOIN_RPC_UTIL_H
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <utilmoneystr.h>
|
||||
#include <validation.h>
|
||||
#include <wallet/coincontrol.h>
|
||||
#include <wallet/rpcwallet.h>
|
||||
#include <wallet/wallet.h>
|
||||
#include <wallet/walletdb.h>
|
||||
#include <wallet/walletutil.h>
|
||||
@ -3616,6 +3617,148 @@ UniValue rescanblockchain(const JSONRPCRequest& request)
|
||||
return response;
|
||||
}
|
||||
|
||||
class DescribeWalletAddressVisitor : public boost::static_visitor<UniValue>
|
||||
{
|
||||
public:
|
||||
CWallet * const pwallet;
|
||||
|
||||
explicit DescribeWalletAddressVisitor(CWallet *_pwallet) : pwallet(_pwallet) {}
|
||||
|
||||
UniValue operator()(const CNoDestination &dest) const { return UniValue(UniValue::VOBJ); }
|
||||
|
||||
UniValue operator()(const CKeyID &keyID) const {
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
CPubKey vchPubKey;
|
||||
if (pwallet && pwallet->GetPubKey(keyID, vchPubKey)) {
|
||||
obj.pushKV("pubkey", HexStr(vchPubKey));
|
||||
obj.pushKV("iscompressed", vchPubKey.IsCompressed());
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
UniValue operator()(const CScriptID &scriptID) const {
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
CScript subscript;
|
||||
if (pwallet && pwallet->GetCScript(scriptID, subscript)) {
|
||||
std::vector<CTxDestination> addresses;
|
||||
txnouttype whichType;
|
||||
int nRequired;
|
||||
ExtractDestinations(subscript, whichType, addresses, nRequired);
|
||||
obj.pushKV("script", GetTxnOutputType(whichType));
|
||||
obj.pushKV("hex", HexStr(subscript.begin(), subscript.end()));
|
||||
UniValue a(UniValue::VARR);
|
||||
for (const CTxDestination& addr : addresses) {
|
||||
a.push_back(EncodeDestination(addr));
|
||||
}
|
||||
obj.pushKV("addresses", a);
|
||||
if (whichType == TX_MULTISIG)
|
||||
obj.pushKV("sigsrequired", nRequired);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
||||
UniValue DescribeWalletAddress(CWallet* pwallet, const CTxDestination& dest)
|
||||
{
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
UniValue detail = DescribeAddress(dest);
|
||||
ret.pushKVs(detail);
|
||||
ret.pushKVs(boost::apply_visitor(DescribeWalletAddressVisitor(pwallet), dest));
|
||||
return ret;
|
||||
}
|
||||
|
||||
UniValue getaddressinfo(const JSONRPCRequest& request)
|
||||
{
|
||||
CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
|
||||
return NullUniValue;
|
||||
}
|
||||
|
||||
if (request.fHelp || request.params.size() != 1) {
|
||||
throw std::runtime_error(
|
||||
"getaddressinfo \"address\"\n"
|
||||
"\nReturn information about the given dash address. Some information requires the address\n"
|
||||
"to be in the wallet.\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"address\" (string, required) The dash address to get the information of.\n"
|
||||
"\nResult:\n"
|
||||
"{\n"
|
||||
" \"address\" : \"address\", (string) The dash address validated\n"
|
||||
" \"scriptPubKey\" : \"hex\", (string) The hex encoded scriptPubKey generated by the address\n"
|
||||
" \"ismine\" : true|false, (boolean) If the address is yours or not\n"
|
||||
" \"iswatchonly\" : true|false, (boolean) If the address is watchonly\n"
|
||||
" \"isscript\" : true|false, (boolean) If the key is a script\n"
|
||||
" \"script\" : \"type\" (string, optional) The output script type. Only if \"isscript\" is true and the redeemscript is known. Possible types: nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata\n"
|
||||
" \"hex\" : \"hex\", (string, optional) The redeemscript for the p2sh address\n"
|
||||
" \"pubkeys\" (string, optional) Array of pubkeys associated with the known redeemscript (only if \"script\" is \"multisig\")\n"
|
||||
" [\n"
|
||||
" \"pubkey\"\n"
|
||||
" ,...\n"
|
||||
" ]\n"
|
||||
" \"sigsrequired\" : xxxxx (numeric, optional) Number of signatures required to spend multisig output (only if \"script\" is \"multisig\")\n"
|
||||
" \"pubkey\" : \"publickeyhex\", (string, optional) The hex value of the raw public key, for single-key addresses (possibly embedded in P2SH)\n"
|
||||
" \"embedded\" : {...}, (object, optional) Information about the address embedded in P2SH, if relevant and known. It includes all getaddressinfo output fields for the embedded address, excluding metadata (\"timestamp\", \"hdkeypath\") and relation to the wallet (\"ismine\", \"iswatchonly\", \"account\").\n"
|
||||
" \"iscompressed\" : true|false, (boolean) If the address is compressed\n"
|
||||
" \"account\" : \"account\" (string) The account associated with the address, \"\" is the default account\n"
|
||||
" \"timestamp\" : timestamp, (number, optional) The creation time of the key if available in seconds since epoch (Jan 1 1970 GMT)\n"
|
||||
" \"hdkeypath\" : \"keypath\" (string, optional) The HD keypath if the key is HD and available\n"
|
||||
" \"hdchainid\" : \"<hash>\" (string, optional) The ID of the HD chain\n"
|
||||
"}\n"
|
||||
"\nExamples:\n"
|
||||
+ HelpExampleCli("getaddressinfo", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\"")
|
||||
+ HelpExampleRpc("getaddressinfo", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\"")
|
||||
);
|
||||
}
|
||||
|
||||
LOCK(pwallet->cs_wallet);
|
||||
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
CTxDestination dest = DecodeDestination(request.params[0].get_str());
|
||||
|
||||
// Make sure the destination is valid
|
||||
if (!IsValidDestination(dest)) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address");
|
||||
}
|
||||
|
||||
std::string currentAddress = EncodeDestination(dest);
|
||||
ret.pushKV("address", currentAddress);
|
||||
|
||||
CScript scriptPubKey = GetScriptForDestination(dest);
|
||||
ret.pushKV("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end()));
|
||||
|
||||
isminetype mine = IsMine(*pwallet, dest);
|
||||
ret.pushKV("ismine", bool(mine & ISMINE_SPENDABLE));
|
||||
ret.pushKV("iswatchonly", bool(mine & ISMINE_WATCH_ONLY));
|
||||
UniValue detail = DescribeWalletAddress(pwallet, dest);
|
||||
ret.pushKVs(detail);
|
||||
if (pwallet->mapAddressBook.count(dest)) {
|
||||
ret.pushKV("account", pwallet->mapAddressBook[dest].name);
|
||||
}
|
||||
const CKeyMetadata* meta = nullptr;
|
||||
const CKeyID *key_id = boost::get<CKeyID>(&dest);
|
||||
if (key_id != nullptr && !key_id->IsNull()) {
|
||||
auto it = pwallet->mapKeyMetadata.find(*key_id);
|
||||
if (it != pwallet->mapKeyMetadata.end()) {
|
||||
meta = &it->second;
|
||||
}
|
||||
}
|
||||
if (!meta) {
|
||||
auto it = pwallet->m_script_metadata.find(CScriptID(scriptPubKey));
|
||||
if (it != pwallet->m_script_metadata.end()) {
|
||||
meta = &it->second;
|
||||
}
|
||||
}
|
||||
if (meta) {
|
||||
ret.pushKV("timestamp", meta->nCreateTime);
|
||||
CHDChain hdChainCurrent;
|
||||
if (key_id && pwallet->mapHdPubKeys.count(*key_id) && pwallet->GetHDChain(hdChainCurrent)) {
|
||||
ret.pushKV("hdkeypath", pwallet->mapHdPubKeys[*key_id].GetKeyPath());
|
||||
ret.pushKV("hdchainid", hdChainCurrent.GetID().GetHex());
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern UniValue abortrescan(const JSONRPCRequest& request); // in rpcdump.cpp
|
||||
extern UniValue dumpprivkey(const JSONRPCRequest& request); // in rpcdump.cpp
|
||||
extern UniValue importprivkey(const JSONRPCRequest& request);
|
||||
@ -3647,6 +3790,7 @@ static const CRPCCommand commands[] =
|
||||
{ "wallet", "getaccountaddress", &getaccountaddress, {"account"} },
|
||||
{ "wallet", "getaccount", &getaccount, {"address"} },
|
||||
{ "wallet", "getaddressesbyaccount", &getaddressesbyaccount, {"account"} },
|
||||
{ "wallet", "getaddressinfo", &getaddressinfo, {"address"} },
|
||||
{ "wallet", "getbalance", &getbalance, {"account","minconf","addlocked","include_watchonly"} },
|
||||
{ "wallet", "getnewaddress", &getnewaddress, {"account"} },
|
||||
{ "wallet", "getrawchangeaddress", &getrawchangeaddress, {} },
|
||||
|
@ -26,5 +26,6 @@ std::string HelpRequiringPassphrase(CWallet *);
|
||||
void EnsureWalletIsUnlocked(CWallet *);
|
||||
bool EnsureWalletIsAvailable(CWallet *, bool avoidException);
|
||||
|
||||
UniValue getaddressinfo(const JSONRPCRequest& request);
|
||||
UniValue signrawtransactionwithwallet(const JSONRPCRequest& request);
|
||||
#endif //BITCOIN_WALLET_RPCWALLET_H
|
||||
|
@ -150,8 +150,8 @@ class DIP3Test(BitcoinTestFramework):
|
||||
addr1 = self.nodes[0].getnewaddress()
|
||||
addr2 = self.nodes[0].getnewaddress()
|
||||
|
||||
addr1Obj = self.nodes[0].validateaddress(addr1)
|
||||
addr2Obj = self.nodes[0].validateaddress(addr2)
|
||||
addr1Obj = self.nodes[0].getaddressinfo(addr1)
|
||||
addr2Obj = self.nodes[0].getaddressinfo(addr2)
|
||||
|
||||
multisig = self.nodes[0].createmultisig(1, [addr1Obj['pubkey'], addr2Obj['pubkey']])['address']
|
||||
self.update_mn_payee(mns[0], multisig)
|
||||
|
@ -9,7 +9,7 @@ class DeprecatedRpcTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 2
|
||||
self.setup_clean_chain = True
|
||||
self.extra_args = [[], []]
|
||||
self.extra_args = [[], ["-deprecatedrpc=validateaddress"]]
|
||||
|
||||
def run_test(self):
|
||||
# This test should be used to verify correct behaviour of deprecated
|
||||
@ -18,10 +18,13 @@ class DeprecatedRpcTest(BitcoinTestFramework):
|
||||
# self.log.info("Make sure that -deprecatedrpc=createmultisig allows it to take addresses")
|
||||
# assert_raises_rpc_error(-5, "Invalid public key", self.nodes[0].createmultisig, 1, [self.nodes[0].getnewaddress()])
|
||||
# self.nodes[1].createmultisig(1, [self.nodes[1].getnewaddress()])
|
||||
#
|
||||
# There are currently no deprecated RPC methods in master, so this
|
||||
# test is currently empty.
|
||||
pass
|
||||
|
||||
self.log.info("Test validateaddress deprecation")
|
||||
SOME_ADDRESS = "yZNRHJXRPAiSMXd2knNE174gFqYKFbwVvB" # This is just some random address to pass as a parameter to validateaddress
|
||||
dep_validate_address = self.nodes[0].validateaddress(SOME_ADDRESS)
|
||||
assert "ismine" not in dep_validate_address
|
||||
not_dep_val = self.nodes[1].validateaddress(SOME_ADDRESS)
|
||||
assert "ismine" in not_dep_val
|
||||
|
||||
if __name__ == '__main__':
|
||||
DeprecatedRpcTest().main()
|
||||
|
@ -64,7 +64,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
assert_equal(rawmatch["changepos"], -1)
|
||||
|
||||
watchonly_address = self.nodes[0].getnewaddress()
|
||||
watchonly_pubkey = self.nodes[0].validateaddress(watchonly_address)["pubkey"]
|
||||
watchonly_pubkey = self.nodes[0].getaddressinfo(watchonly_address)["pubkey"]
|
||||
watchonly_amount = Decimal(2000)
|
||||
self.nodes[3].importpubkey(watchonly_pubkey, "", True)
|
||||
watchonly_txid = self.nodes[0].sendtoaddress(watchonly_address, watchonly_amount)
|
||||
@ -374,8 +374,8 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
addr1 = self.nodes[1].getnewaddress()
|
||||
addr2 = self.nodes[1].getnewaddress()
|
||||
|
||||
addr1Obj = self.nodes[1].validateaddress(addr1)
|
||||
addr2Obj = self.nodes[1].validateaddress(addr2)
|
||||
addr1Obj = self.nodes[1].getaddressinfo(addr1)
|
||||
addr2Obj = self.nodes[1].getaddressinfo(addr2)
|
||||
|
||||
mSigObj = self.nodes[1].addmultisigaddress(2, [addr1Obj['pubkey'], addr2Obj['pubkey']])['address']
|
||||
|
||||
@ -404,11 +404,11 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
addr4 = self.nodes[1].getnewaddress()
|
||||
addr5 = self.nodes[1].getnewaddress()
|
||||
|
||||
addr1Obj = self.nodes[1].validateaddress(addr1)
|
||||
addr2Obj = self.nodes[1].validateaddress(addr2)
|
||||
addr3Obj = self.nodes[1].validateaddress(addr3)
|
||||
addr4Obj = self.nodes[1].validateaddress(addr4)
|
||||
addr5Obj = self.nodes[1].validateaddress(addr5)
|
||||
addr1Obj = self.nodes[1].getaddressinfo(addr1)
|
||||
addr2Obj = self.nodes[1].getaddressinfo(addr2)
|
||||
addr3Obj = self.nodes[1].getaddressinfo(addr3)
|
||||
addr4Obj = self.nodes[1].getaddressinfo(addr4)
|
||||
addr5Obj = self.nodes[1].getaddressinfo(addr5)
|
||||
|
||||
mSigObj = self.nodes[1].addmultisigaddress(4, [addr1Obj['pubkey'], addr2Obj['pubkey'], addr3Obj['pubkey'], addr4Obj['pubkey'], addr5Obj['pubkey']])['address']
|
||||
|
||||
@ -434,8 +434,8 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
addr1 = self.nodes[2].getnewaddress()
|
||||
addr2 = self.nodes[2].getnewaddress()
|
||||
|
||||
addr1Obj = self.nodes[2].validateaddress(addr1)
|
||||
addr2Obj = self.nodes[2].validateaddress(addr2)
|
||||
addr1Obj = self.nodes[2].getaddressinfo(addr1)
|
||||
addr2Obj = self.nodes[2].getaddressinfo(addr2)
|
||||
|
||||
mSigObj = self.nodes[2].addmultisigaddress(2, [addr1Obj['pubkey'], addr2Obj['pubkey']])['address']
|
||||
|
||||
|
@ -47,7 +47,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
self.sync_all()
|
||||
|
||||
watchonly_address = self.nodes[0].getnewaddress()
|
||||
watchonly_pubkey = self.nodes[0].validateaddress(watchonly_address)["pubkey"]
|
||||
watchonly_pubkey = self.nodes[0].getaddressinfo(watchonly_address)["pubkey"]
|
||||
watchonly_amount = Decimal(2000)
|
||||
self.nodes[3].importpubkey(watchonly_pubkey, "", True)
|
||||
watchonly_txid = self.nodes[0].sendtoaddress(watchonly_address, watchonly_amount)
|
||||
@ -350,8 +350,8 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
addr1 = self.nodes[1].getnewaddress()
|
||||
addr2 = self.nodes[1].getnewaddress()
|
||||
|
||||
addr1Obj = self.nodes[1].validateaddress(addr1)
|
||||
addr2Obj = self.nodes[1].validateaddress(addr2)
|
||||
addr1Obj = self.nodes[1].getaddressinfo(addr1)
|
||||
addr2Obj = self.nodes[1].getaddressinfo(addr2)
|
||||
|
||||
mSigObj = self.nodes[1].addmultisigaddress(2, [addr1Obj['pubkey'], addr2Obj['pubkey']])['address']
|
||||
|
||||
@ -380,11 +380,11 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
addr4 = self.nodes[1].getnewaddress()
|
||||
addr5 = self.nodes[1].getnewaddress()
|
||||
|
||||
addr1Obj = self.nodes[1].validateaddress(addr1)
|
||||
addr2Obj = self.nodes[1].validateaddress(addr2)
|
||||
addr3Obj = self.nodes[1].validateaddress(addr3)
|
||||
addr4Obj = self.nodes[1].validateaddress(addr4)
|
||||
addr5Obj = self.nodes[1].validateaddress(addr5)
|
||||
addr1Obj = self.nodes[1].getaddressinfo(addr1)
|
||||
addr2Obj = self.nodes[1].getaddressinfo(addr2)
|
||||
addr3Obj = self.nodes[1].getaddressinfo(addr3)
|
||||
addr4Obj = self.nodes[1].getaddressinfo(addr4)
|
||||
addr5Obj = self.nodes[1].getaddressinfo(addr5)
|
||||
|
||||
mSigObj = self.nodes[1].addmultisigaddress(4, [addr1Obj['pubkey'], addr2Obj['pubkey'], addr3Obj['pubkey'], addr4Obj['pubkey'], addr5Obj['pubkey']])['address']
|
||||
|
||||
@ -410,8 +410,8 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
addr1 = self.nodes[2].getnewaddress()
|
||||
addr2 = self.nodes[2].getnewaddress()
|
||||
|
||||
addr1Obj = self.nodes[2].validateaddress(addr1)
|
||||
addr2Obj = self.nodes[2].validateaddress(addr2)
|
||||
addr1Obj = self.nodes[2].getaddressinfo(addr1)
|
||||
addr2Obj = self.nodes[2].getaddressinfo(addr2)
|
||||
|
||||
mSigObj = self.nodes[2].addmultisigaddress(2, [addr1Obj['pubkey'], addr2Obj['pubkey']])['address']
|
||||
|
||||
|
@ -81,7 +81,7 @@ class ListTransactionsTest(BitcoinTestFramework):
|
||||
{"category":"receive","amount":Decimal("0.44")},
|
||||
{"txid":txid, "account" : "toself"} )
|
||||
|
||||
pubkey = self.nodes[1].validateaddress(self.nodes[1].getnewaddress())['pubkey']
|
||||
pubkey = self.nodes[1].getaddressinfo(self.nodes[1].getnewaddress())['pubkey']
|
||||
multisig = self.nodes[1].createmultisig(1, [pubkey])
|
||||
self.nodes[0].importaddress(multisig["redeemScript"], "watchonly", False, True)
|
||||
txid = self.nodes[1].sendtoaddress(multisig["address"], 0.1)
|
||||
|
@ -179,8 +179,8 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
addr1 = self.nodes[2].getnewaddress()
|
||||
addr2 = self.nodes[2].getnewaddress()
|
||||
|
||||
addr1Obj = self.nodes[2].validateaddress(addr1)
|
||||
addr2Obj = self.nodes[2].validateaddress(addr2)
|
||||
addr1Obj = self.nodes[2].getaddressinfo(addr1)
|
||||
addr2Obj = self.nodes[2].getaddressinfo(addr2)
|
||||
|
||||
# Tests for createmultisig and addmultisigaddress
|
||||
assert_raises_rpc_error(-5, "Invalid public key", self.nodes[0].createmultisig, 1, ["01020304"])
|
||||
@ -206,9 +206,9 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
addr2 = self.nodes[2].getnewaddress()
|
||||
addr3 = self.nodes[2].getnewaddress()
|
||||
|
||||
addr1Obj = self.nodes[1].validateaddress(addr1)
|
||||
addr2Obj = self.nodes[2].validateaddress(addr2)
|
||||
addr3Obj = self.nodes[2].validateaddress(addr3)
|
||||
addr1Obj = self.nodes[1].getaddressinfo(addr1)
|
||||
addr2Obj = self.nodes[2].getaddressinfo(addr2)
|
||||
addr3Obj = self.nodes[2].getaddressinfo(addr3)
|
||||
|
||||
mSigObj = self.nodes[2].addmultisigaddress(2, [addr1Obj['pubkey'], addr2Obj['pubkey'], addr3Obj['pubkey']])['address']
|
||||
|
||||
@ -252,12 +252,12 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
addr1 = self.nodes[1].getnewaddress()
|
||||
addr2 = self.nodes[2].getnewaddress()
|
||||
|
||||
addr1Obj = self.nodes[1].validateaddress(addr1)
|
||||
addr2Obj = self.nodes[2].validateaddress(addr2)
|
||||
addr1Obj = self.nodes[1].getaddressinfo(addr1)
|
||||
addr2Obj = self.nodes[2].getaddressinfo(addr2)
|
||||
|
||||
self.nodes[1].addmultisigaddress(2, [addr1Obj['pubkey'], addr2Obj['pubkey']])['address']
|
||||
mSigObj = self.nodes[2].addmultisigaddress(2, [addr1Obj['pubkey'], addr2Obj['pubkey']])['address']
|
||||
mSigObjValid = self.nodes[2].validateaddress(mSigObj)
|
||||
mSigObjValid = self.nodes[2].getaddressinfo(mSigObj)
|
||||
|
||||
txId = self.nodes[0].sendtoaddress(mSigObj, 2.2)
|
||||
decTx = self.nodes[0].gettransaction(txId)
|
||||
|
@ -326,7 +326,7 @@ class WalletTest(BitcoinTestFramework):
|
||||
self.nodes[1].importaddress(address_to_import)
|
||||
|
||||
# 3. Validate that the imported address is watch-only on node1
|
||||
assert(self.nodes[1].validateaddress(address_to_import)["iswatchonly"])
|
||||
assert(self.nodes[1].getaddressinfo(address_to_import)["iswatchonly"])
|
||||
|
||||
# 4. Check that the unspents after import are not spendable
|
||||
assert_array_result(self.nodes[1].listunspent(),
|
||||
@ -451,5 +451,14 @@ class WalletTest(BitcoinTestFramework):
|
||||
# Verify nothing new in wallet
|
||||
assert_equal(total_txs, len(self.nodes[0].listtransactions("*",99999)))
|
||||
|
||||
# Test getaddressinfo. Note that these addresses are taken from disablewallet.py
|
||||
assert_raises_rpc_error(-5, "Invalid address", self.nodes[0].getaddressinfo, "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy")
|
||||
address_info = self.nodes[0].getaddressinfo("yjQ5gLvGRtmq1cwc4kePLCrzQ8GVCh9Gaz")
|
||||
assert_equal(address_info['address'], "yjQ5gLvGRtmq1cwc4kePLCrzQ8GVCh9Gaz")
|
||||
assert_equal(address_info["scriptPubKey"], "76a914fd2b4d101724a76374fccbc5b6df7670a75d7cd088ac")
|
||||
assert not address_info["ismine"]
|
||||
assert not address_info["iswatchonly"]
|
||||
assert not address_info["isscript"]
|
||||
|
||||
if __name__ == '__main__':
|
||||
WalletTest().main()
|
||||
|
@ -98,7 +98,7 @@ class WalletDumpTest(BitcoinTestFramework):
|
||||
addrs = []
|
||||
for i in range(0,test_addr_count):
|
||||
addr = self.nodes[0].getnewaddress()
|
||||
vaddr= self.nodes[0].validateaddress(addr) #required to get hd keypath
|
||||
vaddr= self.nodes[0].getaddressinfo(addr) #required to get hd keypath
|
||||
addrs.append(vaddr)
|
||||
# Should be a no-op:
|
||||
self.nodes[0].keypoolrefill()
|
||||
@ -144,13 +144,13 @@ class WalletDumpTest(BitcoinTestFramework):
|
||||
self.start_node(0, ['-wallet=w2'])
|
||||
|
||||
# Make sure the address is not IsMine before import
|
||||
result = self.nodes[0].validateaddress(multisig_addr)
|
||||
result = self.nodes[0].getaddressinfo(multisig_addr)
|
||||
assert(result['ismine'] == False)
|
||||
|
||||
self.nodes[0].importwallet(wallet_unenc_dump)
|
||||
|
||||
# Now check IsMine is true
|
||||
result = self.nodes[0].validateaddress(multisig_addr)
|
||||
result = self.nodes[0].getaddressinfo(multisig_addr)
|
||||
assert(result['ismine'] == True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -37,7 +37,7 @@ class WalletHDTest(BitcoinTestFramework):
|
||||
|
||||
# create an internal key
|
||||
change_addr = self.nodes[1].getrawchangeaddress()
|
||||
change_addrV= self.nodes[1].validateaddress(change_addr)
|
||||
change_addrV= self.nodes[1].getaddressinfo(change_addr)
|
||||
assert_equal(change_addrV["hdkeypath"], "m/44'/1'/0'/1/0") #first internal child key
|
||||
|
||||
# Import a non-HD private key in the HD wallet
|
||||
@ -55,7 +55,7 @@ class WalletHDTest(BitcoinTestFramework):
|
||||
NUM_HD_ADDS = 10
|
||||
for i in range(NUM_HD_ADDS):
|
||||
hd_add = self.nodes[1].getnewaddress()
|
||||
hd_info = self.nodes[1].validateaddress(hd_add)
|
||||
hd_info = self.nodes[1].getaddressinfo(hd_add)
|
||||
assert_equal(hd_info["hdkeypath"], "m/44'/1'/0'/0/"+str(i))
|
||||
assert_equal(hd_info["hdchainid"], chainid)
|
||||
self.nodes[0].sendtoaddress(hd_add, 1)
|
||||
@ -65,7 +65,7 @@ class WalletHDTest(BitcoinTestFramework):
|
||||
|
||||
# create an internal key (again)
|
||||
change_addr = self.nodes[1].getrawchangeaddress()
|
||||
change_addrV= self.nodes[1].validateaddress(change_addr)
|
||||
change_addrV= self.nodes[1].getaddressinfo(change_addr)
|
||||
assert_equal(change_addrV["hdkeypath"], "m/44'/1'/0'/1/1") #second internal child key
|
||||
|
||||
self.sync_all()
|
||||
@ -86,7 +86,7 @@ class WalletHDTest(BitcoinTestFramework):
|
||||
hd_add_2 = None
|
||||
for i in range(NUM_HD_ADDS):
|
||||
hd_add_2 = self.nodes[1].getnewaddress()
|
||||
hd_info_2 = self.nodes[1].validateaddress(hd_add_2)
|
||||
hd_info_2 = self.nodes[1].getaddressinfo(hd_add_2)
|
||||
assert_equal(hd_info_2["hdkeypath"], "m/44'/1'/0'/0/"+str(i))
|
||||
assert_equal(hd_info_2["hdchainid"], chainid)
|
||||
assert_equal(hd_add, hd_add_2)
|
||||
@ -124,7 +124,7 @@ class WalletHDTest(BitcoinTestFramework):
|
||||
keypath = ""
|
||||
for out in outs:
|
||||
if out['value'] != 1:
|
||||
keypath = self.nodes[1].validateaddress(out['scriptPubKey']['addresses'][0])['hdkeypath']
|
||||
keypath = self.nodes[1].getaddressinfo(out['scriptPubKey']['addresses'][0])['hdkeypath']
|
||||
|
||||
assert_equal(keypath[0:13], "m/44'/1'/0'/1")
|
||||
|
||||
|
@ -136,7 +136,7 @@ class ImportRescanTest(BitcoinTestFramework):
|
||||
# each possible type of wallet import RPC.
|
||||
for i, variant in enumerate(IMPORT_VARIANTS):
|
||||
variant.label = "label {} {}".format(i, variant)
|
||||
variant.address = self.nodes[1].validateaddress(self.nodes[1].getnewaddress(variant.label))
|
||||
variant.address = self.nodes[1].getaddressinfo(self.nodes[1].getnewaddress(variant.label))
|
||||
variant.key = self.nodes[1].dumpprivkey(variant.address["address"])
|
||||
variant.initial_amount = 10 - (i + 1) / 4.0
|
||||
variant.initial_txid = self.nodes[0].sendtoaddress(variant.address["address"], variant.initial_amount)
|
||||
|
@ -20,7 +20,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
self.nodes[1].generate(1)
|
||||
timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime']
|
||||
|
||||
node0_address1 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
node0_address1 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
|
||||
#Check only one address
|
||||
assert_equal(node0_address1['ismine'], True)
|
||||
@ -29,7 +29,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
assert_equal(self.nodes[1].getblockcount(),1)
|
||||
|
||||
#Address Test - before import
|
||||
address_info = self.nodes[1].validateaddress(node0_address1['address'])
|
||||
address_info = self.nodes[1].getaddressinfo(node0_address1['address'])
|
||||
assert_equal(address_info['iswatchonly'], False)
|
||||
assert_equal(address_info['ismine'], False)
|
||||
|
||||
@ -38,7 +38,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
|
||||
# Bitcoin Address
|
||||
self.log.info("Should import an address")
|
||||
address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
result = self.nodes[1].importmulti([{
|
||||
"scriptPubKey": {
|
||||
"address": address['address']
|
||||
@ -46,7 +46,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
"timestamp": "now",
|
||||
}])
|
||||
assert_equal(result[0]['success'], True)
|
||||
address_assert = self.nodes[1].validateaddress(address['address'])
|
||||
address_assert = self.nodes[1].getaddressinfo(address['address'])
|
||||
assert_equal(address_assert['iswatchonly'], True)
|
||||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal(address_assert['timestamp'], timestamp)
|
||||
@ -66,21 +66,21 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
|
||||
# ScriptPubKey + internal
|
||||
self.log.info("Should import a scriptPubKey with internal flag")
|
||||
address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
result = self.nodes[1].importmulti([{
|
||||
"scriptPubKey": address['scriptPubKey'],
|
||||
"timestamp": "now",
|
||||
"internal": True
|
||||
}])
|
||||
assert_equal(result[0]['success'], True)
|
||||
address_assert = self.nodes[1].validateaddress(address['address'])
|
||||
address_assert = self.nodes[1].getaddressinfo(address['address'])
|
||||
assert_equal(address_assert['iswatchonly'], True)
|
||||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal(address_assert['timestamp'], timestamp)
|
||||
|
||||
# ScriptPubKey + !internal
|
||||
self.log.info("Should not import a scriptPubKey without internal flag")
|
||||
address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
result = self.nodes[1].importmulti([{
|
||||
"scriptPubKey": address['scriptPubKey'],
|
||||
"timestamp": "now",
|
||||
@ -88,7 +88,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
assert_equal(result[0]['success'], False)
|
||||
assert_equal(result[0]['error']['code'], -8)
|
||||
assert_equal(result[0]['error']['message'], 'Internal must be set for hex scriptPubKey')
|
||||
address_assert = self.nodes[1].validateaddress(address['address'])
|
||||
address_assert = self.nodes[1].getaddressinfo(address['address'])
|
||||
assert_equal(address_assert['iswatchonly'], False)
|
||||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal('timestamp' in address_assert, False)
|
||||
@ -96,7 +96,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
|
||||
# Address + Public key + !Internal
|
||||
self.log.info("Should import an address with public key")
|
||||
address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
result = self.nodes[1].importmulti([{
|
||||
"scriptPubKey": {
|
||||
"address": address['address']
|
||||
@ -105,7 +105,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
"pubkeys": [ address['pubkey'] ]
|
||||
}])
|
||||
assert_equal(result[0]['success'], True)
|
||||
address_assert = self.nodes[1].validateaddress(address['address'])
|
||||
address_assert = self.nodes[1].getaddressinfo(address['address'])
|
||||
assert_equal(address_assert['iswatchonly'], True)
|
||||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal(address_assert['timestamp'], timestamp)
|
||||
@ -113,7 +113,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
|
||||
# ScriptPubKey + Public key + internal
|
||||
self.log.info("Should import a scriptPubKey with internal and with public key")
|
||||
address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
request = [{
|
||||
"scriptPubKey": address['scriptPubKey'],
|
||||
"timestamp": "now",
|
||||
@ -122,14 +122,14 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
}]
|
||||
result = self.nodes[1].importmulti(request)
|
||||
assert_equal(result[0]['success'], True)
|
||||
address_assert = self.nodes[1].validateaddress(address['address'])
|
||||
address_assert = self.nodes[1].getaddressinfo(address['address'])
|
||||
assert_equal(address_assert['iswatchonly'], True)
|
||||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal(address_assert['timestamp'], timestamp)
|
||||
|
||||
# ScriptPubKey + Public key + !internal
|
||||
self.log.info("Should not import a scriptPubKey without internal and with public key")
|
||||
address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
request = [{
|
||||
"scriptPubKey": address['scriptPubKey'],
|
||||
"timestamp": "now",
|
||||
@ -139,14 +139,14 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
assert_equal(result[0]['success'], False)
|
||||
assert_equal(result[0]['error']['code'], -8)
|
||||
assert_equal(result[0]['error']['message'], 'Internal must be set for hex scriptPubKey')
|
||||
address_assert = self.nodes[1].validateaddress(address['address'])
|
||||
address_assert = self.nodes[1].getaddressinfo(address['address'])
|
||||
assert_equal(address_assert['iswatchonly'], False)
|
||||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal('timestamp' in address_assert, False)
|
||||
|
||||
# Address + Private key + !watchonly
|
||||
self.log.info("Should import an address with private key")
|
||||
address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
result = self.nodes[1].importmulti([{
|
||||
"scriptPubKey": {
|
||||
"address": address['address']
|
||||
@ -155,7 +155,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
"keys": [ self.nodes[0].dumpprivkey(address['address']) ]
|
||||
}])
|
||||
assert_equal(result[0]['success'], True)
|
||||
address_assert = self.nodes[1].validateaddress(address['address'])
|
||||
address_assert = self.nodes[1].getaddressinfo(address['address'])
|
||||
assert_equal(address_assert['iswatchonly'], False)
|
||||
assert_equal(address_assert['ismine'], True)
|
||||
assert_equal(address_assert['timestamp'], timestamp)
|
||||
@ -174,7 +174,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
|
||||
# Address + Private key + watchonly
|
||||
self.log.info("Should not import an address with private key and with watchonly")
|
||||
address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
result = self.nodes[1].importmulti([{
|
||||
"scriptPubKey": {
|
||||
"address": address['address']
|
||||
@ -186,14 +186,14 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
assert_equal(result[0]['success'], False)
|
||||
assert_equal(result[0]['error']['code'], -8)
|
||||
assert_equal(result[0]['error']['message'], 'Incompatibility found between watchonly and keys')
|
||||
address_assert = self.nodes[1].validateaddress(address['address'])
|
||||
address_assert = self.nodes[1].getaddressinfo(address['address'])
|
||||
assert_equal(address_assert['iswatchonly'], False)
|
||||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal('timestamp' in address_assert, False)
|
||||
|
||||
# ScriptPubKey + Private key + internal
|
||||
self.log.info("Should import a scriptPubKey with internal and with private key")
|
||||
address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
result = self.nodes[1].importmulti([{
|
||||
"scriptPubKey": address['scriptPubKey'],
|
||||
"timestamp": "now",
|
||||
@ -201,14 +201,14 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
"internal": True
|
||||
}])
|
||||
assert_equal(result[0]['success'], True)
|
||||
address_assert = self.nodes[1].validateaddress(address['address'])
|
||||
address_assert = self.nodes[1].getaddressinfo(address['address'])
|
||||
assert_equal(address_assert['iswatchonly'], False)
|
||||
assert_equal(address_assert['ismine'], True)
|
||||
assert_equal(address_assert['timestamp'], timestamp)
|
||||
|
||||
# ScriptPubKey + Private key + !internal
|
||||
self.log.info("Should not import a scriptPubKey without internal and with private key")
|
||||
address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
result = self.nodes[1].importmulti([{
|
||||
"scriptPubKey": address['scriptPubKey'],
|
||||
"timestamp": "now",
|
||||
@ -217,16 +217,16 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
assert_equal(result[0]['success'], False)
|
||||
assert_equal(result[0]['error']['code'], -8)
|
||||
assert_equal(result[0]['error']['message'], 'Internal must be set for hex scriptPubKey')
|
||||
address_assert = self.nodes[1].validateaddress(address['address'])
|
||||
address_assert = self.nodes[1].getaddressinfo(address['address'])
|
||||
assert_equal(address_assert['iswatchonly'], False)
|
||||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal('timestamp' in address_assert, False)
|
||||
|
||||
|
||||
# P2SH address
|
||||
sig_address_1 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
sig_address_2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
sig_address_3 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
sig_address_1 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
sig_address_2 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
sig_address_3 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
multi_sig_script = self.nodes[0].createmultisig(2, [sig_address_1['pubkey'], sig_address_2['pubkey'], sig_address_3['pubkey']])
|
||||
self.nodes[1].generate(100)
|
||||
self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00)
|
||||
@ -241,7 +241,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
"timestamp": "now",
|
||||
}])
|
||||
assert_equal(result[0]['success'], True)
|
||||
address_assert = self.nodes[1].validateaddress(multi_sig_script['address'])
|
||||
address_assert = self.nodes[1].getaddressinfo(multi_sig_script['address'])
|
||||
assert_equal(address_assert['isscript'], True)
|
||||
assert_equal(address_assert['iswatchonly'], True)
|
||||
assert_equal(address_assert['timestamp'], timestamp)
|
||||
@ -251,9 +251,9 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
|
||||
|
||||
# P2SH + Redeem script
|
||||
sig_address_1 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
sig_address_2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
sig_address_3 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
sig_address_1 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
sig_address_2 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
sig_address_3 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
multi_sig_script = self.nodes[0].createmultisig(2, [sig_address_1['pubkey'], sig_address_2['pubkey'], sig_address_3['pubkey']])
|
||||
self.nodes[1].generate(100)
|
||||
self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00)
|
||||
@ -269,7 +269,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
"redeemscript": multi_sig_script['redeemScript']
|
||||
}])
|
||||
assert_equal(result[0]['success'], True)
|
||||
address_assert = self.nodes[1].validateaddress(multi_sig_script['address'])
|
||||
address_assert = self.nodes[1].getaddressinfo(multi_sig_script['address'])
|
||||
assert_equal(address_assert['timestamp'], timestamp)
|
||||
|
||||
p2shunspent = self.nodes[1].listunspent(0,999999, [multi_sig_script['address']])[0]
|
||||
@ -278,9 +278,9 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
|
||||
|
||||
# P2SH + Redeem script + Private Keys + !Watchonly
|
||||
sig_address_1 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
sig_address_2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
sig_address_3 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
sig_address_1 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
sig_address_2 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
sig_address_3 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
multi_sig_script = self.nodes[0].createmultisig(2, [sig_address_1['pubkey'], sig_address_2['pubkey'], sig_address_3['pubkey']])
|
||||
self.nodes[1].generate(100)
|
||||
self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00)
|
||||
@ -297,7 +297,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
"keys": [ self.nodes[0].dumpprivkey(sig_address_1['address']), self.nodes[0].dumpprivkey(sig_address_2['address'])]
|
||||
}])
|
||||
assert_equal(result[0]['success'], True)
|
||||
address_assert = self.nodes[1].validateaddress(multi_sig_script['address'])
|
||||
address_assert = self.nodes[1].getaddressinfo(multi_sig_script['address'])
|
||||
assert_equal(address_assert['timestamp'], timestamp)
|
||||
|
||||
p2shunspent = self.nodes[1].listunspent(0,999999, [multi_sig_script['address']])[0]
|
||||
@ -305,9 +305,9 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
assert_equal(p2shunspent['solvable'], True)
|
||||
|
||||
# P2SH + Redeem script + Private Keys + Watchonly
|
||||
sig_address_1 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
sig_address_2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
sig_address_3 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
sig_address_1 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
sig_address_2 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
sig_address_3 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
multi_sig_script = self.nodes[0].createmultisig(2, [sig_address_1['pubkey'], sig_address_2['pubkey'], sig_address_3['pubkey']])
|
||||
self.nodes[1].generate(100)
|
||||
self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00)
|
||||
@ -331,8 +331,8 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
|
||||
# Address + Public key + !Internal + Wrong pubkey
|
||||
self.log.info("Should not import an address with a wrong public key")
|
||||
address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
address2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
address2 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
result = self.nodes[1].importmulti([{
|
||||
"scriptPubKey": {
|
||||
"address": address['address']
|
||||
@ -343,7 +343,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
assert_equal(result[0]['success'], False)
|
||||
assert_equal(result[0]['error']['code'], -5)
|
||||
assert_equal(result[0]['error']['message'], 'Consistency check failed')
|
||||
address_assert = self.nodes[1].validateaddress(address['address'])
|
||||
address_assert = self.nodes[1].getaddressinfo(address['address'])
|
||||
assert_equal(address_assert['iswatchonly'], False)
|
||||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal('timestamp' in address_assert, False)
|
||||
@ -351,8 +351,8 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
|
||||
# ScriptPubKey + Public key + internal + Wrong pubkey
|
||||
self.log.info("Should not import a scriptPubKey with internal and with a wrong public key")
|
||||
address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
address2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
address2 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
request = [{
|
||||
"scriptPubKey": address['scriptPubKey'],
|
||||
"timestamp": "now",
|
||||
@ -363,7 +363,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
assert_equal(result[0]['success'], False)
|
||||
assert_equal(result[0]['error']['code'], -5)
|
||||
assert_equal(result[0]['error']['message'], 'Consistency check failed')
|
||||
address_assert = self.nodes[1].validateaddress(address['address'])
|
||||
address_assert = self.nodes[1].getaddressinfo(address['address'])
|
||||
assert_equal(address_assert['iswatchonly'], False)
|
||||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal('timestamp' in address_assert, False)
|
||||
@ -371,8 +371,8 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
|
||||
# Address + Private key + !watchonly + Wrong private key
|
||||
self.log.info("Should not import an address with a wrong private key")
|
||||
address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
address2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
address2 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
result = self.nodes[1].importmulti([{
|
||||
"scriptPubKey": {
|
||||
"address": address['address']
|
||||
@ -383,7 +383,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
assert_equal(result[0]['success'], False)
|
||||
assert_equal(result[0]['error']['code'], -5)
|
||||
assert_equal(result[0]['error']['message'], 'Consistency check failed')
|
||||
address_assert = self.nodes[1].validateaddress(address['address'])
|
||||
address_assert = self.nodes[1].getaddressinfo(address['address'])
|
||||
assert_equal(address_assert['iswatchonly'], False)
|
||||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal('timestamp' in address_assert, False)
|
||||
@ -391,8 +391,8 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
|
||||
# ScriptPubKey + Private key + internal + Wrong private key
|
||||
self.log.info("Should not import a scriptPubKey with internal and with a wrong private key")
|
||||
address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
address2 = self.nodes[0].validateaddress(self.nodes[0].getnewaddress())
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
address2 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
result = self.nodes[1].importmulti([{
|
||||
"scriptPubKey": address['scriptPubKey'],
|
||||
"timestamp": "now",
|
||||
@ -402,7 +402,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
assert_equal(result[0]['success'], False)
|
||||
assert_equal(result[0]['error']['code'], -5)
|
||||
assert_equal(result[0]['error']['message'], 'Consistency check failed')
|
||||
address_assert = self.nodes[1].validateaddress(address['address'])
|
||||
address_assert = self.nodes[1].getaddressinfo(address['address'])
|
||||
assert_equal(address_assert['iswatchonly'], False)
|
||||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal('timestamp' in address_assert, False)
|
||||
@ -418,7 +418,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
"timestamp": "now",
|
||||
}])
|
||||
assert_equal(result[0]['success'], True)
|
||||
address_assert = self.nodes[1].validateaddress(watchonly_address)
|
||||
address_assert = self.nodes[1].getaddressinfo(watchonly_address)
|
||||
assert_equal(address_assert['iswatchonly'], True)
|
||||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal(address_assert['timestamp'], timestamp)
|
||||
@ -428,7 +428,7 @@ class ImportMultiTest (BitcoinTestFramework):
|
||||
# restart nodes to check for proper serialization/deserialization of watch only address
|
||||
self.stop_nodes()
|
||||
self.start_nodes()
|
||||
address_assert = self.nodes[1].validateaddress(watchonly_address)
|
||||
address_assert = self.nodes[1].getaddressinfo(watchonly_address)
|
||||
assert_equal(address_assert['iswatchonly'], True)
|
||||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal(address_assert['timestamp'], watchonly_timestamp)
|
||||
|
@ -26,7 +26,7 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
|
||||
address3_privkey = self.nodes[0].dumpprivkey(address3) # Using privkey
|
||||
|
||||
#Check only one address
|
||||
address_info = self.nodes[0].validateaddress(address1)
|
||||
address_info = self.nodes[0].getaddressinfo(address1)
|
||||
assert_equal(address_info['ismine'], True)
|
||||
|
||||
self.sync_all()
|
||||
@ -35,15 +35,15 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
|
||||
assert_equal(self.nodes[1].getblockcount(),101)
|
||||
|
||||
#Address Test - before import
|
||||
address_info = self.nodes[1].validateaddress(address1)
|
||||
address_info = self.nodes[1].getaddressinfo(address1)
|
||||
assert_equal(address_info['iswatchonly'], False)
|
||||
assert_equal(address_info['ismine'], False)
|
||||
|
||||
address_info = self.nodes[1].validateaddress(address2)
|
||||
address_info = self.nodes[1].getaddressinfo(address2)
|
||||
assert_equal(address_info['iswatchonly'], False)
|
||||
assert_equal(address_info['ismine'], False)
|
||||
|
||||
address_info = self.nodes[1].validateaddress(address3)
|
||||
address_info = self.nodes[1].getaddressinfo(address3)
|
||||
assert_equal(address_info['iswatchonly'], False)
|
||||
assert_equal(address_info['ismine'], False)
|
||||
|
||||
@ -84,13 +84,13 @@ class ImportPrunedFundsTest(BitcoinTestFramework):
|
||||
assert_equal(balance3, Decimal('0.025'))
|
||||
|
||||
#Addresses Test - after import
|
||||
address_info = self.nodes[1].validateaddress(address1)
|
||||
address_info = self.nodes[1].getaddressinfo(address1)
|
||||
assert_equal(address_info['iswatchonly'], False)
|
||||
assert_equal(address_info['ismine'], False)
|
||||
address_info = self.nodes[1].validateaddress(address2)
|
||||
address_info = self.nodes[1].getaddressinfo(address2)
|
||||
assert_equal(address_info['iswatchonly'], True)
|
||||
assert_equal(address_info['ismine'], False)
|
||||
address_info = self.nodes[1].validateaddress(address3)
|
||||
address_info = self.nodes[1].getaddressinfo(address3)
|
||||
assert_equal(address_info['iswatchonly'], False)
|
||||
assert_equal(address_info['ismine'], True)
|
||||
|
||||
|
@ -23,7 +23,7 @@ class KeyPoolTest(BitcoinTestFramework):
|
||||
def run_test(self):
|
||||
nodes = self.nodes
|
||||
addr_before_encrypting = nodes[0].getnewaddress()
|
||||
addr_before_encrypting_data = nodes[0].validateaddress(addr_before_encrypting)
|
||||
addr_before_encrypting_data = nodes[0].getaddressinfo(addr_before_encrypting)
|
||||
wallet_info_old = nodes[0].getwalletinfo()
|
||||
assert(addr_before_encrypting_data['hdchainid'] == wallet_info_old['hdchainid'])
|
||||
|
||||
@ -33,7 +33,7 @@ class KeyPoolTest(BitcoinTestFramework):
|
||||
self.start_node(0)
|
||||
# Keep creating keys
|
||||
addr = nodes[0].getnewaddress()
|
||||
addr_data = nodes[0].validateaddress(addr)
|
||||
addr_data = nodes[0].getaddressinfo(addr)
|
||||
wallet_info = nodes[0].getwalletinfo()
|
||||
assert(addr_before_encrypting_data['hdchainid'] == wallet_info['hdchainid'])
|
||||
assert(addr_data['hdchainid'] == wallet_info['hdchainid'])
|
||||
|
@ -63,7 +63,7 @@ class KeypoolRestoreTest(BitcoinTestFramework):
|
||||
assert_equal(self.nodes[1].getbalance(), 15)
|
||||
assert_equal(self.nodes[1].listtransactions()[0]['category'], "receive")
|
||||
# Check that we have marked all keys up to the used keypool key as used
|
||||
assert_equal(self.nodes[1].validateaddress(self.nodes[1].getnewaddress())['hdkeypath'], "m/44'/1'/0'/0/110")
|
||||
assert_equal(self.nodes[1].getaddressinfo(self.nodes[1].getnewaddress())['hdkeypath'], "m/44'/1'/0'/0/110")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user