X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fchain%2Fpackage.rs;h=35d90fb31812434afacffb33e4cb8ca798da319e;hb=baf2dec06b3f16cdd111369a95f0348adce829fc;hp=cf92df2952148dd11f25838422010ead1281ae9d;hpb=14d2e979651769bfff7acb6fed33b0e7df509d9a;p=rust-lightning diff --git a/lightning/src/chain/package.rs b/lightning/src/chain/package.rs index cf92df29..35d90fb3 100644 --- a/lightning/src/chain/package.rs +++ b/lightning/src/chain/package.rs @@ -27,7 +27,6 @@ use crate::ln::msgs::DecodeError; use crate::chain::chaininterface::{FeeEstimator, ConfirmationTarget, MIN_RELAY_FEE_SAT_PER_1000_WEIGHT}; use crate::chain::keysinterface::Sign; use crate::chain::onchaintx::OnchainTxHandler; -use crate::util::byte_utils; use crate::util::logger::Logger; use crate::util::ser::{Readable, Writer, Writeable}; @@ -253,31 +252,31 @@ impl_writeable_tlv_based!(CounterpartyReceivedHTLCOutput, { #[derive(Clone, PartialEq, Eq)] pub(crate) struct HolderHTLCOutput { preimage: Option, - amount: u64, + amount_msat: u64, /// Defaults to 0 for HTLC-Success transactions, which have no expiry cltv_expiry: u32, } impl HolderHTLCOutput { - pub(crate) fn build_offered(amount: u64, cltv_expiry: u32) -> Self { + pub(crate) fn build_offered(amount_msat: u64, cltv_expiry: u32) -> Self { HolderHTLCOutput { preimage: None, - amount, + amount_msat, cltv_expiry, } } - pub(crate) fn build_accepted(preimage: PaymentPreimage, amount: u64) -> Self { + pub(crate) fn build_accepted(preimage: PaymentPreimage, amount_msat: u64) -> Self { HolderHTLCOutput { preimage: Some(preimage), - amount, + amount_msat, cltv_expiry: 0, } } } impl_writeable_tlv_based!(HolderHTLCOutput, { - (0, amount, required), + (0, amount_msat, required), (2, cltv_expiry, required), (4, preimage, option) }); @@ -770,7 +769,7 @@ impl PackageTemplate { impl Writeable for PackageTemplate { fn write(&self, writer: &mut W) -> Result<(), io::Error> { - writer.write_all(&byte_utils::be64_to_array(self.inputs.len() as u64))?; + writer.write_all(&(self.inputs.len() as u64).to_be_bytes())?; for (ref outpoint, ref rev_outp) in self.inputs.iter() { outpoint.write(writer)?; rev_outp.write(writer)?;