Skip to content

Commit 6bc4ad0

Browse files
committed
Change Event amt fields to amount_msat for clarity
1 parent 8a56702 commit 6bc4ad0

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lightning/src/util/events.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ pub enum Event {
209209
/// not stop you from registering duplicate payment hashes for inbound payments.
210210
payment_hash: PaymentHash,
211211
/// The value, in thousandths of a satoshi, that this payment is for.
212-
amt: u64,
212+
amount_msat: u64,
213213
/// Information for claiming this received payment, based on whether the purpose of the
214214
/// payment is to pay an invoice or to send a spontaneous payment.
215215
purpose: PaymentPurpose,
@@ -233,7 +233,7 @@ pub enum Event {
233233
/// registering duplicate payment hashes for inbound payments.
234234
payment_hash: PaymentHash,
235235
/// The value, in thousandths of a satoshi, that this payment is for.
236-
amt: u64,
236+
amount_msat: u64,
237237
/// The purpose of this claimed payment, i.e. whether the payment was for an invoice or a
238238
/// spontaneous payment.
239239
purpose: PaymentPurpose,
@@ -508,7 +508,7 @@ impl Writeable for Event {
508508
// We never write out FundingGenerationReady events as, upon disconnection, peers
509509
// drop any channels which have not yet exchanged funding_signed.
510510
},
511-
&Event::PaymentReceived { ref payment_hash, ref amt, ref purpose } => {
511+
&Event::PaymentReceived { ref payment_hash, ref amount_msat, ref purpose } => {
512512
1u8.write(writer)?;
513513
let mut payment_secret = None;
514514
let payment_preimage;
@@ -524,7 +524,7 @@ impl Writeable for Event {
524524
write_tlv_fields!(writer, {
525525
(0, payment_hash, required),
526526
(2, payment_secret, option),
527-
(4, amt, required),
527+
(4, amount_msat, required),
528528
(6, 0u64, required), // user_payment_id required for compatibility with 0.0.103 and earlier
529529
(8, payment_preimage, option),
530530
});
@@ -617,12 +617,12 @@ impl Writeable for Event {
617617
// We never write the OpenChannelRequest events as, upon disconnection, peers
618618
// drop any channels which have not yet exchanged funding_signed.
619619
},
620-
&Event::PaymentClaimed { ref payment_hash, ref amt, ref purpose } => {
620+
&Event::PaymentClaimed { ref payment_hash, ref amount_msat, ref purpose } => {
621621
19u8.write(writer)?;
622622
write_tlv_fields!(writer, {
623623
(0, payment_hash, required),
624624
(2, purpose, required),
625-
(4, amt, required),
625+
(4, amount_msat, required),
626626
});
627627
},
628628
// Note that, going forward, all new events must only write data inside of
@@ -643,12 +643,12 @@ impl MaybeReadable for Event {
643643
let mut payment_hash = PaymentHash([0; 32]);
644644
let mut payment_preimage = None;
645645
let mut payment_secret = None;
646-
let mut amt = 0;
646+
let mut amount_msat = 0;
647647
let mut _user_payment_id = None::<u64>; // For compatibility with 0.0.103 and earlier
648648
read_tlv_fields!(reader, {
649649
(0, payment_hash, required),
650650
(2, payment_secret, option),
651-
(4, amt, required),
651+
(4, amount_msat, required),
652652
(6, _user_payment_id, option),
653653
(8, payment_preimage, option),
654654
});
@@ -662,7 +662,7 @@ impl MaybeReadable for Event {
662662
};
663663
Ok(Some(Event::PaymentReceived {
664664
payment_hash,
665-
amt,
665+
amount_msat,
666666
purpose,
667667
}))
668668
};
@@ -829,17 +829,17 @@ impl MaybeReadable for Event {
829829
let f = || {
830830
let mut payment_hash = PaymentHash([0; 32]);
831831
let mut purpose = None;
832-
let mut amt = 0;
832+
let mut amount_msat = 0;
833833
read_tlv_fields!(reader, {
834834
(0, payment_hash, required),
835835
(2, purpose, ignorable),
836-
(4, amt, required),
836+
(4, amount_msat, required),
837837
});
838838
if purpose.is_none() { return Ok(None); }
839839
Ok(Some(Event::PaymentClaimed {
840840
payment_hash,
841841
purpose: purpose.unwrap(),
842-
amt,
842+
amount_msat,
843843
}))
844844
};
845845
f()

0 commit comments

Comments
 (0)