Page MenuHomePhabricator

Make `node::BroadcastTransaction` take `const NodeContext &`, remove unused `Config` param
ClosedPublic

Authored by tobias_ruck on Jun 4 2023, 18:52.

Details

Summary

This helps with broadcasting txs from Chronik, which only has a const NodeContext & and no const Config &. Broadcasting from Chronik becomes more important once SLP is added.

Currently BroadcastTransaction takes a mutable NodeContext &, however, the mutability is not required by any of the functions called on it. It also takes a const Config & param, but that is unused, so we remove it.

Making it const is still thread safe as BroadcastTransaction takes a LOCK(cs_main), and RelayTransaction (which isn't covered by that lock) has an internal per-node lock (see CNode::PushTxInventory and PeerManagerImpl::RelayTransaction).

Test Plan

ninja check-functional

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Tail of the build log:

wallet_encryption.py --descriptors        | ✓ Passed  | 5 s
wallet_groups.py                          | ✓ Passed  | 11 s
wallet_hd.py                              | ✓ Passed  | 5 s
wallet_hd.py --descriptors                | ✓ Passed  | 5 s
wallet_import_rescan.py                   | ✓ Passed  | 6 s
wallet_import_with_label.py               | ✓ Passed  | 1 s
wallet_importdescriptors.py               | ✓ Passed  | 3 s
wallet_importmulti.py                     | ✓ Passed  | 3 s
wallet_importprunedfunds.py               | ✓ Passed  | 2 s
wallet_importprunedfunds.py --descriptors | ✓ Passed  | 1 s
wallet_keypool.py                         | ✓ Passed  | 3 s
wallet_keypool_topup.py                   | ✓ Passed  | 3 s
wallet_keypool_topup.py --descriptors     | ✓ Passed  | 3 s
wallet_labels.py                          | ✓ Passed  | 2 s
wallet_labels.py --descriptors            | ✓ Passed  | 1 s
wallet_listreceivedby.py                  | ✓ Passed  | 5 s
wallet_listsinceblock.py                  | ✓ Passed  | 5 s
wallet_listsinceblock.py --descriptors    | ✓ Passed  | 3 s
wallet_listtransactions.py                | ✓ Passed  | 4 s
wallet_listtransactions.py --descriptors  | ✓ Passed  | 3 s
wallet_multiwallet.py                     | ✓ Passed  | 39 s
wallet_multiwallet.py --usecli            | ✓ Passed  | 9 s
wallet_reorgsrestore.py                   | ✓ Passed  | 3 s
wallet_resendwallettransactions.py        | ✓ Passed  | 2 s
wallet_send.py                            | ✓ Passed  | 6 s
wallet_startup.py                         | ✓ Passed  | 2 s
wallet_timelock.py                        | ✓ Passed  | 1 s
wallet_txn_clone.py                       | ✓ Passed  | 1 s
wallet_txn_clone.py --mineblock           | ✓ Passed  | 2 s
wallet_txn_doublespend.py                 | ✓ Passed  | 1 s
wallet_txn_doublespend.py --mineblock     | ✓ Passed  | 2 s
wallet_watchonly.py                       | ✓ Passed  | 1 s
wallet_watchonly.py --usecli              | ✓ Passed  | 1 s
chronik_avalanche.py                      | ○ Skipped | 0 s
chronik_block.py                          | ○ Skipped | 0 s
chronik_block_info.py                     | ○ Skipped | 0 s
chronik_block_txs.py                      | ○ Skipped | 0 s
chronik_blockchain_info.py                | ○ Skipped | 0 s
chronik_blocks.py                         | ○ Skipped | 0 s
chronik_disallow_prune.py                 | ○ Skipped | 0 s
chronik_raw_tx.py                         | ○ Skipped | 0 s
chronik_resync.py                         | ○ Skipped | 0 s
chronik_script_confirmed_txs.py           | ○ Skipped | 0 s
chronik_script_history.py                 | ○ Skipped | 0 s
chronik_script_unconfirmed_txs.py         | ○ Skipped | 0 s
chronik_script_utxos.py                   | ○ Skipped | 0 s
chronik_serve.py                          | ○ Skipped | 0 s
chronik_spent_by.py                       | ○ Skipped | 0 s
chronik_tx.py                             | ○ Skipped | 0 s
chronik_ws.py                             | ○ Skipped | 0 s
chronik_ws_script.py                      | ○ Skipped | 0 s
interface_usdt_net.py                     | ○ Skipped | 0 s
interface_usdt_utxocache.py               | ○ Skipped | 0 s
interface_usdt_validation.py              | ○ Skipped | 0 s

ALL                                       | ✓ Passed  | 1206 s (accumulated) 
Runtime: 242 s

ninja: build stopped: cannot make progress due to previous errors.
Build build-diff failed with exit code 1

also remove the unused Config parameter

tobias_ruck retitled this revision from Make `node::BroadcastTransaction` take `const NodeContext &` to Make `node::BroadcastTransaction` take `const NodeContext &`, remove unused `Config` param.Jun 4 2023, 19:23
tobias_ruck edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Jun 5 2023, 08:08