Skip to content

Commit 8ffe6e8

Browse files
committed
f store accountable as bool in HTLCUpdateAwaitingACK
1 parent 30e7353 commit 8ffe6e8

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,
@@ -462,7 +462,7 @@ enum HTLCUpdateAwaitingACK {
462462
skimmed_fee_msat: Option<u64>,
463463
blinding_point: Option<PublicKey>,
464464
hold_htlc: Option<()>,
465-
accountable: Option<bool>,
465+
accountable: bool,
466466
},
467467
ClaimHTLC {
468468
payment_preimage: PaymentPreimage,
@@ -8397,7 +8397,7 @@ where
83978397
skimmed_fee_msat,
83988398
blinding_point,
83998399
hold_htlc.is_some(),
8400-
accountable.unwrap_or(false),
8400+
accountable,
84018401
fee_estimator,
84028402
logger,
84038403
) {
@@ -12680,7 +12680,7 @@ where
1268012680
skimmed_fee_msat,
1268112681
blinding_point,
1268212682
hold_htlc: hold_htlc.then(|| ()),
12683-
accountable: Some(accountable),
12683+
accountable,
1268412684
});
1268512685
return Ok(false);
1268612686
}
@@ -14637,7 +14637,7 @@ where
1463714637
Vec::with_capacity(holding_cell_htlc_update_count);
1463814638
let mut holding_cell_held_htlc_flags: Vec<Option<()>> =
1463914639
Vec::with_capacity(holding_cell_htlc_update_count);
14640-
let mut holding_cell_accountable_flags: Vec<Option<bool>> =
14640+
let mut holding_cell_accountable_flags: Vec<bool> =
1464114641
Vec::with_capacity(holding_cell_htlc_update_count);
1464214642
// Vec of (htlc_id, failure_code, sha256_of_onion)
1464314643
let mut malformed_htlcs: Vec<(u64, u16, [u8; 32])> = Vec::new();
@@ -15113,7 +15113,7 @@ where
1511315113
skimmed_fee_msat: None,
1511415114
blinding_point: None,
1511515115
hold_htlc: None,
15116-
accountable: None,
15116+
accountable: false,
1511715117
},
1511815118
1 => HTLCUpdateAwaitingACK::ClaimHTLC {
1511915119
payment_preimage: Readable::read(reader)?,
@@ -15315,7 +15315,7 @@ where
1531515315

1531615316
let mut pending_outbound_held_htlc_flags_opt: Option<Vec<Option<()>>> = None;
1531715317
let mut holding_cell_held_htlc_flags_opt: Option<Vec<Option<()>>> = None;
15318-
let mut holding_cell_accountable_opt: Option<Vec<Option<bool>>> = None;
15318+
let mut holding_cell_accountable: Option<Vec<bool>> = None;
1531915319

1532015320
read_tlv_fields!(reader, {
1532115321
(0, announcement_sigs, option),
@@ -15365,7 +15365,7 @@ where
1536515365
(69, holding_cell_held_htlc_flags_opt, optional_vec), // Added in 0.2
1536615366
(71, holder_commitment_point_previous_revoked_opt, option), // Added in 0.3
1536715367
(73, holder_commitment_point_last_revoked_opt, option), // Added in 0.3
15368-
(75, holding_cell_accountable_opt, optional_vec), // Added in 0.3
15368+
(75, holding_cell_accountable, optional_vec), // Added in 0.3
1536915369
});
1537015370

1537115371
let holder_signer = signer_provider.derive_channel_signer(channel_keys_id);
@@ -15490,7 +15490,7 @@ where
1549015490
}
1549115491
}
1549215492

15493-
if let Some(accountable_htlcs) = holding_cell_accountable_opt {
15493+
if let Some(accountable_htlcs) = holding_cell_accountable {
1549415494
let mut iter = accountable_htlcs.into_iter();
1549515495
for htlc in holding_cell_htlc_updates.iter_mut() {
1549615496
if let HTLCUpdateAwaitingACK::AddHTLC { ref mut accountable, .. } = htlc {
@@ -16587,7 +16587,7 @@ mod tests {
1658716587
skimmed_fee_msat: None,
1658816588
blinding_point: None,
1658916589
hold_htlc: None,
16590-
accountable: None,
16590+
accountable: false,
1659116591
};
1659216592
let dummy_holding_cell_claim_htlc = |attribution_data| HTLCUpdateAwaitingACK::ClaimHTLC {
1659316593
payment_preimage: PaymentPreimage([42; 32]),

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7536,7 +7536,7 @@ where
75367536
onion_packet.clone(),
75377537
*skimmed_fee_msat,
75387538
next_blinding_point,
7539-
incoming_accountable.unwrap_or(false),
7539+
*incoming_accountable,
75407540
&self.fee_estimator,
75417541
&&logger,
75427542
) {

0 commit comments

Comments
 (0)