Skip to content

Commit e4e9cac

Browse files
authored
Merge pull request #712 from chenyukang/yukang-too-large-feerate
Add a unit test for large shutdown feerate
2 parents 062bc5a + 2de51b3 commit e4e9cac

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

crates/fiber-lib/src/fiber/tests/channel.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4692,7 +4692,7 @@ async fn test_shutdown_channel_with_large_size_shutdown_script_should_fail() {
46924692
let node_a_funding_amount = 100000000000;
46934693
let node_b_funding_amount = 6200000000;
46944694

4695-
let (_node_a, node_b, new_channel_id) =
4695+
let (node_a, node_b, new_channel_id) =
46964696
create_nodes_with_established_channel(node_a_funding_amount, node_b_funding_amount, false)
46974697
.await;
46984698

@@ -4717,6 +4717,28 @@ async fn test_shutdown_channel_with_large_size_shutdown_script_should_fail() {
47174717
.err()
47184718
.unwrap()
47194719
.contains("Local balance is not enough to pay the fee"));
4720+
4721+
let message = |rpc_reply| {
4722+
NetworkActorMessage::Command(NetworkActorCommand::ControlFiberChannel(
4723+
ChannelCommandWithId {
4724+
channel_id: new_channel_id,
4725+
command: ChannelCommand::Shutdown(
4726+
ShutdownCommand {
4727+
close_script: Script::new_builder().args([0u8; 21].pack()).build(),
4728+
fee_rate: FeeRate::from_u64(u64::MAX),
4729+
force: false,
4730+
},
4731+
rpc_reply,
4732+
),
4733+
},
4734+
))
4735+
};
4736+
4737+
let shutdown_channel_result = call!(node_a.network_actor, message).expect("node_b alive");
4738+
assert!(shutdown_channel_result
4739+
.err()
4740+
.unwrap()
4741+
.contains("Local balance is not enough to pay the fee"));
47204742
}
47214743

47224744
#[tokio::test]

0 commit comments

Comments
 (0)