mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 15:20:24 +01:00
Add test_claim_on_remote_sizeable_push_msat
Contrary to sizeable push_msat on local commitment tx, the output go to a P2WPKH
This commit is contained in:
parent
1255885a80
commit
e22220d79f
1 changed files with 32 additions and 0 deletions
|
@ -7710,6 +7710,38 @@ mod tests {
|
||||||
check_spends!(spend_txn[0], node_txn[0].clone());
|
check_spends!(spend_txn[0], node_txn[0].clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_claim_on_remote_sizeable_push_msat() {
|
||||||
|
// Same test as precedent, just test on remote commitment tx, as per_commitment_point registration changes following you're funder/fundee and
|
||||||
|
// to_remote output is encumbered by a P2WPKH
|
||||||
|
|
||||||
|
let nodes = create_network(2);
|
||||||
|
|
||||||
|
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 100000, 99000000);
|
||||||
|
nodes[0].node.force_close_channel(&chan.2);
|
||||||
|
let events = nodes[0].node.get_and_clear_pending_msg_events();
|
||||||
|
match events[0] {
|
||||||
|
MessageSendEvent::BroadcastChannelUpdate { .. } => {},
|
||||||
|
_ => panic!("Unexpected event"),
|
||||||
|
}
|
||||||
|
let node_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap();
|
||||||
|
assert_eq!(node_txn.len(), 1);
|
||||||
|
check_spends!(node_txn[0], chan.3.clone());
|
||||||
|
assert_eq!(node_txn[0].output.len(), 2); // We can't force trimming of to_remote output as channel_reserve_satoshis block us to do so at channel opening
|
||||||
|
|
||||||
|
let header = BlockHeader { version: 0x20000000, prev_blockhash: Default::default(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
|
||||||
|
nodes[1].chain_monitor.block_connected_with_filtering(&Block { header, txdata: vec![node_txn[0].clone()] }, 0);
|
||||||
|
let events = nodes[1].node.get_and_clear_pending_msg_events();
|
||||||
|
match events[0] {
|
||||||
|
MessageSendEvent::BroadcastChannelUpdate { .. } => {},
|
||||||
|
_ => panic!("Unexpected event"),
|
||||||
|
}
|
||||||
|
let spend_txn = check_dynamic_output_p2wpkh!(nodes[1]);
|
||||||
|
assert_eq!(spend_txn.len(), 2);
|
||||||
|
assert_eq!(spend_txn[0], spend_txn[1]);
|
||||||
|
check_spends!(spend_txn[0], node_txn[0].clone());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_static_spendable_outputs_preimage_tx() {
|
fn test_static_spendable_outputs_preimage_tx() {
|
||||||
let nodes = create_network(2);
|
let nodes = create_network(2);
|
||||||
|
|
Loading…
Add table
Reference in a new issue