Skip to content
Bitcoin Roots

v30.3-roots.1 · Commit 24: [PATCH 24/68] feat(qt): add guarded private key sweep dialog

src/interfaces/wallet.h

Before: src/interfaces/wallet.h · After: src/interfaces/wallet.h

File metadata
index 6c37476363fca7230fb229ec4d6411104bf9ec53..da0d9eccd875900899e990c8f1287ccd4b3f1ab2 100644

Download original patch · Release notes

Diff rows 1–29 of 29. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.

src/interfaces/wallet.h CHANGED
@@ -57,6 +57,17 @@ struct WalletTxOut;
57
57
  struct WalletTxStatus;
58
58
  struct WalletMigrationResult;
59
59
 
60
+ //! Result of a transient-private-key sweep. The supplied key is never retained
61
+ //! by this interface or by the wallet.
62
+ struct WalletSweepResult {
63
+ CTransactionRef tx;
64
+ CAmount amount{0};
65
+ CAmount fee{0};
66
+ size_t inputs{0};
67
+ int64_t vsize{0};
68
+ bool broadcast{false};
69
+ };
70
+
60
71
  using WalletOrderForm = std::vector<std::pair<std::string, std::string>>;
61
72
  using WalletValueMap = std::map<std::string, std::string>;
62
73
 
@@ -106,6 +117,12 @@ public:
106
117
  //! Return whether wallet has private key.
107
118
  virtual bool isSpendable(const CTxDestination& dest) = 0;
108
119
 
120
+ //! Sweep one transient private key to a destination controlled by this wallet.
121
+ virtual util::Result<WalletSweepResult> sweepPrivateKey(const SecureString& private_key,
122
+ const CTxDestination& destination,
123
+ bool broadcast,
124
+ const std::optional<Txid>& expected_txid = std::nullopt) = 0;
125
+
109
126
  //! Add or update address.
110
127
  virtual bool setAddressBook(const CTxDestination& dest, const std::string& name, const std::optional<wallet::AddressPurpose>& purpose) = 0;
111
128