Skip to content

Commit 85135b5

Browse files
committed
f store accountable as bool in OutboundHTLCOutput
1 parent 0225eb0 commit 85135b5

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

lightning/src/ln/channel.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ struct OutboundHTLCOutput {
444444
skimmed_fee_msat: Option<u64>,
445445
send_timestamp: Option<Duration>,
446446
hold_htlc: Option<()>,
447-
accountable: Option<bool>,
447+
accountable: bool,
448448
}
449449

450450
/// See AwaitingRemoteRevoke ChannelState for more info
@@ -9722,7 +9722,7 @@ where
97229722
skimmed_fee_msat: htlc.skimmed_fee_msat,
97239723
blinding_point: htlc.blinding_point,
97249724
hold_htlc: htlc.hold_htlc,
9725-
accountable: accountable_from_bool(htlc.accountable.unwrap_or(false)),
9725+
accountable: accountable_from_bool(htlc.accountable),
97269726
});
97279727
}
97289728
}
@@ -12704,7 +12704,7 @@ where
1270412704
skimmed_fee_msat,
1270512705
send_timestamp,
1270612706
hold_htlc: hold_htlc.then(|| ()),
12707-
accountable: Some(accountable),
12707+
accountable,
1270812708
});
1270912709
self.context.next_holder_htlc_id += 1;
1271012710

@@ -14585,7 +14585,7 @@ where
1458514585
let mut pending_outbound_skimmed_fees: Vec<Option<u64>> = Vec::new();
1458614586
let mut pending_outbound_blinding_points: Vec<Option<PublicKey>> = Vec::new();
1458714587
let mut pending_outbound_held_htlc_flags: Vec<Option<()>> = Vec::new();
14588-
let mut pending_outbound_accountable: Vec<Option<bool>> = Vec::new();
14588+
let mut pending_outbound_accountable: Vec<bool> = Vec::new();
1458914589

1459014590
(self.context.pending_outbound_htlcs.len() as u64).write(writer)?;
1459114591
for htlc in self.context.pending_outbound_htlcs.iter() {
@@ -15099,7 +15099,7 @@ where
1509915099
blinding_point: None,
1510015100
send_timestamp: None,
1510115101
hold_htlc: None,
15102-
accountable: None,
15102+
accountable: false,
1510315103
});
1510415104
}
1510515105

@@ -15322,7 +15322,7 @@ where
1532215322
let mut pending_outbound_held_htlc_flags_opt: Option<Vec<Option<()>>> = None;
1532315323
let mut holding_cell_held_htlc_flags_opt: Option<Vec<Option<()>>> = None;
1532415324
let mut holding_cell_accountable: Option<Vec<bool>> = None;
15325-
let mut pending_outbound_accountable_opt: Option<Vec<Option<bool>>> = None;
15325+
let mut pending_outbound_accountable: Option<Vec<bool>> = None;
1532615326

1532715327
read_tlv_fields!(reader, {
1532815328
(0, announcement_sigs, option),
@@ -15373,7 +15373,7 @@ where
1537315373
(71, holder_commitment_point_previous_revoked_opt, option), // Added in 0.3
1537415374
(73, holder_commitment_point_last_revoked_opt, option), // Added in 0.3
1537515375
(75, holding_cell_accountable, optional_vec), // Added in 0.3
15376-
(77, pending_outbound_accountable_opt, optional_vec), // Added in 0.3
15376+
(77, pending_outbound_accountable, optional_vec), // Added in 0.3
1537715377
});
1537815378

1537915379
let holder_signer = signer_provider.derive_channel_signer(channel_keys_id);
@@ -15510,7 +15510,7 @@ where
1551015510
return Err(DecodeError::InvalidValue);
1551115511
}
1551215512
}
15513-
if let Some(held_htlcs) = pending_outbound_accountable_opt {
15513+
if let Some(held_htlcs) = pending_outbound_accountable {
1551415514
let mut iter = held_htlcs.into_iter();
1551515515
for htlc in pending_outbound_htlcs.iter_mut() {
1551615516
htlc.accountable = iter.next().ok_or(DecodeError::InvalidValue)?;
@@ -16123,7 +16123,7 @@ mod tests {
1612316123
blinding_point: None,
1612416124
send_timestamp: None,
1612516125
hold_htlc: None,
16126-
accountable: None,
16126+
accountable: false,
1612716127
});
1612816128

1612916129
// Make sure when Node A calculates their local commitment transaction, none of the HTLCs pass
@@ -16579,7 +16579,7 @@ mod tests {
1657916579
blinding_point: None,
1658016580
send_timestamp: None,
1658116581
hold_htlc: None,
16582-
accountable: None,
16582+
accountable: false,
1658316583
};
1658416584
let mut pending_outbound_htlcs = vec![dummy_outbound_output.clone(); 10];
1658516585
for (idx, htlc) in pending_outbound_htlcs.iter_mut().enumerate() {
@@ -16978,7 +16978,7 @@ mod tests {
1697816978
blinding_point: None,
1697916979
send_timestamp: None,
1698016980
hold_htlc: None,
16981-
accountable: None,
16981+
accountable: false,
1698216982
});
1698316983

1698416984
let payment_preimage_3 =
@@ -16994,7 +16994,7 @@ mod tests {
1699416994
blinding_point: None,
1699516995
send_timestamp: None,
1699616996
hold_htlc: None,
16997-
accountable: None,
16997+
accountable: false,
1699816998
});
1699916999

1700017000
let payment_preimage_4 =
@@ -17410,7 +17410,7 @@ mod tests {
1741017410
blinding_point: None,
1741117411
send_timestamp: None,
1741217412
hold_htlc: None,
17413-
accountable: None,
17413+
accountable: false,
1741417414
});
1741517415

1741617416
chan.context.pending_outbound_htlcs.push(OutboundHTLCOutput {
@@ -17424,7 +17424,7 @@ mod tests {
1742417424
blinding_point: None,
1742517425
send_timestamp: None,
1742617426
hold_htlc: None,
17427-
accountable: None,
17427+
accountable: false,
1742817428
});
1742917429

1743017430
test_commitment!("304402207d0870964530f97b62497b11153c551dca0a1e226815ef0a336651158da0f82402200f5378beee0e77759147b8a0a284decd11bfd2bc55c8fafa41c134fe996d43c8",
@@ -17666,7 +17666,7 @@ mod tests {
1766617666
blinding_point: None,
1766717667
send_timestamp: None,
1766817668
hold_htlc: None,
17669-
accountable: None,
17669+
accountable: false,
1767017670
}),
1767117671
);
1767217672

@@ -17812,7 +17812,7 @@ mod tests {
1781217812
blinding_point: None,
1781317813
send_timestamp: None,
1781417814
hold_htlc: None,
17815-
accountable: None,
17815+
accountable: false,
1781617816
}
1781717817
}),
1781817818
);
@@ -17869,7 +17869,7 @@ mod tests {
1786917869
blinding_point: None,
1787017870
send_timestamp: None,
1787117871
hold_htlc: None,
17872-
accountable: None,
17872+
accountable: false,
1787317873
}),
1787417874
);
1787517875

@@ -18040,7 +18040,7 @@ mod tests {
1804018040
blinding_point: None,
1804118041
send_timestamp: None,
1804218042
hold_htlc: None,
18043-
accountable: None,
18043+
accountable: false,
1804418044
}),
1804518045
);
1804618046

0 commit comments

Comments
 (0)