mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 07:17:40 +01:00
Dry-up InputMaterial::Funding
As channel_value last usage was for computing feerate but as this one is static per-commitment and will always-be following specification, we remove it.
This commit is contained in:
parent
4dc0dd17c0
commit
359b3d5702
2 changed files with 6 additions and 17 deletions
|
@ -442,9 +442,7 @@ pub(crate) enum InputMaterial {
|
||||||
preimage: Option<PaymentPreimage>,
|
preimage: Option<PaymentPreimage>,
|
||||||
amount: u64,
|
amount: u64,
|
||||||
},
|
},
|
||||||
Funding {
|
Funding {}
|
||||||
channel_value: u64,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Writeable for InputMaterial {
|
impl Writeable for InputMaterial {
|
||||||
|
@ -471,9 +469,8 @@ impl Writeable for InputMaterial {
|
||||||
preimage.write(writer)?;
|
preimage.write(writer)?;
|
||||||
writer.write_all(&byte_utils::be64_to_array(*amount))?;
|
writer.write_all(&byte_utils::be64_to_array(*amount))?;
|
||||||
},
|
},
|
||||||
&InputMaterial::Funding { ref channel_value } => {
|
&InputMaterial::Funding {} => {
|
||||||
writer.write_all(&[3; 1])?;
|
writer.write_all(&[3; 1])?;
|
||||||
channel_value.write(writer)?;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -520,10 +517,7 @@ impl Readable for InputMaterial {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
3 => {
|
3 => {
|
||||||
let channel_value = Readable::read(reader)?;
|
InputMaterial::Funding {}
|
||||||
InputMaterial::Funding {
|
|
||||||
channel_value
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => return Err(DecodeError::InvalidValue),
|
_ => return Err(DecodeError::InvalidValue),
|
||||||
};
|
};
|
||||||
|
@ -1864,7 +1858,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
|
||||||
}
|
}
|
||||||
let should_broadcast = self.would_broadcast_at_height(height);
|
let should_broadcast = self.would_broadcast_at_height(height);
|
||||||
if should_broadcast {
|
if should_broadcast {
|
||||||
claimable_outpoints.push(ClaimRequest { absolute_timelock: height, aggregable: false, outpoint: BitcoinOutPoint { txid: self.funding_info.0.txid.clone(), vout: self.funding_info.0.index as u32 }, witness_data: InputMaterial::Funding { channel_value: self.channel_value_satoshis }});
|
claimable_outpoints.push(ClaimRequest { absolute_timelock: height, aggregable: false, outpoint: BitcoinOutPoint { txid: self.funding_info.0.txid.clone(), vout: self.funding_info.0.index as u32 }, witness_data: InputMaterial::Funding {}});
|
||||||
}
|
}
|
||||||
if should_broadcast {
|
if should_broadcast {
|
||||||
if let Some(commitment_tx) = self.onchain_tx_handler.get_fully_signed_local_tx() {
|
if let Some(commitment_tx) = self.onchain_tx_handler.get_fully_signed_local_tx() {
|
||||||
|
|
|
@ -531,16 +531,11 @@ impl<ChanSigner: ChannelKeys> OnchainTxHandler<ChanSigner> {
|
||||||
}
|
}
|
||||||
return None;
|
return None;
|
||||||
},
|
},
|
||||||
&InputMaterial::Funding { ref channel_value } => {
|
&InputMaterial::Funding {} => {
|
||||||
let signed_tx = self.get_fully_signed_local_tx().unwrap();
|
let signed_tx = self.get_fully_signed_local_tx().unwrap();
|
||||||
let mut amt_outputs = 0;
|
|
||||||
for outp in signed_tx.output.iter() {
|
|
||||||
amt_outputs += outp.value;
|
|
||||||
}
|
|
||||||
let feerate = (channel_value - amt_outputs) * 1000 / signed_tx.get_weight() as u64;
|
|
||||||
// Timer set to $NEVER given we can't bump tx without anchor outputs
|
// Timer set to $NEVER given we can't bump tx without anchor outputs
|
||||||
log_trace!(self, "Going to broadcast Local Transaction {} claiming funding output {} from {}...", signed_tx.txid(), outp.vout, outp.txid);
|
log_trace!(self, "Going to broadcast Local Transaction {} claiming funding output {} from {}...", signed_tx.txid(), outp.vout, outp.txid);
|
||||||
return Some((None, feerate, signed_tx));
|
return Some((None, self.local_commitment.as_ref().unwrap().feerate_per_kw, signed_tx));
|
||||||
}
|
}
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue