Skip to content

Commit 1855a02

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 dead code and may break due to harmless protocol changes. Here, we drop a few useless tests.
1 parent 609330f commit 1855a02

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
@@ -4668,27 +4668,15 @@ pub fn bolt2_open_channel_sending_node_checks_part2() {
46684668

46694669
let node_b_id = nodes[1].node.get_our_node_id();
46704670

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

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

4689-
// BOLT #2 spec: Sending node must set undefined bits in channel_flags to 0
4690-
// 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
4691-
assert!(node0_to_1_send_open_channel.common_fields.channel_flags<=1);
4679+
let node0_to_1_send_open_channel = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel, node_b_id);
46924680

46934681
// 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.
46944682
assert!(BREAKDOWN_TIMEOUT>0);
@@ -4697,13 +4685,6 @@ pub fn bolt2_open_channel_sending_node_checks_part2() {
46974685
// BOLT #2 spec: Sending node must ensure the chain_hash value identifies the chain it wishes to open the channel within.
46984686
let chain_hash = ChainHash::using_genesis_block(Network::Testnet);
46994687
assert_eq!(node0_to_1_send_open_channel.common_fields.chain_hash, chain_hash);
4700-
4701-
// 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.
4702-
assert!(PublicKey::from_slice(&node0_to_1_send_open_channel.common_fields.funding_pubkey.serialize()).is_ok());
4703-
assert!(PublicKey::from_slice(&node0_to_1_send_open_channel.common_fields.revocation_basepoint.serialize()).is_ok());
4704-
assert!(PublicKey::from_slice(&node0_to_1_send_open_channel.common_fields.htlc_basepoint.serialize()).is_ok());
4705-
assert!(PublicKey::from_slice(&node0_to_1_send_open_channel.common_fields.payment_basepoint.serialize()).is_ok());
4706-
assert!(PublicKey::from_slice(&node0_to_1_send_open_channel.common_fields.delayed_payment_basepoint.serialize()).is_ok());
47074688
}
47084689

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

0 commit comments

Comments
 (0)