Skip to content

Commit 263d8b5

Browse files
committed
Remove some useless tests in functional_tests and reject huge chans
In general we shouldn't have tests lying around that are useless as its not genuinely testing anything and may break due to harmless protocol changes. Here, we drop a few useless tests.
1 parent dbc3a4e commit 263d8b5

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

lightning/src/ln/functional_tests.rs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4666,27 +4666,15 @@ pub fn bolt2_open_channel_sending_node_checks_part2() {
46664666

46674667
let node_b_id = nodes[1].node.get_our_node_id();
46684668

4669-
// BOLT #2 spec: Sending node must set funding_satoshis to less than 2^24 satoshis
4670-
let channel_value_satoshis=2^24;
4671-
let push_msat=10001;
4672-
assert!(nodes[0].node.create_channel(node_b_id, channel_value_satoshis, push_msat, 42, None, None).is_err());
4673-
46744669
// BOLT #2 spec: Sending node must set push_msat to equal or less than 1000 * funding_satoshis
46754670
let channel_value_satoshis=10000;
46764671
// Test when push_msat is equal to 1000 * funding_satoshis.
46774672
let push_msat=1000*channel_value_satoshis+1;
46784673
assert!(nodes[0].node.create_channel(node_b_id, channel_value_satoshis, push_msat, 42, None, None).is_err());
46794674

4680-
// BOLT #2 spec: Sending node must set set channel_reserve_satoshis greater than or equal to dust_limit_satoshis
4681-
let channel_value_satoshis=10000;
4682-
let push_msat=10001;
4683-
assert!(nodes[0].node.create_channel(node_b_id, channel_value_satoshis, push_msat, 42, None, None).is_ok()); //Create a valid channel
4684-
let node0_to_1_send_open_channel = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel, node_b_id);
4685-
assert!(node0_to_1_send_open_channel.channel_reserve_satoshis>=node0_to_1_send_open_channel.common_fields.dust_limit_satoshis);
4675+
nodes[0].node.create_channel(node_b_id, 100_000, 0, 42, None, None).unwrap();
46864676

4687-
// BOLT #2 spec: Sending node must set undefined bits in channel_flags to 0
4688-
// Only the least-significant bit of channel_flags is currently defined resulting in channel_flags only having one of two possible states 0 or 1
4689-
assert!(node0_to_1_send_open_channel.common_fields.channel_flags<=1);
4677+
let node0_to_1_send_open_channel = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel, node_b_id);
46904678

46914679
// BOLT #2 spec: Sending node should set to_self_delay sufficient to ensure the sender can irreversibly spend a commitment transaction output, in case of misbehaviour by the receiver.
46924680
assert!(BREAKDOWN_TIMEOUT>0);
@@ -4695,13 +4683,6 @@ pub fn bolt2_open_channel_sending_node_checks_part2() {
46954683
// BOLT #2 spec: Sending node must ensure the chain_hash value identifies the chain it wishes to open the channel within.
46964684
let chain_hash = ChainHash::using_genesis_block(Network::Testnet);
46974685
assert_eq!(node0_to_1_send_open_channel.common_fields.chain_hash, chain_hash);
4698-
4699-
// BOLT #2 spec: Sending node must set funding_pubkey, revocation_basepoint, htlc_basepoint, payment_basepoint, and delayed_payment_basepoint to valid DER-encoded, compressed, secp256k1 pubkeys.
4700-
assert!(PublicKey::from_slice(&node0_to_1_send_open_channel.common_fields.funding_pubkey.serialize()).is_ok());
4701-
assert!(PublicKey::from_slice(&node0_to_1_send_open_channel.common_fields.revocation_basepoint.serialize()).is_ok());
4702-
assert!(PublicKey::from_slice(&node0_to_1_send_open_channel.common_fields.htlc_basepoint.serialize()).is_ok());
4703-
assert!(PublicKey::from_slice(&node0_to_1_send_open_channel.common_fields.payment_basepoint.serialize()).is_ok());
4704-
assert!(PublicKey::from_slice(&node0_to_1_send_open_channel.common_fields.delayed_payment_basepoint.serialize()).is_ok());
47054686
}
47064687

47074688
#[xtest(feature = "_externalize_tests")]

0 commit comments

Comments
 (0)