Branch data Line data Source code
1 : : // Copyright (c) 2021-present The Bitcoin Core developers
2 : : // Distributed under the MIT software license, see the accompanying
3 : : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 : :
5 : : #ifndef BITCOIN_WALLET_TRANSACTION_H
6 : : #define BITCOIN_WALLET_TRANSACTION_H
7 : :
8 : : #include <attributes.h>
9 : : #include <consensus/amount.h>
10 : : #include <primitives/transaction.h>
11 : : #include <tinyformat.h>
12 : : #include <uint256.h>
13 : : #include <util/check.h>
14 : : #include <util/overloaded.h>
15 : : #include <util/strencodings.h>
16 : : #include <util/string.h>
17 : : #include <wallet/types.h>
18 : :
19 : : #include <bitset>
20 : : #include <cstdint>
21 : : #include <map>
22 : : #include <utility>
23 : : #include <variant>
24 : : #include <vector>
25 : :
26 : : namespace interfaces {
27 : : class Chain;
28 : : } // namespace interfaces
29 : :
30 : : namespace wallet {
31 : : //! State of transaction confirmed in a block.
32 : : struct TxStateConfirmed {
33 : : uint256 confirmed_block_hash;
34 : : int confirmed_block_height;
35 : : int position_in_block;
36 : :
37 [ + - + - ]: 179522 : explicit TxStateConfirmed(const uint256& block_hash, int height, int index) : confirmed_block_hash(block_hash), confirmed_block_height(height), position_in_block(index) {}
[ + - # # ]
38 [ + - ]: 42608 : std::string toString() const { return strprintf("Confirmed (block=%s, height=%i, index=%i)", confirmed_block_hash.ToString(), confirmed_block_height, position_in_block); }
39 : : };
40 : :
41 : : //! State of transaction added to mempool.
42 : : struct TxStateInMempool {
43 : 3752 : std::string toString() const { return strprintf("InMempool"); }
44 : : };
45 : :
46 : : //! State of rejected transaction that conflicts with a confirmed block.
47 : : struct TxStateBlockConflicted {
48 : : uint256 conflicting_block_hash;
49 : : int conflicting_block_height;
50 : :
51 : 170 : explicit TxStateBlockConflicted(const uint256& block_hash, int height) : conflicting_block_hash(block_hash), conflicting_block_height(height) {}
52 [ # # ]: 0 : std::string toString() const { return strprintf("BlockConflicted (block=%s, height=%i)", conflicting_block_hash.ToString(), conflicting_block_height); }
53 : : };
54 : :
55 : : //! State of transaction not confirmed or conflicting with a known block and
56 : : //! not in the mempool. May conflict with the mempool, or with an unknown block,
57 : : //! or be abandoned, never broadcast, or rejected from the mempool for another
58 : : //! reason.
59 : : struct TxStateInactive {
60 : : bool abandoned;
61 : :
62 [ + + ][ + - : 131636 : explicit TxStateInactive(bool abandoned = false) : abandoned(abandoned) {}
+ - + - -
+ + - + -
- + ]
[ + - + - ]
63 : 2145 : std::string toString() const { return strprintf("Inactive (abandoned=%i)", abandoned); }
64 : : };
65 : :
66 : : //! State of transaction loaded in an unrecognized state with unexpected hash or
67 : : //! index values. Treated as inactive (with serialized hash and index values
68 : : //! preserved) by default, but may enter another state if transaction is added
69 : : //! to the mempool, or confirmed, or abandoned, or found conflicting.
70 : : struct TxStateUnrecognized {
71 : : uint256 block_hash;
72 : : int index;
73 : :
74 : 8775 : TxStateUnrecognized(const uint256& block_hash, int index) : block_hash(block_hash), index(index) {}
75 [ # # ]: 0 : std::string toString() const { return strprintf("Unrecognized (block=%s, index=%i)", block_hash.ToString(), index); }
76 : : };
77 : :
78 : : //! All possible CWalletTx states
79 : : using TxState = std::variant<TxStateConfirmed, TxStateInMempool, TxStateBlockConflicted, TxStateInactive, TxStateUnrecognized>;
80 : :
81 : : //! Subset of states transaction sync logic is implemented to handle.
82 : : using SyncTxState = std::variant<TxStateConfirmed, TxStateInMempool, TxStateInactive>;
83 : :
84 : : //! Try to interpret deserialized TxStateUnrecognized data as a recognized state.
85 : 8775 : static inline TxState TxStateInterpretSerialized(TxStateUnrecognized data)
86 : : {
87 [ + + ]: 8775 : if (data.block_hash == uint256::ZERO) {
88 [ + + ]: 84 : if (data.index == 0) return TxStateInactive{};
89 [ + + ]: 8691 : } else if (data.block_hash == uint256::ONE) {
90 [ + + ]: 125 : if (data.index == -1) return TxStateInactive{/*abandoned=*/true};
91 [ + + ]: 8566 : } else if (data.index >= 0) {
92 : 8504 : return TxStateConfirmed{data.block_hash, /*height=*/-1, data.index};
93 [ + + ]: 62 : } else if (data.index == -1) {
94 : 59 : return TxStateBlockConflicted{data.block_hash, /*height=*/-1};
95 : : }
96 : 11 : return data;
97 : : }
98 : :
99 : : //! Get TxState serialized block hash. Inverse of TxStateInterpretSerialized.
100 : 28483 : static inline uint256 TxStateSerializedBlockHash(const TxState& state)
101 : : {
102 [ + + ]: 28483 : return std::visit(util::Overloaded{
103 [ + + ]: 4905 : [](const TxStateInactive& inactive) { return inactive.abandoned ? uint256::ONE : uint256::ZERO; },
104 : 5427 : [](const TxStateInMempool& in_mempool) { return uint256::ZERO; },
105 : 23834 : [](const TxStateConfirmed& confirmed) { return confirmed.confirmed_block_hash; },
106 : 172 : [](const TxStateBlockConflicted& conflicted) { return conflicted.conflicting_block_hash; },
107 : 11 : [](const TxStateUnrecognized& unrecognized) { return unrecognized.block_hash; }
108 : : }, state);
109 : : }
110 : :
111 : : //! Get TxState serialized block index. Inverse of TxStateInterpretSerialized.
112 : 28483 : static inline int TxStateSerializedIndex(const TxState& state)
113 : : {
114 [ + + ]: 28483 : return std::visit(util::Overloaded{
115 [ + + ]: 3171 : [](const TxStateInactive& inactive) { return inactive.abandoned ? -1 : 0; },
116 : : [](const TxStateInMempool& in_mempool) { return 0; },
117 : 23834 : [](const TxStateConfirmed& confirmed) { return confirmed.position_in_block; },
118 : : [](const TxStateBlockConflicted& conflicted) { return -1; },
119 : 11 : [](const TxStateUnrecognized& unrecognized) { return unrecognized.index; }
120 : : }, state);
121 : : }
122 : :
123 : : //! Return TxState or SyncTxState as a string for logging or debugging.
124 : : template<typename T>
125 : 27201 : std::string TxStateString(const T& state)
126 : : {
127 : 27201 : return std::visit([](const auto& s) { return s.toString(); }, state);
128 : : }
129 : :
130 : : /**
131 : : * Cachable amount subdivided into avoid reuse and all balances
132 : : */
133 : : struct CachableAmount
134 : : {
135 : : std::optional<CAmount> m_avoid_reuse_value;
136 : : std::optional<CAmount> m_all_value;
137 : 122400 : inline void Reset()
138 : : {
139 : 244800 : m_avoid_reuse_value.reset();
140 [ + + + + ]: 122400 : m_all_value.reset();
141 : : }
142 : 1701 : void Set(bool avoid_reuse, CAmount value)
143 : : {
144 [ - + ]: 1701 : if (avoid_reuse) {
145 : 0 : m_avoid_reuse_value = value;
146 : : } else {
147 : 1701 : m_all_value = value;
148 : : }
149 : : }
150 : 3899 : CAmount Get(bool avoid_reuse)
151 : : {
152 [ - + ]: 3899 : if (avoid_reuse) {
153 [ # # ]: 0 : Assert(m_avoid_reuse_value.has_value());
154 : 0 : return m_avoid_reuse_value.value();
155 : : }
156 [ - + ]: 3899 : Assert(m_all_value.has_value());
157 : 3899 : return m_all_value.value();
158 : : }
159 : 3899 : bool IsCached(bool avoid_reuse)
160 : : {
161 [ - + ]: 3899 : if (avoid_reuse) return m_avoid_reuse_value.has_value();
162 : 3899 : return m_all_value.has_value();
163 : : }
164 : : };
165 : :
166 : :
167 : : /** Legacy class used for deserializing vtxPrev for backwards compatibility.
168 : : * vtxPrev was removed in commit 93a18a3650292afbb441a47d1fa1b94aeb0164e3,
169 : : * but old wallet.dat files may still contain vtxPrev vectors of CMerkleTxs.
170 : : * These need to get deserialized for field alignment when deserializing
171 : : * a CWalletTx, but the deserialized values are discarded.**/
172 : : class CMerkleTx
173 : : {
174 : : public:
175 : : template<typename Stream>
176 : 0 : void Unserialize(Stream& s)
177 : : {
178 : 0 : CTransactionRef tx;
179 : 0 : uint256 hashBlock;
180 [ # # ]: 0 : std::vector<uint256> vMerkleBranch;
181 : : int nIndex;
182 : :
183 [ # # # # : 0 : s >> TX_WITH_WITNESS(tx) >> hashBlock >> vMerkleBranch >> nIndex;
# # # # ]
184 [ # # ]: 0 : }
185 : : };
186 : :
187 : : /**
188 : : * A transaction with a bunch of additional info that only the owner cares about.
189 : : * It includes any unrecorded transactions needed to link it back to the block chain.
190 : : */
191 : : class CWalletTx
192 : : {
193 : : public:
194 : : // "from" and "message" are obsolete fields that could be set in
195 : : // the UI prior to 2011 (removed in commit 4d9b223)
196 : : // These fields are kept to avoid losing metadata.
197 : : std::optional<std::string> m_from;
198 : : std::optional<std::string> m_message;
199 : : // Comment strings provided by the user
200 : : std::optional<std::string> m_comment;
201 : : std::optional<std::string> m_comment_to;
202 : : std::optional<Txid> m_replaces_txid;
203 : : std::optional<Txid> m_replaced_by_txid;
204 : : // BIP 21 URI Messages
205 : : std::vector<std::string> m_messages;
206 : : // BIP 70 Payment Request (deprecated, field kept to preserve metadata from old wallets)
207 : : std::vector<std::string> m_payment_requests;
208 : : unsigned int nTimeReceived; //!< time received by this node
209 : : /**
210 : : * Stable timestamp that never changes, and reflects the order a transaction
211 : : * was added to the wallet. Timestamp is based on the block time for a
212 : : * transaction added as part of a block, or else the time when the
213 : : * transaction was received if it wasn't part of a block, with the timestamp
214 : : * adjusted in both cases so timestamp order matches the order transactions
215 : : * were added to the wallet. More details can be found in
216 : : * CWallet::ComputeTimeSmart().
217 : : */
218 : : unsigned int nTimeSmart;
219 : : // Cached value for whether the transaction spends any inputs known to the wallet
220 : : mutable std::optional<bool> m_cached_from_me{std::nullopt};
221 : : int64_t nOrderPos; //!< position in ordered transaction list
222 : : std::multimap<int64_t, CWalletTx*>::const_iterator m_it_wtxOrdered;
223 : :
224 : : // memory only
225 : : enum AmountType { DEBIT, CREDIT, AMOUNTTYPE_ENUM_ELEMENTS };
226 : : mutable CachableAmount m_amounts[AMOUNTTYPE_ENUM_ELEMENTS];
227 : : /**
228 : : * This flag is true if all m_amounts caches are empty. This is particularly
229 : : * useful in places where MarkDirty is conditionally called and the
230 : : * condition can be expensive and thus can be skipped if the flag is true.
231 : : * See MarkDestinationsDirty.
232 : : */
233 : : mutable bool m_is_cache_empty{true};
234 : : mutable bool fChangeCached;
235 : : mutable CAmount nChangeCached;
236 : :
237 [ - + ]: 143445 : CWalletTx(CTransactionRef tx, const TxState& state) : m_state(state)
238 : : {
239 [ - + ]: 143445 : Assert(tx);
240 [ + - ]: 143445 : m_canonical_wtxid = tx->GetWitnessHash();
241 [ + - ]: 143445 : m_txs.emplace(tx->GetWitnessHash(), std::move(tx));
242 : 143445 : Init();
243 : 0 : }
244 : :
245 : : template <typename Stream>
246 [ + - ]: 8750 : CWalletTx(deserialize_type, Stream& s, const std::map<Wtxid, CTransactionRef>& variants) : m_state(TxStateInactive{})
247 : : {
248 [ + - ]: 8750 : Unserialize(s);
249 : : // Merge witness variants
250 [ + - ]: 8750 : m_txs.insert(variants.begin(), variants.end());
251 [ + - - + ]: 8750 : Assert(m_txs.contains(GetWitnessHash()));
252 : 8750 : }
253 : :
254 : 152195 : void Init()
255 : : {
256 : 152195 : nTimeReceived = 0;
257 : 152195 : nTimeSmart = 0;
258 : 152195 : fChangeCached = false;
259 : 152195 : nChangeCached = 0;
260 : 143445 : nOrderPos = -1;
261 : : }
262 : :
263 : : TxState m_state;
264 : :
265 : : // Set of mempool transactions that conflict
266 : : // directly with the transaction, or that conflict
267 : : // with an ancestor transaction. This set will be
268 : : // empty if state is InMempool or Confirmed, but
269 : : // can be nonempty if state is Inactive or
270 : : // BlockConflicted.
271 : : std::set<Txid> mempool_conflicts;
272 : :
273 : : // Track v3 mempool tx that spends from this tx
274 : : // so that we don't try to create another unconfirmed child
275 : : std::optional<Txid> truc_child_in_mempool;
276 : :
277 : : template<typename Stream>
278 [ - + ]: 24326 : void Serialize(Stream& s) const
279 : : {
280 : 24326 : std::map<std::string, std::string> string_values;
281 [ - + - - : 24326 : if (m_from) string_values["from"] = *m_from;
- - - - ]
282 [ - + - - : 24326 : if (m_message) string_values["message"] = *m_message;
- - - - ]
283 [ + + + - : 24333 : if (m_comment) string_values["comment"] = *m_comment;
+ - + - ]
284 [ + + + - : 24331 : if (m_comment_to) string_values["to"] = *m_comment_to;
+ - + - ]
285 [ + + + - : 24326 : if (m_replaces_txid) string_values["replaces_txid"] = m_replaces_txid->ToString();
+ - + - ]
286 [ + + + - : 24326 : if (m_replaced_by_txid) string_values["replaced_by_txid"] = m_replaced_by_txid->ToString();
+ - + - ]
287 [ + - + - : 24326 : string_values["fromaccount"] = "";
+ - ]
288 [ + - + - : 24326 : if (nOrderPos != -1) string_values["n"] = util::ToString(nOrderPos);
+ - + - ]
289 [ + - + - : 24326 : if (nTimeSmart) string_values["timesmart"] = strprintf("%u", nTimeSmart);
+ - + - ]
290 : :
291 : 24326 : std::vector<std::pair<std::string, std::string>> msgs_reqs;
292 [ - + - + : 24326 : msgs_reqs.reserve(m_messages.size() + m_payment_requests.size());
+ - ]
293 [ - + ]: 24326 : for (const std::string& msg : m_messages) {
294 [ # # ]: 0 : msgs_reqs.emplace_back("Message", msg);
295 : : }
296 [ - + ]: 24326 : for (const std::string& req : m_payment_requests) {
297 [ # # ]: 0 : msgs_reqs.emplace_back("PaymentRequest", req);
298 : : }
299 : :
300 : 24326 : std::vector<uint8_t> dummy_vector1; // Used to be vMerkleBranch
301 : 24326 : std::vector<uint8_t> dummy_vector2; // Used to be vtxPrev
302 : 24326 : bool dummy_bool = false; // Used to be fFromMe, and fSpent
303 : 24326 : uint32_t dummy_int = 0; // Used to be fTimeReceivedIsTxTime
304 [ + - ]: 24326 : uint256 serializedHash = TxStateSerializedBlockHash(m_state);
305 : 24326 : int serializedIndex = TxStateSerializedIndex(m_state);
306 [ + - + - : 72978 : s << TX_WITH_WITNESS(GetTx()) << serializedHash << dummy_vector1 << serializedIndex << dummy_vector2 << string_values << msgs_reqs << dummy_int << nTimeReceived << dummy_bool << dummy_bool;
+ - + - +
- + - + -
+ - + - +
- + - + -
+ - ]
307 : 24326 : }
308 : :
309 : : template<typename Stream>
310 : 8750 : void Unserialize(Stream& s)
311 : : {
312 : 8750 : Init();
313 : :
314 : 8750 : std::vector<uint256> dummy_vector1; // Used to be vMerkleBranch
315 : 8750 : std::vector<CMerkleTx> dummy_vector2; // Used to be vtxPrev
316 : : bool dummy_bool; // Used to be fFromMe, and fSpent
317 : : uint32_t dummy_int; // Used to be fTimeReceivedIsTxTime
318 [ + - ]: 8750 : uint256 serialized_block_hash;
319 : : int serializedIndex;
320 : 8750 : std::map<std::string, std::string> string_values;
321 : 8750 : std::vector<std::pair<std::string, std::string>> msgs_reqs;
322 [ + - ]: 8750 : CTransactionRef canonical_tx;
323 [ + - + - : 17500 : s >> TX_WITH_WITNESS(canonical_tx) >> serialized_block_hash >> dummy_vector1 >> serializedIndex >> dummy_vector2 >> string_values >> msgs_reqs >> dummy_int >> nTimeReceived >> dummy_bool >> dummy_bool;
+ - + - +
- + - + -
+ - + - +
- + - +
- ]
324 : 8750 : m_canonical_wtxid = canonical_tx->GetWitnessHash();
325 [ + - ]: 8750 : m_txs.emplace(m_canonical_wtxid, std::move(canonical_tx));
326 : :
327 : 8750 : m_state = TxStateInterpretSerialized({serialized_block_hash, serializedIndex});
328 : :
329 [ + - ]: 17500 : string_values.erase("fromaccount");
330 [ + - ]: 17500 : string_values.erase("spent");
331 [ + + + + ]: 26356 : for (const auto& [key, value] : string_values) {
332 [ + + + - ]: 26356 : if (key == "n") nOrderPos = LocaleIndependentAtoi<int64_t>(value);
333 [ + + + - ]: 17606 : else if (key == "timesmart") nTimeSmart = LocaleIndependentAtoi<int64_t>(value);
334 [ - + - - ]: 106 : else if (key == "from") m_from = value;
335 [ - + - - ]: 106 : else if (key == "message") m_message = value;
336 [ + + + - ]: 106 : else if (key == "comment") m_comment = value;
337 [ + + + - ]: 98 : else if (key == "to") m_comment_to = value;
338 [ + + + - ]: 141 : else if (key == "replaces_txid") m_replaces_txid = Txid::FromHex(value);
339 [ + - + - ]: 94 : else if (key == "replaced_by_txid") m_replaced_by_txid = Txid::FromHex(value);
340 : : else {
341 [ # # ]: 0 : throw std::runtime_error("Unexpected value in CWalletTx strings value map");
342 : : }
343 : : }
344 : :
345 [ - - - + ]: 8750 : for (const auto& [type, data] : msgs_reqs) {
346 [ # # # # ]: 0 : if (type == "Message") m_messages.emplace_back(data);
347 [ # # # # ]: 0 : else if (type == "PaymentRequest") m_payment_requests.emplace_back(data);
348 : : else {
349 [ # # ]: 0 : throw std::runtime_error("Unknown type in CWalletTx messages and requests vector");
350 : : }
351 : : }
352 : 8750 : }
353 : :
354 [ + - ]: 2896242 : CTransactionRef GetTx() const { return m_txs.at(m_canonical_wtxid); }
355 : :
356 : : // Update the state of this wallet transaction along with a transaction that may have a different wtxid.
357 : : // If the given transaction has a different wtxid, the transaction is stored if it has not been seen before.
358 : : // The canonical wtxid is also updated. The tx that is confirmed becomes canonical. For unconfirmed txs,
359 : : // those with witnesses are preferred, followed by least weight.
360 : : bool Update(CTransactionRef tx, const TxState& arg_state);
361 : :
362 : : //! make sure balances are recalculated
363 : 61200 : void MarkDirty()
364 : : {
365 [ - + ]: 61200 : m_amounts[DEBIT].Reset();
366 [ - + ]: 61200 : m_amounts[CREDIT].Reset();
367 : 61200 : fChangeCached = false;
368 : 61200 : m_is_cache_empty = true;
369 [ + + ]: 61200 : m_cached_from_me = std::nullopt;
370 : 61200 : }
371 : :
372 : : /** True if only scriptSigs are different */
373 : : bool IsEquivalentTo(const CWalletTx& tx) const;
374 : :
375 : : bool InMempool() const;
376 : :
377 : : int64_t GetTxTime() const;
378 : :
379 [ # # # # ]: 2743134 : template<typename T> const T* state() const { return std::get_if<T>(&m_state); }
[ + + # # ]
[ + + + +
- + - + +
+ - + + +
+ + + - ]
380 [ + + + + : 40000 : template<typename T> T* state() { return std::get_if<T>(&m_state); }
+ + + + +
+ ][ + + +
+ + + + -
+ - + + -
+ ]
381 : :
382 : : //! Update transaction state when attaching to a chain, filling in heights
383 : : //! of conflicted and confirmed blocks
384 : : void updateState(interfaces::Chain& chain);
385 : :
386 [ # # # # : 298255 : bool isAbandoned() const { return state<TxStateInactive>() && state<TxStateInactive>()->abandoned; }
# # # # #
# # # # #
# # # # #
# # # #
# ][ + + +
- + - + +
+ - - - -
- - - - -
+ + + + +
+ + + + +
+ + + + ]
[ + + + +
+ - + + +
+ + - + +
+ + + - +
+ + + + -
# # # # #
# # # ]
387 [ + + + + ]: 287430 : bool isMempoolConflicted() const { return !mempool_conflicts.empty(); }
388 [ + - + + : 367724 : bool isBlockConflicted() const { return state<TxStateBlockConflicted>(); }
+ - + + +
- + - + +
+ + + + +
+ ][ + + +
+ # # # #
# # # # #
# # # # #
# # ]
389 [ + + ][ + + : 36473 : bool isInactive() const { return state<TxStateInactive>(); }
+ - + - ]
390 [ + + + + : 16508 : bool isUnconfirmed() const { return !isAbandoned() && !isBlockConflicted() && !isMempoolConflicted() && !isConfirmed(); }
+ + ]
391 [ # # # # : 644050 : bool isConfirmed() const { return state<TxStateConfirmed>(); }
# # # # #
# ]
[ + + + + ]
[ + - + +
+ + ][ + +
+ + + + +
+ + + ]
392 [ + - ]: 1000851 : const Txid& GetHash() const LIFETIMEBOUND { return GetTx()->GetHash(); }
393 [ + - ]: 15178 : const Wtxid& GetWitnessHash() const LIFETIMEBOUND { return GetTx()->GetWitnessHash(); }
394 [ + - ]: 787940 : bool IsCoinBase() const { return GetTx()->IsCoinBase(); }
395 : :
396 [ + - ]: 27532 : const std::map<Wtxid, CTransactionRef>& GetTxs() const { return m_txs; }
397 : :
398 : : // Disable copying of CWalletTx objects to prevent bugs where instances get
399 : : // copied in and out of the mapWallet map, and fields are updated in the
400 : : // wrong copy.
401 : : CWalletTx(const CWalletTx&) = delete;
402 : : CWalletTx& operator=(const CWalletTx&) = delete;
403 : :
404 : : // Enable the default move constructor
405 [ + + ]: 26250 : CWalletTx(CWalletTx&&) = default;
406 : :
407 : : private:
408 : : Wtxid m_canonical_wtxid;
409 : : std::map<Wtxid, CTransactionRef> m_txs;
410 : :
411 : : //! Set m_canonical_wtxid to the best variant under the unconfirmed rule
412 : : //! (witnessed preferred, then least weight). Ignores state.
413 : : void RecomputeCanonical();
414 : : };
415 : :
416 : : struct WalletTxOrderComparator {
417 : 279 : bool operator()(const CWalletTx* a, const CWalletTx* b) const
418 : : {
419 [ + + + + : 279 : return a->nOrderPos < b->nOrderPos;
+ - ]
420 : : }
421 : : };
422 : :
423 : : class WalletTXO
424 : : {
425 : : private:
426 : : const CWalletTx& m_wtx;
427 : : const CTxOut& m_output;
428 : :
429 : : public:
430 : 43994 : WalletTXO(const CWalletTx& wtx, const CTxOut& output)
431 : 43994 : : m_wtx(wtx),
432 : 43994 : m_output(output)
433 : : {
434 [ + - + - : 87988 : Assume(std::ranges::find(wtx.GetTx()->vout, output) != wtx.GetTx()->vout.end());
+ - ]
435 : 43994 : }
436 : :
437 [ + - # # ]: 777800 : const CWalletTx& GetWalletTx() const { return m_wtx; }
[ + - + - ]
438 : :
439 [ + - + - : 729040 : const CTxOut& GetTxOut() const { return m_output; }
+ + ]
440 : : };
441 : : } // namespace wallet
442 : :
443 : : #endif // BITCOIN_WALLET_TRANSACTION_H
|