Skip to content
Bitcoin Roots

v29.4-roots.3 · Commit 23: [PATCH 23/30] feat(wallet): add transient private-key sweep RPC

src/rpc/blockchain.h

Before: src/rpc/blockchain.h · After: src/rpc/blockchain.h

File metadata
index 954ede6519b4c7f7f85ba4d3462538581431dedb..7bb178a247694325ca712f7c217dbc0c77638667 100644

Download original patch · Release notes

Diff rows 1–50 of 50. 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/rpc/blockchain.h CHANGED
@@ -7,14 +7,22 @@
7
7
 
8
8
  #include <consensus/amount.h>
9
9
  #include <core_io.h>
10
+ #include <interfaces/chain.h>
10
11
  #include <streams.h>
11
12
  #include <sync.h>
12
13
  #include <util/fs.h>
13
14
  #include <validation.h>
14
15
 
16
+ #include <coins.h>
17
+ #include <script/script.h>
18
+
15
19
  #include <any>
20
+ #include <atomic>
21
+ #include <functional>
16
22
  #include <stdint.h>
17
23
  #include <vector>
24
+ #include <map>
25
+ #include <set>
18
26
 
19
27
  class CBlock;
20
28
  class CBlockIndex;
@@ -25,6 +33,19 @@ class BlockManager;
25
33
  struct NodeContext;
26
34
  } // namespace node
27
35
 
36
+ namespace rpc::scan {
37
+ extern std::atomic<int> g_progress;
38
+ extern std::atomic<bool> g_in_progress;
39
+ extern std::atomic<bool> g_should_abort;
40
+ class Reserver {
41
+ bool m_reserved{false};
42
+ public:
43
+ bool reserve();
44
+ ~Reserver();
45
+ };
46
+ bool CheckInterruption(int64_t count, const std::function<void()>& interruption);
47
+ } // namespace rpc::scan
48
+
28
49
  static constexpr int NUM_GETBLOCKSTATS_PERCENTILES = 5;
29
50
 
30
51
  /**
@@ -59,4 +80,9 @@ UniValue CreateUTXOSnapshot(
59
80
  std::optional<int> GetPruneHeight(const node::BlockManager& blockman, const CChain& chain) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
60
81
  void CheckBlockDataAvailability(node::BlockManager& blockman, const CBlockIndex& blockindex, bool check_for_undo) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
61
82
 
83
+ //! Scan the current UTXO set while sharing scantxoutset's reservation and RPC
84
+ //! interruption behavior. The returned coins are a snapshot and must be
85
+ //! revalidated by the caller before broadcast.
86
+ interfaces::ScanResult ScanUTXOSet(node::NodeContext& node, const std::set<CScript>& needles, std::map<COutPoint, Coin>& coins);
87
+
62
88
  #endif // BITCOIN_RPC_BLOCKCHAIN_H