aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2018-06-28 19:05:05 -0700
committerAndrew Chow <achow101-github@achow101.com>2018-07-16 16:08:24 -0700
commita4b06fb42eb0ad94e562ca839391b57e69285136 (patch)
treeab08f3ef40a2e47df0513f242cb9ad6fe35dda2f /src/script
parentc27fe419efb3b6588c400d764122ffb33375e028 (diff)
downloadbitcoin-a4b06fb42eb0ad94e562ca839391b57e69285136.tar.xz
Create wallet RPCs for PSBT
walletprocesspsbt takes a PSBT format transaction, updates the PSBT with any inputs related to this wallet, signs, and finalizes the transaction. There is also an option to not sign and just update. walletcreatefundedpsbt creates a PSBT from user provided data in the same form as createrawtransaction. It also funds the transaction and takes an options argument in the same form as fundrawtransaction. The resulting PSBT is blank with no input or output data filled in.
Diffstat (limited to 'src/script')
-rw-r--r--src/script/sign.cpp10
-rw-r--r--src/script/sign.h11
2 files changed, 21 insertions, 0 deletions
diff --git a/src/script/sign.cpp b/src/script/sign.cpp
index f9907f5e00..f1ac1f411a 100644
--- a/src/script/sign.cpp
+++ b/src/script/sign.cpp
@@ -614,3 +614,13 @@ void PSBTOutput::Merge(const PSBTOutput& output)
if (redeem_script.empty() && !output.redeem_script.empty()) redeem_script = output.redeem_script;
if (witness_script.empty() && !output.witness_script.empty()) witness_script = output.witness_script;
}
+
+bool PublicOnlySigningProvider::GetCScript(const CScriptID &scriptid, CScript& script) const
+{
+ return m_provider->GetCScript(scriptid, script);
+}
+
+bool PublicOnlySigningProvider::GetPubKey(const CKeyID &address, CPubKey& pubkey) const
+{
+ return m_provider->GetPubKey(address, pubkey);
+}
diff --git a/src/script/sign.h b/src/script/sign.h
index 9f0382e257..e3a6196b28 100644
--- a/src/script/sign.h
+++ b/src/script/sign.h
@@ -32,6 +32,17 @@ public:
extern const SigningProvider& DUMMY_SIGNING_PROVIDER;
+class PublicOnlySigningProvider : public SigningProvider
+{
+private:
+ const SigningProvider* m_provider;
+
+public:
+ PublicOnlySigningProvider(const SigningProvider* provider) : m_provider(provider) {}
+ bool GetCScript(const CScriptID &scriptid, CScript& script) const;
+ bool GetPubKey(const CKeyID &address, CPubKey& pubkey) const;
+};
+
/** Interface for signature creators. */
class BaseSignatureCreator {
public: