Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 3,489 Lines • ▼ Show 20 Lines | for (const COutput &out : vecOutputs) { | ||||
const auto *address_book_entry = | const auto *address_book_entry = | ||||
pwallet->FindAddressBookEntry(address); | pwallet->FindAddressBookEntry(address); | ||||
if (address_book_entry) { | if (address_book_entry) { | ||||
entry.pushKV("label", address_book_entry->GetLabel()); | entry.pushKV("label", address_book_entry->GetLabel()); | ||||
} | } | ||||
std::unique_ptr<SigningProvider> provider = | std::unique_ptr<SigningProvider> provider = | ||||
pwallet->GetSigningProvider(scriptPubKey); | pwallet->GetSolvingProvider(scriptPubKey); | ||||
if (provider) { | if (provider) { | ||||
if (scriptPubKey.IsPayToScriptHash()) { | if (scriptPubKey.IsPayToScriptHash()) { | ||||
const CScriptID &hash = | const CScriptID &hash = | ||||
CScriptID(boost::get<ScriptHash>(address)); | CScriptID(boost::get<ScriptHash>(address)); | ||||
CScript redeemScript; | CScript redeemScript; | ||||
if (provider->GetCScript(hash, redeemScript)) { | if (provider->GetCScript(hash, redeemScript)) { | ||||
entry.pushKV( | entry.pushKV( | ||||
"redeemScript", | "redeemScript", | ||||
HexStr(redeemScript.begin(), redeemScript.end())); | HexStr(redeemScript.begin(), redeemScript.end())); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
entry.pushKV("scriptPubKey", | entry.pushKV("scriptPubKey", | ||||
HexStr(scriptPubKey.begin(), scriptPubKey.end())); | HexStr(scriptPubKey.begin(), scriptPubKey.end())); | ||||
entry.pushKV("amount", ValueFromAmount(out.tx->tx->vout[out.i].nValue)); | entry.pushKV("amount", ValueFromAmount(out.tx->tx->vout[out.i].nValue)); | ||||
entry.pushKV("confirmations", out.nDepth); | entry.pushKV("confirmations", out.nDepth); | ||||
entry.pushKV("spendable", out.fSpendable); | entry.pushKV("spendable", out.fSpendable); | ||||
entry.pushKV("solvable", out.fSolvable); | entry.pushKV("solvable", out.fSolvable); | ||||
if (out.fSolvable) { | if (out.fSolvable) { | ||||
std::unique_ptr<SigningProvider> provider = | std::unique_ptr<SigningProvider> provider = | ||||
pwallet->GetSigningProvider(scriptPubKey); | pwallet->GetSolvingProvider(scriptPubKey); | ||||
if (provider) { | if (provider) { | ||||
auto descriptor = InferDescriptor(scriptPubKey, *provider); | auto descriptor = InferDescriptor(scriptPubKey, *provider); | ||||
entry.pushKV("desc", descriptor->ToString()); | entry.pushKV("desc", descriptor->ToString()); | ||||
} | } | ||||
} | } | ||||
if (avoid_reuse) { | if (avoid_reuse) { | ||||
entry.pushKV("reused", reused); | entry.pushKV("reused", reused); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 536 Lines • ▼ Show 20 Lines | |||||
static UniValue DescribeWalletAddress(CWallet *pwallet, | static UniValue DescribeWalletAddress(CWallet *pwallet, | ||||
const CTxDestination &dest) { | const CTxDestination &dest) { | ||||
UniValue ret(UniValue::VOBJ); | UniValue ret(UniValue::VOBJ); | ||||
UniValue detail = DescribeAddress(dest); | UniValue detail = DescribeAddress(dest); | ||||
CScript script = GetScriptForDestination(dest); | CScript script = GetScriptForDestination(dest); | ||||
std::unique_ptr<SigningProvider> provider = nullptr; | std::unique_ptr<SigningProvider> provider = nullptr; | ||||
if (pwallet) { | if (pwallet) { | ||||
provider = pwallet->GetSigningProvider(script); | provider = pwallet->GetSolvingProvider(script); | ||||
} | } | ||||
ret.pushKVs(detail); | ret.pushKVs(detail); | ||||
ret.pushKVs(boost::apply_visitor( | ret.pushKVs(boost::apply_visitor( | ||||
DescribeWalletAddressVisitor(provider.get()), dest)); | DescribeWalletAddressVisitor(provider.get()), dest)); | ||||
return ret; | return ret; | ||||
} | } | ||||
/** Convert CAddressBookData to JSON record. */ | /** Convert CAddressBookData to JSON record. */ | ||||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | UniValue getaddressinfo(const Config &config, const JSONRPCRequest &request) { | ||||
std::string currentAddress = EncodeDestination(dest, config); | std::string currentAddress = EncodeDestination(dest, config); | ||||
ret.pushKV("address", currentAddress); | ret.pushKV("address", currentAddress); | ||||
CScript scriptPubKey = GetScriptForDestination(dest); | CScript scriptPubKey = GetScriptForDestination(dest); | ||||
ret.pushKV("scriptPubKey", | ret.pushKV("scriptPubKey", | ||||
HexStr(scriptPubKey.begin(), scriptPubKey.end())); | HexStr(scriptPubKey.begin(), scriptPubKey.end())); | ||||
std::unique_ptr<SigningProvider> provider = | std::unique_ptr<SigningProvider> provider = | ||||
pwallet->GetSigningProvider(scriptPubKey); | pwallet->GetSolvingProvider(scriptPubKey); | ||||
isminetype mine = pwallet->IsMine(dest); | isminetype mine = pwallet->IsMine(dest); | ||||
ret.pushKV("ismine", bool(mine & ISMINE_SPENDABLE)); | ret.pushKV("ismine", bool(mine & ISMINE_SPENDABLE)); | ||||
bool solvable = provider && IsSolvable(*provider, scriptPubKey); | bool solvable = provider && IsSolvable(*provider, scriptPubKey); | ||||
ret.pushKV("solvable", solvable); | ret.pushKV("solvable", solvable); | ||||
if (solvable) { | if (solvable) { | ||||
▲ Show 20 Lines • Show All 638 Lines • Show Last 20 Lines |