2023-08-16 19:27:31 +02:00
|
|
|
// Copyright (c) 2017-2020 The Bitcoin Core developers
|
2019-01-09 07:16:50 +01:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#ifndef BITCOIN_NODE_TRANSACTION_H
|
|
|
|
#define BITCOIN_NODE_TRANSACTION_H
|
|
|
|
|
2019-02-22 17:09:44 +01:00
|
|
|
#include <attributes.h>
|
2019-01-09 07:16:50 +01:00
|
|
|
#include <primitives/transaction.h>
|
2021-11-16 16:19:47 +01:00
|
|
|
#include <util/error.h>
|
2019-01-30 06:32:38 +01:00
|
|
|
|
2022-04-05 11:09:41 +02:00
|
|
|
struct NodeContext;
|
|
|
|
|
2019-01-30 06:32:38 +01:00
|
|
|
/**
|
2021-12-12 18:06:50 +01:00
|
|
|
* Submit a transaction to the mempool and (optionally) relay it to all P2P peers.
|
|
|
|
*
|
|
|
|
* Mempool submission can be synchronous (will await mempool entry notification
|
|
|
|
* over the CValidationInterface) or asynchronous (will submit and not wait for
|
|
|
|
* notification), depending on the value of wait_callback. wait_callback MUST
|
|
|
|
* NOT be set while cs_main, cs_mempool or cs_wallet are held to avoid
|
|
|
|
* deadlock.
|
2019-01-30 06:32:38 +01:00
|
|
|
*
|
2022-04-05 11:09:41 +02:00
|
|
|
* @param[in] node reference to node context
|
2019-01-30 06:32:38 +01:00
|
|
|
* @param[in] tx the transaction to broadcast
|
2020-01-20 20:35:12 +01:00
|
|
|
* @param[out] err_string reference to std::string to fill with error string if available
|
2021-12-12 18:06:50 +01:00
|
|
|
* @param[in] max_tx_fee reject txs with fees higher than this (if 0, accept any fee)
|
|
|
|
* @param[in] relay flag if both mempool insertion and p2p relay are requested
|
2020-01-20 20:35:12 +01:00
|
|
|
* @param[in] wait_callback wait until callbacks have been processed to avoid stale result due to a sequentially RPC.
|
2019-02-22 17:09:44 +01:00
|
|
|
* return error
|
2019-01-30 06:32:38 +01:00
|
|
|
*/
|
2022-04-05 11:09:41 +02:00
|
|
|
[[nodiscard]] TransactionError BroadcastTransaction(NodeContext& node, CTransactionRef tx, std::string& err_string, const CAmount& highfee, bool relay, bool wait_callback, bool bypass_limits = false);
|
2019-01-09 07:16:50 +01:00
|
|
|
|
|
|
|
#endif // BITCOIN_NODE_TRANSACTION_H
|