Skip to content
Bitcoin Roots

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