diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-07-22 15:01:14 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-07-22 15:53:17 +0200 |
commit | abc57e1f0882a1a2bb20474648419979af6e383d (patch) | |
tree | 384f1b226cc930327681f235c14a28bc67adb4fa /src/node/transaction.h | |
parent | 78f4c8b98eada337346ffb206339c3ebae4ff43b (diff) | |
download | bitcoin-abc57e1f0882a1a2bb20474648419979af6e383d.tar.xz |
refactor: move `GetTransaction(...)` to node/transaction.cpp
can be reviewed with --color-moved
Diffstat (limited to 'src/node/transaction.h')
-rw-r--r-- | src/node/transaction.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/node/transaction.h b/src/node/transaction.h index 0c016ff04e..aed519cf7f 100644 --- a/src/node/transaction.h +++ b/src/node/transaction.h @@ -10,7 +10,12 @@ #include <primitives/transaction.h> #include <util/error.h> +class CBlockIndex; +class CTxMemPool; struct NodeContext; +namespace Consensus { +struct Params; +} /** Maximum fee rate for sendrawtransaction and testmempoolaccept RPC calls. * Also used by the GUI when broadcasting a completed PSBT. @@ -38,4 +43,19 @@ static const CFeeRate DEFAULT_MAX_RAW_TX_FEE_RATE{COIN / 10}; */ [[nodiscard]] TransactionError BroadcastTransaction(NodeContext& node, CTransactionRef tx, std::string& err_string, const CAmount& max_tx_fee, bool relay, bool wait_callback); +/** + * Return transaction with a given hash. + * If mempool is provided and block_index is not provided, check it first for the tx. + * If -txindex is available, check it next for the tx. + * Finally, if block_index is provided, check for tx by reading entire block from disk. + * + * @param[in] block_index The block to read from disk, or nullptr + * @param[in] mempool If provided, check mempool for tx + * @param[in] hash The txid + * @param[in] consensusParams The params + * @param[out] hashBlock The block hash, if the tx was found via -txindex or block_index + * @returns The tx if found, otherwise nullptr + */ +CTransactionRef GetTransaction(const CBlockIndex* const block_index, const CTxMemPool* const mempool, const uint256& hash, const Consensus::Params& consensusParams, uint256& hashBlock); + #endif // BITCOIN_NODE_TRANSACTION_H |