projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Specify amount units in HolderHTLCOutput
[rust-lightning]
/
lightning
/
src
/
chain
/
package.rs
diff --git
a/lightning/src/chain/package.rs
b/lightning/src/chain/package.rs
index cf92df2952148dd11f25838422010ead1281ae9d..35d90fb31812434afacffb33e4cb8ca798da319e 100644
(file)
--- 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::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};
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<PaymentPreimage>,
#[derive(Clone, PartialEq, Eq)]
pub(crate) struct HolderHTLCOutput {
preimage: Option<PaymentPreimage>,
- amount: u64,
+ amount
_msat
: u64,
/// Defaults to 0 for HTLC-Success transactions, which have no expiry
cltv_expiry: u32,
}
impl HolderHTLCOutput {
/// 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,
HolderHTLCOutput {
preimage: None,
- amount,
+ amount
_msat
,
cltv_expiry,
}
}
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),
HolderHTLCOutput {
preimage: Some(preimage),
- amount,
+ amount
_msat
,
cltv_expiry: 0,
}
}
}
impl_writeable_tlv_based!(HolderHTLCOutput, {
cltv_expiry: 0,
}
}
}
impl_writeable_tlv_based!(HolderHTLCOutput, {
- (0, amount, required),
+ (0, amount
_msat
, required),
(2, cltv_expiry, required),
(4, preimage, option)
});
(2, cltv_expiry, required),
(4, preimage, option)
});
@@
-770,7
+769,7
@@
impl PackageTemplate {
impl Writeable for PackageTemplate {
fn write<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> {
impl Writeable for PackageTemplate {
fn write<W: Writer>(&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)?;
for (ref outpoint, ref rev_outp) in self.inputs.iter() {
outpoint.write(writer)?;
rev_outp.write(writer)?;