aboutsummaryrefslogtreecommitdiff
path: root/src/script/descriptor.cpp
diff options
context:
space:
mode:
authorSjors Provoost <sjors@sprovoost.nl>2018-12-12 10:08:08 +0100
committerSjors Provoost <sjors@sprovoost.nl>2019-01-29 16:55:45 +0100
commit2e68ffaf205866e4cea71f64e79bbfb89e17280a (patch)
tree92e743f148d366a8a124bf8155791a37ace6b968 /src/script/descriptor.cpp
parent2290269759ad10cc2e35958c7b0a63f3a7608621 (diff)
downloadbitcoin-2e68ffaf205866e4cea71f64e79bbfb89e17280a.tar.xz
[doc] descriptor: explain GetPubKey() usage with cached public key
Plus a few typo fixes.
Diffstat (limited to 'src/script/descriptor.cpp')
-rw-r--r--src/script/descriptor.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/script/descriptor.cpp b/src/script/descriptor.cpp
index 5f758ab42d..96cd93df5a 100644
--- a/src/script/descriptor.cpp
+++ b/src/script/descriptor.cpp
@@ -207,9 +207,11 @@ public:
/** Base class for all Descriptor implementations. */
class DescriptorImpl : public Descriptor
{
- //! Public key arguments for this descriptor (size 1 for PK, PKH, WPKH; any size of Multisig).
+ //! Public key arguments for this descriptor (size 1 for PK, PKH, WPKH; any size for Multisig).
const std::vector<std::unique_ptr<PubkeyProvider>> m_pubkey_args;
//! The sub-descriptor argument (nullptr for everything but SH and WSH).
+ //! In doc/descriptors.m this is referred to as SCRIPT expressions sh(SCRIPT)
+ //! and wsh(SCRIPT), and distinct from KEY expressions and ADDR expressions.
const std::unique_ptr<DescriptorImpl> m_subdescriptor_arg;
//! The string name of the descriptor function.
const std::string m_name;
@@ -295,6 +297,8 @@ public:
// Construct temporary data in `entries` and `subscripts`, to avoid producing output in case of failure.
for (const auto& p : m_pubkey_args) {
entries.emplace_back();
+ // If we have a cache, we don't need GetPubKey to compute the public key.
+ // Pass in nullptr to signify only origin info is desired.
if (!p->GetPubKey(pos, arg, cache_read ? nullptr : &entries.back().first, entries.back().second)) return false;
if (cache_read) {
// Cached expanded public key exists, use it.