Skip to content

Commit 5c04d0d

Browse files
committed
f store accountable as bool in OutboundHTLCOutput
1 parent ba1045f commit 5c04d0d

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
@@ -433,7 +433,7 @@ struct OutboundHTLCOutput {
433433
skimmed_fee_msat: Option<u64>,
434434
send_timestamp: Option<Duration>,
435435
hold_htlc: Option<()>,
436-
accountable: Option<bool>,
436+
accountable: bool,
437437
}
438438

439439
/// See AwaitingRemoteRevoke ChannelState for more info
@@ -9691,7 +9691,7 @@ where
96919691
skimmed_fee_msat: htlc.skimmed_fee_msat,
96929692
blinding_point: htlc.blinding_point,
96939693
hold_htlc: htlc.hold_htlc,
9694-
accountable: accountable_from_bool(htlc.accountable.unwrap_or(false)),
9694+
accountable: accountable_from_bool(htlc.accountable),
96959695
});
96969696
}
96979697
}
@@ -12676,7 +12676,7 @@ where
1267612676
skimmed_fee_msat,
1267712677
send_timestamp,
1267812678
hold_htlc: hold_htlc.then(|| ()),
12679-
accountable: Some(accountable),
12679+
accountable,
1268012680
});
1268112681
self.context.next_holder_htlc_id += 1;
1268212682

@@ -14531,7 +14531,7 @@ where
1453114531
let mut pending_outbound_skimmed_fees: Vec<Option<u64>> = Vec::new();
1453214532
let mut pending_outbound_blinding_points: Vec<Option<PublicKey>> = Vec::new();
1453314533
let mut pending_outbound_held_htlc_flags: Vec<Option<()>> = Vec::new();
14534-
let mut pending_outbound_accountable: Vec<Option<bool>> = Vec::new();
14534+
let mut pending_outbound_accountable: Vec<bool> = Vec::new();
1453514535

1453614536
(self.context.pending_outbound_htlcs.len() as u64).write(writer)?;
1453714537
for htlc in self.context.pending_outbound_htlcs.iter() {
@@ -15027,7 +15027,7 @@ where
1502715027
blinding_point: None,
1502815028
send_timestamp: None,
1502915029
hold_htlc: None,
15030-
accountable: None,
15030+
accountable: false,
1503115031
});
1503215032
}
1503315033

@@ -15250,7 +15250,7 @@ where
1525015250
let mut pending_outbound_held_htlc_flags_opt: Option<Vec<Option<()>>> = None;
1525115251
let mut holding_cell_held_htlc_flags_opt: Option<Vec<Option<()>>> = None;
1525215252
let mut holding_cell_accountable: Option<Vec<bool>> = None;
15253-
let mut pending_outbound_accountable_opt: Option<Vec<Option<bool>>> = None;
15253+
let mut pending_outbound_accountable: Option<Vec<bool>> = None;
1525415254

1525515255
read_tlv_fields!(reader, {
1525615256
(0, announcement_sigs, option),
@@ -15301,7 +15301,7 @@ where
1530115301
(71, holder_commitment_point_previous_revoked_opt, option), // Added in 0.3
1530215302
(73, holder_commitment_point_last_revoked_opt, option), // Added in 0.3
1530315303
(75, holding_cell_accountable, optional_vec), // Added in 0.3
15304-
(77, pending_outbound_accountable_opt, optional_vec), // Added in 0.3
15304+
(77, pending_outbound_accountable, optional_vec), // Added in 0.3
1530515305
});
1530615306

1530715307
let holder_signer = signer_provider.derive_channel_signer(channel_keys_id);
@@ -15438,7 +15438,7 @@ where
1543815438
return Err(DecodeError::InvalidValue);
1543915439
}
1544015440
}
15441-
if let Some(held_htlcs) = pending_outbound_accountable_opt {
15441+
if let Some(held_htlcs) = pending_outbound_accountable {
1544215442
let mut iter = held_htlcs.into_iter();
1544315443
for htlc in pending_outbound_htlcs.iter_mut() {
1544415444
htlc.accountable = iter.next().ok_or(DecodeError::InvalidValue)?;
@@ -16051,7 +16051,7 @@ mod tests {
1605116051
blinding_point: None,
1605216052
send_timestamp: None,
1605316053
hold_htlc: None,
16054-
accountable: None,
16054+
accountable: false,
1605516055
});
1605616056

1605716057
// Make sure when Node A calculates their local commitment transaction, none of the HTLCs pass
@@ -16507,7 +16507,7 @@ mod tests {
1650716507
blinding_point: None,
1650816508
send_timestamp: None,
1650916509
hold_htlc: None,
16510-
accountable: None,
16510+
accountable: false,
1651116511
};
1651216512
let mut pending_outbound_htlcs = vec![dummy_outbound_output.clone(); 10];
1651316513
for (idx, htlc) in pending_outbound_htlcs.iter_mut().enumerate() {
@@ -16906,7 +16906,7 @@ mod tests {
1690616906
blinding_point: None,
1690716907
send_timestamp: None,
1690816908
hold_htlc: None,
16909-
accountable: None,
16909+
accountable: false,
1691016910
});
1691116911

1691216912
let payment_preimage_3 =
@@ -16922,7 +16922,7 @@ mod tests {
1692216922
blinding_point: None,
1692316923
send_timestamp: None,
1692416924
hold_htlc: None,
16925-
accountable: None,
16925+
accountable: false,
1692616926
});
1692716927

1692816928
let payment_preimage_4 =
@@ -17338,7 +17338,7 @@ mod tests {
1733817338
blinding_point: None,
1733917339
send_timestamp: None,
1734017340
hold_htlc: None,
17341-
accountable: None,
17341+
accountable: false,
1734217342
});
1734317343

1734417344
chan.context.pending_outbound_htlcs.push(OutboundHTLCOutput {
@@ -17352,7 +17352,7 @@ mod tests {
1735217352
blinding_point: None,
1735317353
send_timestamp: None,
1735417354
hold_htlc: None,
17355-
accountable: None,
17355+
accountable: false,
1735617356
});
1735717357

1735817358
test_commitment!("304402207d0870964530f97b62497b11153c551dca0a1e226815ef0a336651158da0f82402200f5378beee0e77759147b8a0a284decd11bfd2bc55c8fafa41c134fe996d43c8",
@@ -17594,7 +17594,7 @@ mod tests {
1759417594
blinding_point: None,
1759517595
send_timestamp: None,
1759617596
hold_htlc: None,
17597-
accountable: None,
17597+
accountable: false,
1759817598
}),
1759917599
);
1760017600

@@ -17685,7 +17685,7 @@ mod tests {
1768517685
blinding_point: None,
1768617686
send_timestamp: None,
1768717687
hold_htlc: None,
17688-
accountable: None,
17688+
accountable: false,
1768917689
}
1769017690
}),
1769117691
);
@@ -17742,7 +17742,7 @@ mod tests {
1774217742
blinding_point: None,
1774317743
send_timestamp: None,
1774417744
hold_htlc: None,
17745-
accountable: None,
17745+
accountable: false,
1774617746
}),
1774717747
);
1774817748

@@ -17802,7 +17802,7 @@ mod tests {
1780217802
blinding_point: None,
1780317803
send_timestamp: None,
1780417804
hold_htlc: None,
17805-
accountable: None,
17805+
accountable: false,
1780617806
}),
1780717807
);
1780817808

0 commit comments

Comments
 (0)