Module functional_test_utils

Expand description

A bunch of useful utilities for building networks of nodes and exchanging messages between nodes for functional tests.

Structs§

Node
NodeCfg
NodePtr
If we need an unsafe pointer to a Node (ie to reference it in a thread pre-std::thread::scope), this provides that with Sync. Note that accessing some of the fields in the Node are not safe to use (i.e. the ones behind an Rc), but that’s left to the caller to figure out.
PaymentFailedConditions
ReconnectArgs
SendEvent
TestChanMonCfg

Enums§

ConnectStyle
The possible ways we may notify a ChannelManager of a new block
HTLCType

Constants§

ACCEPTED_HTLC_SCRIPT_WEIGHT
ACCEPTED_HTLC_SCRIPT_WEIGHT_ANCHORS
CHAN_CONFIRM_DEPTH
TEST_FINAL_CLTV

Traits§

NodeHolder

Functions§

_reload_node
check_added_monitors
Check whether N channel monitor(s) have been added.
check_claimed_htlc_channel
Checks whether the claimed HTLC for the specified path has the correct channel information.
check_closed_broadcast
Check that a channel’s closing channel update has been broadcasted, and optionally check whether an error message event has occurred.
check_closed_event
Check that a channel’s closing channel events has been issued
check_payment_claimable
check_preimage_claim
claim_payment
claim_payment_along_route
close_channel
commitment_signed_dance_through_cp_raa
Runs the commitment_signed dance after the initial commitment_signed is delivered through to the initiator’s revoke_and_ack response. i.e. do_main_commitment_signed_dance plus the revoke_and_ack response to it.
confirm_transaction
Mine the given transaction in the next block and then mine CHAN_CONFIRM_DEPTH - 1 blocks on top, giving the given transaction CHAN_CONFIRM_DEPTH confirmations.
confirm_transaction_at
confirm_transactions_at
Mine the given transaction at the given height, mining blocks as required to build to that height
connect_block
connect_blocks
create_announced_chan_between_nodes
create_announced_chan_between_nodes_with_value
create_batch_channel_funding
Initiates channel opening and creates a single batch funding transaction. This will go through the open_channel / accept_channel flow, and return the batch funding transaction with corresponding funding_created messages.
create_chan_between_nodes
create_chan_between_nodes_with_value
create_chan_between_nodes_with_value_a
create_chan_between_nodes_with_value_b
create_chan_between_nodes_with_value_confirm
create_chan_between_nodes_with_value_confirm_first
create_chan_between_nodes_with_value_confirm_second
create_chan_between_nodes_with_value_init
create_chanmon_cfgs
create_coinbase_funding_transaction
create_dummy_block
create_dummy_header
create_funding_transaction
create_network
create_node_cfgs
create_node_cfgs_with_persisters
create_node_chanmgrs
create_unannounced_chan_between_nodes_with_value
disconnect_all_blocks
disconnect_blocks
do_check_spends
do_claim_payment_along_route
do_claim_payment_along_route_with_extra_penultimate_hop_fees
do_commitment_signed_dance
Runs a full commitment_signed dance, delivering a commitment_signed, the responding revoke_and_ack and commitment_signed, and then the final revoke_and_ack response.
do_main_commitment_signed_dance
Does the main logic in the commitment_signed dance. After the first commitment_signed has been delivered, this method picks up and delivers the response revoke_and_ack and commitment_signed, returning the recipient’s revoke_and_ack and any extra message it may have included.
do_pass_along_path
expect_channel_pending_event
expect_channel_ready_event
expect_payment_failed_conditions
expect_payment_failed_conditions_event
expect_payment_forwarded
expect_payment_sent
expect_pending_htlcs_forwardable_conditions
Checks that an Event::PendingHTLCsForwardable is available in the given events and, if there are any Event::HTLCHandlingFailed events their HTLCDestination is included in the expected_failures set.
fail_payment
fail_payment_along_route
get_announce_close_broadcast_events
get_err_msg
Get an error message from the pending events queue.
get_htlc_update_msgs
Gets an UpdateHTLCs MessageSendEvent
get_payment_preimage_hash
Get a payment preimage and hash.
get_revoke_commit_msgs
Gets an RAA and CS which were sent in response to a commitment update
get_route
Gets a route from the given sender to the node described in payment_params.
handle_announce_close_broadcast_events
handle_bump_htlc_event
mine_transaction
Mine a single block containing the given transaction
mine_transaction_without_consistency_checks
Mine a single block containing the given transaction without extra consistency checks which may impact ChannelManager state.
mine_transactions
Mine a single block containing the given transactions
open_zero_conf_channel
pass_along_path
pass_along_route
pass_claimed_payment_along_route
pass_failed_payment_back
reconnect_nodes
pending_htlc_adds includes both the holding cell and in-flight update_add_htlcs, whereas for claims/fails they are separated out.
remove_first_msg_event_to_node
Fetches the first msg_event to the passed node_id in the passed msg_events vec. Returns the msg_event.
route_over_limit
route_payment
send_along_route
send_along_route_with_secret
send_payment
sign_funding_transaction
test_default_channel_config
test_revoked_htlc_claim_txn_broadcast
Tests that the given node has broadcast a claim transaction against the provided revoked HTLC transaction.
test_txn_broadcast
Tests that the given node has broadcast transactions for the given Channel
update_nodes_with_chan_announce