Skip to content

Commit 5d6e759

Browse files
committed
Change Stfu::initiator to bool type
1 parent 6cf270d commit 5d6e759

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
@@ -455,8 +455,8 @@ pub type SerialId = u64;
455455
pub struct Stfu {
456456
/// The channel ID where quiescence is intended
457457
pub channel_id: ChannelId,
458-
/// Initiator flag, 1 if initiating, 0 if replying to an stfu.
459-
pub initiator: u8,
458+
/// Initiator flag, true if initiating, false if replying to an stfu.
459+
pub initiator: bool,
460460
}
461461

462462
/// A `splice_init` message to be sent by or received from the stfu initiator (splice initiator).
@@ -4112,10 +4112,17 @@ mod tests {
41124112
fn encoding_stfu() {
41134113
let stfu = msgs::Stfu {
41144114
channel_id: ChannelId::from_bytes([2; 32]),
4115-
initiator: 1,
4115+
initiator: true,
41164116
};
41174117
let encoded_value = stfu.encode();
41184118
assert_eq!(encoded_value.as_hex().to_string(), "020202020202020202020202020202020202020202020202020202020202020201");
4119+
4120+
let stfu = msgs::Stfu {
4121+
channel_id: ChannelId::from_bytes([3; 32]),
4122+
initiator: false,
4123+
};
4124+
let encoded_value = stfu.encode();
4125+
assert_eq!(encoded_value.as_hex().to_string(), "030303030303030303030303030303030303030303030303030303030303030300");
41194126
}
41204127

41214128
#[test]

0 commit comments

Comments
 (0)