MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / DisplayAddress

Method DisplayAddress

src/wallet/external_signer_scriptpubkeyman.cpp:66–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66util::Result<void> ExternalSignerScriptPubKeyMan::DisplayAddress(const CTxDestination& dest, const ExternalSigner &signer) const
67{
68 // TODO: avoid the need to infer a descriptor from inside a descriptor wallet
69 const CScript& scriptPubKey = GetScriptForDestination(dest);
70 auto provider = GetSolvingProvider(scriptPubKey);
71 auto descriptor = InferDescriptor(scriptPubKey, *provider);
72
73 const UniValue& result = signer.DisplayAddress(descriptor->ToString());
74
75 const UniValue& error = result.find_value("error");
76 if (error.isStr()) return util::Error{strprintf(_("Signer returned error: %s"), error.getValStr())};
77
78 const UniValue& ret_address = result.find_value("address");
79 if (!ret_address.isStr()) return util::Error{_("Signer did not echo address")};
80
81 if (ret_address.getValStr() != EncodeDestination(dest)) {
82 return util::Error{strprintf(_("Signer echoed unexpected address %s"), ret_address.getValStr())};
83 }
84
85 return util::Result<void>();
86}
87
88// If sign is true, transaction must previously have been filled
89std::optional<PSBTError> ExternalSignerScriptPubKeyMan::FillPSBT(PartiallySignedTransaction& psbt, const PrecomputedTransactionData& txdata, const common::PSBTFillOptions& options, int* n_signed) const

Callers

nothing calls this directly

Calls 6

GetScriptForDestinationFunction · 0.85
InferDescriptorFunction · 0.85
_Function · 0.85
EncodeDestinationFunction · 0.85
isStrMethod · 0.80
ToStringMethod · 0.45

Tested by

no test coverage detected