Skip to content

Commit 9164e18

Browse files
committed
f store accountable as bool in HTLCUpdateAwaitingACK
1 parent e288301 commit 9164e18

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

lightning/src/ln/channel.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ use crate::ln::interactivetxs::{
6262
InteractiveTxSigningSession, NegotiationError, SharedOwnedInput, SharedOwnedOutput,
6363
TX_COMMON_FIELDS_WEIGHT,
6464
};
65-
use crate::ln::msgs::{self, accountable_from_bool};
65+
use crate::ln::msgs;
6666
use crate::ln::msgs::{ClosingSigned, ClosingSignedFeeRange, DecodeError, OnionErrorPacket};
6767
use crate::ln::onion_utils::{
6868
AttributionData, HTLCFailReason, LocalHTLCFailureReason, HOLD_TIME_UNIT_MILLIS,
@@ -451,7 +451,7 @@ enum HTLCUpdateAwaitingACK {
451451
skimmed_fee_msat: Option<u64>,
452452
blinding_point: Option<PublicKey>,
453453
hold_htlc: Option<()>,
454-
accountable: Option<bool>,
454+
accountable: bool,
455455
},
456456
ClaimHTLC {
457457
payment_preimage: PaymentPreimage,
@@ -8371,7 +8371,7 @@ where
83718371
skimmed_fee_msat,
83728372
blinding_point,
83738373
hold_htlc.is_some(),
8374-
accountable.unwrap_or(false),
8374+
accountable,
83758375
fee_estimator,
83768376
logger,
83778377
) {
@@ -12652,7 +12652,7 @@ where
1265212652
skimmed_fee_msat,
1265312653
blinding_point,
1265412654
hold_htlc: hold_htlc.then(|| ()),
12655-
accountable: Some(accountable),
12655+
accountable,
1265612656
});
1265712657
return Ok(false);
1265812658
}
@@ -14583,7 +14583,7 @@ where
1458314583
Vec::with_capacity(holding_cell_htlc_update_count);
1458414584
let mut holding_cell_held_htlc_flags: Vec<Option<()>> =
1458514585
Vec::with_capacity(holding_cell_htlc_update_count);
14586-
let mut holding_cell_accountable_flags: Vec<Option<bool>> =
14586+
let mut holding_cell_accountable_flags: Vec<bool> =
1458714587
Vec::with_capacity(holding_cell_htlc_update_count);
1458814588
// Vec of (htlc_id, failure_code, sha256_of_onion)
1458914589
let mut malformed_htlcs: Vec<(u64, u16, [u8; 32])> = Vec::new();
@@ -15041,7 +15041,7 @@ where
1504115041
skimmed_fee_msat: None,
1504215042
blinding_point: None,
1504315043
hold_htlc: None,
15044-
accountable: None,
15044+
accountable: false,
1504515045
},
1504615046
1 => HTLCUpdateAwaitingACK::ClaimHTLC {
1504715047
payment_preimage: Readable::read(reader)?,
@@ -15243,7 +15243,7 @@ where
1524315243

1524415244
let mut pending_outbound_held_htlc_flags_opt: Option<Vec<Option<()>>> = None;
1524515245
let mut holding_cell_held_htlc_flags_opt: Option<Vec<Option<()>>> = None;
15246-
let mut holding_cell_accountable_opt: Option<Vec<Option<bool>>> = None;
15246+
let mut holding_cell_accountable: Option<Vec<bool>> = None;
1524715247

1524815248
read_tlv_fields!(reader, {
1524915249
(0, announcement_sigs, option),
@@ -15293,7 +15293,7 @@ where
1529315293
(69, holding_cell_held_htlc_flags_opt, optional_vec), // Added in 0.2
1529415294
(71, holder_commitment_point_previous_revoked_opt, option), // Added in 0.3
1529515295
(73, holder_commitment_point_last_revoked_opt, option), // Added in 0.3
15296-
(75, holding_cell_accountable_opt, optional_vec), // Added in 0.3
15296+
(75, holding_cell_accountable, optional_vec), // Added in 0.3
1529715297
});
1529815298

1529915299
let holder_signer = signer_provider.derive_channel_signer(channel_keys_id);
@@ -15418,7 +15418,7 @@ where
1541815418
}
1541915419
}
1542015420

15421-
if let Some(accountable_htlcs) = holding_cell_accountable_opt {
15421+
if let Some(accountable_htlcs) = holding_cell_accountable {
1542215422
let mut iter = accountable_htlcs.into_iter();
1542315423
for htlc in holding_cell_htlc_updates.iter_mut() {
1542415424
if let HTLCUpdateAwaitingACK::AddHTLC { ref mut accountable, .. } = htlc {
@@ -16515,7 +16515,7 @@ mod tests {
1651516515
skimmed_fee_msat: None,
1651616516
blinding_point: None,
1651716517
hold_htlc: None,
16518-
accountable: None,
16518+
accountable: false,
1651916519
};
1652016520
let dummy_holding_cell_claim_htlc = |attribution_data| HTLCUpdateAwaitingACK::ClaimHTLC {
1652116521
payment_preimage: PaymentPreimage([42; 32]),

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7498,7 +7498,7 @@ where
74987498
onion_packet.clone(),
74997499
*skimmed_fee_msat,
75007500
next_blinding_point,
7501-
incoming_accountable.unwrap_or(false),
7501+
*incoming_accountable,
75027502
&self.fee_estimator,
75037503
&&logger,
75047504
) {

0 commit comments

Comments
 (0)