Skip to content
4 changes: 2 additions & 2 deletions fuzz/src/chanmon_consistency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ fn send_payment(
}],
route_params: Some(route_params.clone()),
};
let onion = RecipientOnionFields::secret_only(payment_secret);
let onion = RecipientOnionFields::secret_only(payment_secret, amt);
let res = source.send_payment_with_route(route, payment_hash, onion, payment_id);
match res {
Err(err) => {
Expand Down Expand Up @@ -642,7 +642,7 @@ fn send_hop_payment(
}],
route_params: Some(route_params.clone()),
};
let onion = RecipientOnionFields::secret_only(payment_secret);
let onion = RecipientOnionFields::secret_only(payment_secret, amt);
let res = source.send_payment_with_route(route, payment_hash, onion, payment_id);
match res {
Err(err) => {
Expand Down
4 changes: 2 additions & 2 deletions fuzz/src/full_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ pub fn do_test(mut data: &[u8], logger: &Arc<dyn Logger>) {
payments_sent += 1;
let _ = channelmanager.send_payment(
payment_hash,
RecipientOnionFields::spontaneous_empty(),
RecipientOnionFields::spontaneous_empty(final_value_msat),
PaymentId(payment_hash.0),
params,
Retry::Attempts(2),
Expand All @@ -763,7 +763,7 @@ pub fn do_test(mut data: &[u8], logger: &Arc<dyn Logger>) {
payments_sent += 1;
let _ = channelmanager.send_payment(
payment_hash,
RecipientOnionFields::secret_only(payment_secret),
RecipientOnionFields::secret_only(payment_secret, final_value_msat),
PaymentId(payment_hash.0),
params,
Retry::Attempts(2),
Expand Down
6 changes: 3 additions & 3 deletions lightning-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ fn process_fields(group: Group) -> proc_macro::TokenStream {
if let TokenTree::Group(group) = ty_info {
let first_group_tok = group.stream().into_iter().next().unwrap();
if let TokenTree::Ident(ident) = first_group_tok {
if ident.to_string() == "legacy" {
if ident.to_string() == "legacy" || ident.to_string() == "custom" {
continue;
}
}
Expand All @@ -155,13 +155,13 @@ fn process_fields(group: Group) -> proc_macro::TokenStream {
computed_fields
}

/// Scans a match statement for legacy fields which should be skipped.
/// Scans a match statement for legacy or custom fields which should be skipped.
///
/// This is used internally in LDK's TLV serialization logic and is not expected to be used by
/// other crates.
///
/// Wraps a `match self {..}` statement and scans the fields in the match patterns (in the form
/// `ref $field_name: $field_ty`) for types marked `legacy`, skipping those fields.
/// `ref $field_name: $field_ty`) for types marked `legacy` or `custom`, skipping those fields.
///
/// Specifically, it expects input like the following, simply dropping `field3` and the
/// `: $field_ty` after each field name.
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/chain/channelmonitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6845,7 +6845,7 @@ mod tests {
// the update through to the ChannelMonitor which will refuse it (as the channel is closed).
let (route, payment_hash, _, payment_secret) = get_route_and_payment_hash!(nodes[1], nodes[0], 100_000);
nodes[1].node.send_payment_with_route(route, payment_hash,
RecipientOnionFields::secret_only(payment_secret), PaymentId(payment_hash.0)
RecipientOnionFields::secret_only(payment_secret, 100_000), PaymentId(payment_hash.0)
).unwrap();
check_added_monitors(&nodes[1], 1);

Expand Down
9 changes: 5 additions & 4 deletions lightning/src/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ use crate::types::payment::{PaymentHash, PaymentPreimage, PaymentSecret};
use crate::types::string::UntrustedString;
use crate::util::errors::APIError;
use crate::util::ser::{
BigSize, FixedLengthReader, MaybeReadable, Readable, RequiredWrapper, UpgradableRequired,
WithoutLength, Writeable, Writer,
BigSize, FixedLengthReader, MaybeReadable, Readable, ReadableArgs, RequiredWrapper,
UpgradableRequired, WithoutLength, Writeable, Writer,
};

use crate::io;
Expand Down Expand Up @@ -2398,7 +2398,7 @@ impl MaybeReadable for Event {
(6, _user_payment_id, option),
(7, claim_deadline, option),
(8, payment_preimage, option),
(9, onion_fields, option),
(9, onion_fields, (option: ReadableArgs, amount_msat)),
(10, counterparty_skimmed_fee_msat_opt, option),
(11, payment_context, option),
(13, payment_id, option),
Expand Down Expand Up @@ -2724,7 +2724,8 @@ impl MaybeReadable for Event {
(4, amount_msat, required),
(5, htlcs, optional_vec),
(7, sender_intended_total_msat, option),
(9, onion_fields, option),
(9, onion_fields, (option: ReadableArgs,
sender_intended_total_msat.unwrap_or(amount_msat))),
(11, payment_id, option),
});
Ok(Some(Event::PaymentClaimed {
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/ln/accountable_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn test_accountable_forwarding_with_override(
PaymentParameters::from_node_id(nodes[2].node.get_our_node_id(), TEST_FINAL_CLTV),
100_000,
);
let onion_fields = RecipientOnionFields::secret_only(payment_secret);
let onion_fields = RecipientOnionFields::secret_only(payment_secret, 100_000);
let payment_id = PaymentId(payment_hash.0);
nodes[0]
.node
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/ln/async_payments_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ fn invalid_keysend_payment_secret() {
.node
.send_spontaneous_payment(
Some(keysend_preimage),
RecipientOnionFields::spontaneous_empty(),
RecipientOnionFields::spontaneous_empty(amt_msat),
PaymentId(keysend_preimage.0),
route_params,
Retry::Attempts(0),
Expand Down
12 changes: 6 additions & 6 deletions lightning/src/ln/async_signer_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ fn do_test_async_commitment_signature_for_commitment_signed_revoke_and_ack(

let (route, our_payment_hash, _our_payment_preimage, our_payment_secret) =
get_route_and_payment_hash!(src, dst, 8000000);
let recipient_fields = RecipientOnionFields::secret_only(our_payment_secret);
let recipient_fields = RecipientOnionFields::secret_only(our_payment_secret, 8000000);
let payment_id = PaymentId(our_payment_hash.0);
src.node
.send_payment_with_route(route, our_payment_hash, recipient_fields, payment_id)
Expand Down Expand Up @@ -528,7 +528,7 @@ fn do_test_async_raa_peer_disconnect(

let (route, our_payment_hash, _our_payment_preimage, our_payment_secret) =
get_route_and_payment_hash!(src, dst, 8000000);
let recipient_fields = RecipientOnionFields::secret_only(our_payment_secret);
let recipient_fields = RecipientOnionFields::secret_only(our_payment_secret, 8000000);
let payment_id = PaymentId(our_payment_hash.0);
src.node
.send_payment_with_route(route, our_payment_hash, recipient_fields, payment_id)
Expand Down Expand Up @@ -677,7 +677,7 @@ fn do_test_async_commitment_signature_peer_disconnect(

let (route, our_payment_hash, _our_payment_preimage, our_payment_secret) =
get_route_and_payment_hash!(src, dst, 8000000);
let recipient_fields = RecipientOnionFields::secret_only(our_payment_secret);
let recipient_fields = RecipientOnionFields::secret_only(our_payment_secret, 8000000);
let payment_id = PaymentId(our_payment_hash.0);
src.node
.send_payment_with_route(route, our_payment_hash, recipient_fields, payment_id)
Expand Down Expand Up @@ -812,7 +812,7 @@ fn do_test_async_commitment_signature_ordering(monitor_update_failure: bool) {
// to the peer.
let (route, payment_hash_2, payment_preimage_2, payment_secret_2) =
get_route_and_payment_hash!(nodes[0], nodes[1], 1000000);
let recipient_fields = RecipientOnionFields::secret_only(payment_secret_2);
let recipient_fields = RecipientOnionFields::secret_only(payment_secret_2, 1000000);
let payment_id = PaymentId(payment_hash_2.0);
nodes[0]
.node
Expand Down Expand Up @@ -1352,14 +1352,14 @@ fn test_no_disconnect_while_async_revoke_and_ack_expecting_remote_commitment_sig
// We'll send a payment from both nodes to each other.
let (route1, payment_hash1, _, payment_secret1) =
get_route_and_payment_hash!(&nodes[0], &nodes[1], payment_amount);
let onion1 = RecipientOnionFields::secret_only(payment_secret1);
let onion1 = RecipientOnionFields::secret_only(payment_secret1, payment_amount);
let payment_id1 = PaymentId(payment_hash1.0);
nodes[0].node.send_payment_with_route(route1, payment_hash1, onion1, payment_id1).unwrap();
check_added_monitors(&nodes[0], 1);

let (route2, payment_hash2, _, payment_secret2) =
get_route_and_payment_hash!(&nodes[1], &nodes[0], payment_amount);
let onion2 = RecipientOnionFields::secret_only(payment_secret2);
let onion2 = RecipientOnionFields::secret_only(payment_secret2, payment_amount);
let payment_id2 = PaymentId(payment_hash2.0);
nodes[1].node.send_payment_with_route(route2, payment_hash2, onion2, payment_id2).unwrap();
check_added_monitors(&nodes[1], 1);
Expand Down
Loading
Loading