aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
authorSamuel Dobson <dobsonsa68@gmail.com>2019-11-23 08:43:54 +1300
committerSamuel Dobson <dobsonsa68@gmail.com>2019-11-23 09:22:02 +1300
commit0aa72061e5d651373449bdfa8d9463dcfe7b1ad4 (patch)
tree3f952f22302eb76eaafafc4acfef0341ca61d807 /src/interfaces
parent8aac85d71e218783bc7ce06e5bf8bc660e24079d (diff)
parentc6dd565c8820aa8a98b190621e10c6e2821a9ecc (diff)
downloadbitcoin-0aa72061e5d651373449bdfa8d9463dcfe7b1ad4.tar.xz
Merge #16944: gui: create PSBT with watch-only wallet
c6dd565c8820aa8a98b190621e10c6e2821a9ecc [gui] watch-only wallet: copy PSBT to clipboard (Sjors Provoost) 39465d545d521e66bb3accfa788aa94bffaf47eb [wallet] add fillPSBT to interface (Sjors Provoost) 848f88920853724511387ca0b7ef652fa14ced71 [gui] send: include watch-only (Sjors Provoost) 40537f090907f81ba885edb7dff1558382976912 [wallet] ListCoins: include watch-only for wallets without private keys (Sjors Provoost) Pull request description: For wallets with `WALLET_FLAG_DISABLE_PRIVATE_KEYS` this makes the watch-only balance available on the send screen (including coin selection). Instead of sending a transaction it generates a PSBT. The user can take this PSBT and process it with [HWI](https://github.com/bitcoin-core/HWI) or put it an SD card for hardware wallets that support that. The PSBT is copied to the clipboard. This was the easiest approach; we can add a dialog later to display it, as well as an option to save to disk. ACKs for top commit: instagibbs: test and code review ACK https://github.com/bitcoin/bitcoin/pull/16944/commits/c6dd565c8820aa8a98b190621e10c6e2821a9ecc meshcollider: re-ACK c6dd565c8820aa8a98b190621e10c6e2821a9ecc Tree-SHA512: ebc3da0737e33b255ed926191b84569aedb6097d14868662bd5dce726ce3048e86e9a31eba987b10dffe1482b35c21ae1cd595c2caa4634bc4cf78a826a83852
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/wallet.cpp11
-rw-r--r--src/interfaces/wallet.h8
2 files changed, 18 insertions, 1 deletions
diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp
index 079df17431..94c6e8c7b7 100644
--- a/src/interfaces/wallet.cpp
+++ b/src/interfaces/wallet.cpp
@@ -18,8 +18,9 @@
#include <wallet/feebumper.h>
#include <wallet/fees.h>
#include <wallet/ismine.h>
-#include <wallet/rpcwallet.h>
#include <wallet/load.h>
+#include <wallet/psbtwallet.h>
+#include <wallet/rpcwallet.h>
#include <wallet/wallet.h>
#include <memory>
@@ -357,6 +358,14 @@ public:
}
return {};
}
+ TransactionError fillPSBT(PartiallySignedTransaction& psbtx,
+ bool& complete,
+ int sighash_type = 1 /* SIGHASH_ALL */,
+ bool sign = true,
+ bool bip32derivs = false) override
+ {
+ return FillPSBT(m_wallet.get(), psbtx, complete, sighash_type, sign, bip32derivs);
+ }
WalletBalances getBalances() override
{
const auto bal = m_wallet->GetBalance();
diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h
index b7cf9f2111..8d2b8a2eca 100644
--- a/src/interfaces/wallet.h
+++ b/src/interfaces/wallet.h
@@ -14,6 +14,7 @@
#include <functional>
#include <map>
#include <memory>
+#include <psbt.h>
#include <stdint.h>
#include <string>
#include <tuple>
@@ -194,6 +195,13 @@ public:
bool& in_mempool,
int& num_blocks) = 0;
+ //! Fill PSBT.
+ virtual TransactionError fillPSBT(PartiallySignedTransaction& psbtx,
+ bool& complete,
+ int sighash_type = 1 /* SIGHASH_ALL */,
+ bool sign = true,
+ bool bip32derivs = false) = 0;
+
//! Get balances.
virtual WalletBalances getBalances() = 0;