Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BOLT update, including payment metadata support #5086

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ CCANDIR := ccan

# Where we keep the BOLT RFCs
BOLTDIR := ../lightning-rfc/
DEFAULT_BOLTVERSION := 498f104fd399488c77f449d05cb21c0b604636a2
DEFAULT_BOLTVERSION := c876dac2b5038f6499154d0a739240b6ff5db70d
# Can be overridden on cmdline.
BOLTVERSION := $(DEFAULT_BOLTVERSION)

Expand Down
4 changes: 2 additions & 2 deletions common/htlc_tx.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static inline struct amount_sat htlc_timeout_fee(u32 feerate_per_kw,
*
* The fee for an HTLC-timeout transaction:
*...
* - Otherwise, MUST BE calculated to match:
* - Otherwise, MUST be calculated to match:
* 1. Multiply `feerate_per_kw` by 663 (666 if `option_anchor_outputs`
* applies) and divide by 1000 (rounding down).
*/
Expand All @@ -40,7 +40,7 @@ static inline struct amount_sat htlc_success_fee(u32 feerate_per_kw,
*
* The fee for an HTLC-success transaction:
*...
* - MUST BE calculated to match:
* - Otherwise, MUST be calculated to match:
* 1. Multiply `feerate_per_kw` by 703 (706 if `option_anchor_outputs`
* applies) and divide by 1000 (rounding down).
*/
Expand Down
96 changes: 61 additions & 35 deletions common/test/run-bolt11.c

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions lightningd/peer_htlcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -810,8 +810,6 @@ static u8 *convert_failcode(const tal_t *ctx,
return towire_permanent_node_failure(ctx);
case WIRE_REQUIRED_NODE_FEATURE_MISSING:
return towire_required_node_feature_missing(ctx);
case WIRE_CHANNEL_DISABLED:
return towire_channel_disabled(ctx);
case WIRE_PERMANENT_CHANNEL_FAILURE:
return towire_permanent_channel_failure(ctx);
case WIRE_REQUIRED_CHANNEL_FEATURE_MISSING:
Expand Down
16 changes: 8 additions & 8 deletions onchaind/onchaind.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,16 +410,16 @@ static bool grind_htlc_tx_fee(struct amount_sat *fee,
*
* The fee for an HTLC-timeout transaction:
* - If `option_anchors_zero_fee_htlc_tx` applies:
* 1. MUST BE 0.
* - Otherwise, MUST BE calculated to match:
* 1. MUST be 0.
* - Otherwise, MUST be calculated to match:
* 1. Multiply `feerate_per_kw` by 663
* (666 if `option_anchor_outputs` applies)
* and divide by 1000 (rounding down).
*
* The fee for an HTLC-success transaction:
* - If `option_anchors_zero_fee_htlc_tx` applies:
* 1. MUST BE 0.
* - MUST BE calculated to match:
* 1. MUST be 0.
* - Otherwise, MUST be calculated to match:
* 1. Multiply `feerate_per_kw` by 703
* (706 if `option_anchor_outputs` applies)
* and divide by 1000 (rounding down).
Expand Down Expand Up @@ -461,8 +461,8 @@ static bool set_htlc_timeout_fee(struct bitcoin_tx *tx,
*
* The fee for an HTLC-timeout transaction:
* - If `option_anchors_zero_fee_htlc_tx` applies:
* 1. MUST BE 0.
* - Otherwise, MUST BE calculated to match:
* 1. MUST be 0.
* - Otherwise, MUST be calculated to match:
* 1. Multiply `feerate_per_kw` by 663 (666 if `option_anchor_outputs`
* applies) and divide by 1000 (rounding down).
*/
Expand Down Expand Up @@ -509,8 +509,8 @@ static void set_htlc_success_fee(struct bitcoin_tx *tx,
*
* The fee for an HTLC-success transaction:
* - If `option_anchors_zero_fee_htlc_tx` applies:
* 1. MUST BE 0.
* - MUST BE calculated to match:
* 1. MUST be 0.
* - Otherwise, MUST be calculated to match:
* 1. Multiply `feerate_per_kw` by 703 (706 if `option_anchor_outputs`
* applies) and divide by 1000 (rounding down).
*/
Expand Down
3 changes: 0 additions & 3 deletions wallet/test/run-wallet.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,9 +711,6 @@ void topology_add_sync_waiter_(const tal_t *ctx UNNEEDED,
void *arg) UNNEEDED,
void *arg UNNEEDED)
{ fprintf(stderr, "topology_add_sync_waiter_ called!\n"); abort(); }
/* Generated stub for towire_channel_disabled */
u8 *towire_channel_disabled(const tal_t *ctx UNNEEDED)
{ fprintf(stderr, "towire_channel_disabled called!\n"); abort(); }
/* Generated stub for towire_channeld_config_channel */
u8 *towire_channeld_config_channel(const tal_t *ctx UNNEEDED, u32 *feerate_base UNNEEDED, u32 *feerate_ppm UNNEEDED, struct amount_msat *htlc_minimum UNNEEDED, struct amount_msat *htlc_maximum UNNEEDED)
{ fprintf(stderr, "towire_channeld_config_channel called!\n"); abort(); }
Expand Down
13 changes: 13 additions & 0 deletions wire/extracted_peer_01_remote_addr.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/wire/peer_wire.csv b/wire/peer_wire.csv
index a028ddc66..4043c6350 100644
--- a/wire/peer_wire.csv
+++ b/wire/peer_wire.csv
@@ -6,6 +6,8 @@ msgdata,init,features,byte,flen
msgdata,init,tlvs,init_tlvs,
tlvtype,init_tlvs,networks,1
tlvdata,init_tlvs,networks,chains,chain_hash,...
+tlvtype,init_tlvs,remote_addr,3
+tlvdata,init_tlvs,remote_addr,remote_addr,wireaddr,
msgtype,error,17
msgdata,error,channel_id,channel_id,
msgdata,error,len,u16,
3 changes: 3 additions & 0 deletions wire/onion_wire.csv
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ msgdata,final_incorrect_cltv_expiry,cltv_expiry,u32,
msgtype,final_incorrect_htlc_amount,19
msgdata,final_incorrect_htlc_amount,incoming_htlc_amt,u64,
msgtype,channel_disabled,UPDATE|20
msgdata,channel_disabled,flags,u16,
msgdata,channel_disabled,len,u16,
msgdata,channel_disabled,channel_update,byte,len
msgtype,expiry_too_far,21
msgtype,invalid_onion_payload,PERM|22
msgdata,invalid_onion_payload,type,bigsize,
Expand Down
2 changes: 1 addition & 1 deletion wire/tlvstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static struct tlv_field *tlvstream_get_raw(struct tlv_field *stream, u64 type)
return NULL;
}

void tlvstream_set_raw(struct tlv_field **stream, u64 type, void *value TAKES, size_t valuelen)
void tlvstream_set_raw(struct tlv_field **stream, u64 type, const void *value TAKES, size_t valuelen)
{
struct tlv_field f, *e = tlvstream_get_raw(*stream, type);

Expand Down
2 changes: 1 addition & 1 deletion wire/tlvstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ size_t tlv_field_offset(const u8 *tlvstream, size_t tlvlen, u64 fieldtype);
extern const u64 *FROMWIRE_TLV_ANY_TYPE;

/* Generic primitive setters for tlvstreams. */
void tlvstream_set_raw(struct tlv_field **stream, u64 type, void *value TAKES, size_t valuelen);
void tlvstream_set_raw(struct tlv_field **stream, u64 type, const void *value TAKES, size_t valuelen);
void tlvstream_set_short_channel_id(struct tlv_field **stream, u64 type,
struct short_channel_id *value);
void tlvstream_set_tu64(struct tlv_field **stream, u64 type, u64 value);
Expand Down