Skip to content

Commit 65db31d

Browse files
committed
Change Stfu::initiator to bool type
1 parent a91196b commit 65db31d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lightning/src/ln/msgs.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,8 @@ pub type SerialId = u64;
454454
pub struct Stfu {
455455
/// The channel ID where quiescence is intended
456456
pub channel_id: ChannelId,
457-
/// Initiator flag, 1 if initiating, 0 if replying to an stfu.
458-
pub initiator: u8,
457+
/// Initiator flag, true if initiating, false if replying to an stfu.
458+
pub initiator: bool,
459459
}
460460

461461
/// A `splice_init` message to be sent by or received from the stfu initiator (splice initiator).
@@ -4053,10 +4053,17 @@ mod tests {
40534053
fn encoding_stfu() {
40544054
let stfu = msgs::Stfu {
40554055
channel_id: ChannelId::from_bytes([2; 32]),
4056-
initiator: 1,
4056+
initiator: true,
40574057
};
40584058
let encoded_value = stfu.encode();
40594059
assert_eq!(encoded_value.as_hex().to_string(), "020202020202020202020202020202020202020202020202020202020202020201");
4060+
4061+
let stfu = msgs::Stfu {
4062+
channel_id: ChannelId::from_bytes([3; 32]),
4063+
initiator: false,
4064+
};
4065+
let encoded_value = stfu.encode();
4066+
assert_eq!(encoded_value.as_hex().to_string(), "030303030303030303030303030303030303030303030303030303030303030300");
40604067
}
40614068

40624069
#[test]

0 commit comments

Comments
 (0)