Skip to content

Commit 0dfd20b

Browse files
committed
Drop time_created in HTLCAwaitingACK::AddHTLC (we can use the CLTV)
1 parent fb7fc69 commit 0dfd20b

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/ln/channel.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ use util::config::{UserConfig,ChannelConfig};
3333
use std;
3434
use std::default::Default;
3535
use std::{cmp,mem};
36-
use std::time::Instant;
3736
use std::sync::{Arc};
3837

3938
#[cfg(test)]
@@ -133,14 +132,13 @@ struct OutboundHTLCOutput {
133132

134133
/// See AwaitingRemoteRevoke ChannelState for more info
135134
enum HTLCUpdateAwaitingACK {
136-
AddHTLC {
135+
AddHTLC { // TODO: Time out if we're getting close to cltv_expiry
137136
// always outbound
138137
amount_msat: u64,
139138
cltv_expiry: u32,
140139
payment_hash: PaymentHash,
141140
source: HTLCSource,
142141
onion_routing_packet: msgs::OnionPacket,
143-
time_created: Instant, //TODO: Some kind of timeout thing-a-majig
144142
},
145143
ClaimHTLC {
146144
payment_preimage: PaymentPreimage,
@@ -3252,7 +3250,6 @@ impl Channel {
32523250
cltv_expiry: cltv_expiry,
32533251
source,
32543252
onion_routing_packet: onion_routing_packet,
3255-
time_created: Instant::now(),
32563253
});
32573254
return Ok(None);
32583255
}
@@ -3622,14 +3619,13 @@ impl Writeable for Channel {
36223619
(self.holding_cell_htlc_updates.len() as u64).write(writer)?;
36233620
for update in self.holding_cell_htlc_updates.iter() {
36243621
match update {
3625-
&HTLCUpdateAwaitingACK::AddHTLC { ref amount_msat, ref cltv_expiry, ref payment_hash, ref source, ref onion_routing_packet, time_created: _ } => {
3622+
&HTLCUpdateAwaitingACK::AddHTLC { ref amount_msat, ref cltv_expiry, ref payment_hash, ref source, ref onion_routing_packet } => {
36263623
0u8.write(writer)?;
36273624
amount_msat.write(writer)?;
36283625
cltv_expiry.write(writer)?;
36293626
payment_hash.write(writer)?;
36303627
source.write(writer)?;
36313628
onion_routing_packet.write(writer)?;
3632-
// time_created is not serialized - we re-init the timeout upon deserialization
36333629
},
36343630
&HTLCUpdateAwaitingACK::ClaimHTLC { ref payment_preimage, ref htlc_id } => {
36353631
1u8.write(writer)?;
@@ -3796,7 +3792,6 @@ impl<R : ::std::io::Read> ReadableArgs<R, Arc<Logger>> for Channel {
37963792
payment_hash: Readable::read(reader)?,
37973793
source: Readable::read(reader)?,
37983794
onion_routing_packet: Readable::read(reader)?,
3799-
time_created: Instant::now(),
38003795
},
38013796
1 => HTLCUpdateAwaitingACK::ClaimHTLC {
38023797
payment_preimage: Readable::read(reader)?,

0 commit comments

Comments
 (0)