Skip to content

Commit 7338932

Browse files
authored
Merge branch 'master' into bolt12_offer_issuer_id
2 parents c9c674f + 2811614 commit 7338932

File tree

204 files changed

+1366
-780
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+1366
-780
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
> [!IMPORTANT]
2-
> 25.02 FREEZE JANUARY 31ST: Non-bugfix PRs not ready by this date will wait for 25.05.
2+
>
3+
> 25.05 FREEZE MAY 12TH: Non-bugfix PRs not ready by this date will wait for 25.08.
4+
>
5+
> RC1 is scheduled on _May 23rd_, RC2 on _May 26th_, ...
6+
>
7+
> The final release is on MAY 29TH.
8+
39

410
## Checklist
511
Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked:

.github/workflows/readme-rpc-sync.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- 'master'
77
paths:
8-
- 'doc/schemas/lightning-*.json'
8+
- 'doc/schemas/*.json'
99
- 'doc/*.1.md'
1010
- 'doc/*.5.md'
1111
- 'doc/*.8.md'

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
- name: Git checkout
3131
uses: actions/checkout@v4
3232
with:
33+
ref: ${{ github.ref }}
34+
fetch-depth: 0
3335
fetch-tags: true
3436

3537
- name: Determine version

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ tests/plugins/test_selfdisable_after_getmanifest
5757

5858
# Ignore generated files
5959
devtools/features
60-
doc/schemas/lightning-sql.json
61-
doc/lightning-*.7.md
62-
doc/lightning*.[1578]
60+
doc/schemas/sql.json
61+
doc/*.7.md
62+
doc/*.[1578]
6363
doc/reckless*.[1578]
6464
*_sqlgen.[ch]
6565
*_wiregen.[ch]

.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
# Ruff version.
4+
rev: v0.8.0
5+
hooks:
6+
# Run the linter.
7+
- id: ruff
8+
args: [ --diff ]
9+
exclude: "contrib/pyln-grpc-proto/pyln/grpc/(primitives|node)_pb2(|_grpc).py"
10+
# Run the formatter.
11+
- id: ruff-format
12+
args: [ --diff ]
13+
exclude: "contrib/pyln-grpc-proto/pyln/grpc/(primitives|node)_pb2(|_grpc).py"

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,7 @@ install-program: installdirs $(BIN_PROGRAMS) $(PKGLIBEXEC_PROGRAMS) $(PLUGINS) $
816816
@$(NORMAL_INSTALL)
817817
$(INSTALL_PROGRAM) $(BIN_PROGRAMS) $(DESTDIR)$(bindir)
818818
$(INSTALL_PROGRAM) $(PKGLIBEXEC_PROGRAMS) $(DESTDIR)$(pkglibexecdir)
819+
@if [ -d "$(DESTDIR)$(plugindir)/clnrest" ]; then rm -rf $(DESTDIR)$(plugindir)/clnrest; fi
819820
[ -z "$(PLUGINS)" ] || $(INSTALL_PROGRAM) $(PLUGINS) $(DESTDIR)$(plugindir)
820821
for PY in $(PY_PLUGINS); do DIR=`dirname $$PY`; DST=$(DESTDIR)$(plugindir)/`basename $$DIR`; if [ -d $$DST ]; then rm -rf $$DST; fi; $(INSTALL_PROGRAM) -d $$DIR; cp -a $$DIR $$DST ; done
821822

common/bolt11.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ static const char *decode_f(struct bolt11 *b11,
420420
"f: witness v1 bad length %zu",
421421
tal_count(f));
422422
}
423-
if (tal_count(f) > 40) {
423+
if (tal_count(f) > 40 || tal_count(f) < 2) {
424424
return tal_fmt(b11,
425425
"f: witness v%"PRIu64" bad length %zu",
426426
version,

common/gossmap.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -551,10 +551,11 @@ static void fill_from_update(struct gossmap *map,
551551
|| hc->delay != delay) {
552552
hc->htlc_max = 0;
553553
hc->enabled = false;
554-
logcb(cbarg, LOG_DBG,
555-
"Bad cupdate for %s, ignoring (delta=%u, fee=%u/%u)",
556-
fmt_short_channel_id_dir(tmpctx, scidd),
557-
delay, base_fee, proportional_fee);
554+
if (logcb)
555+
logcb(cbarg, LOG_DBG,
556+
"Bad cupdate for %s, ignoring (delta=%u, fee=%u/%u)",
557+
fmt_short_channel_id_dir(tmpctx, scidd),
558+
delay, base_fee, proportional_fee);
558559
}
559560
}
560561

common/trace.c

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
#include <common/trace.h>
1111
#include <sodium/randombytes.h>
1212
#include <stdio.h>
13+
#include <unistd.h>
1314

1415
#if HAVE_USDT
15-
#include <sys/sdt.h>
16+
#include <sys/sdt.h>
1617

1718
#define MAX_ACTIVE_SPANS 128
1819

@@ -40,6 +41,7 @@
4041
#endif
4142

4243
const char *trace_service_name = "lightningd";
44+
static bool disable_trace = false;
4345

4446
struct span_tag {
4547
char *name, *value;
@@ -176,6 +178,9 @@ static struct span *trace_span_find(size_t key)
176178
return NULL;
177179
}
178180

181+
/* FIXME: Forward declaration for minimal patch size */
182+
static void trace_span_clear(struct span *s);
183+
179184
/**
180185
* Find an empty slot for a new span.
181186
*/
@@ -187,7 +192,13 @@ static struct span *trace_span_slot(void)
187192

188193
/* Might end up here if we have more than MAX_ACTIVE_SPANS
189194
* concurrent spans. */
190-
assert(s);
195+
if (!s) {
196+
fprintf(stderr, "%u: out of spans, disabling tracing\n", getpid());
197+
for (size_t i = 0; i < MAX_ACTIVE_SPANS; i++)
198+
trace_span_clear(&active_spans[i]);
199+
disable_trace = true;
200+
return NULL;
201+
}
191202
assert(s->parent == NULL);
192203

193204
/* Be extra careful not to create cycles. If we return the
@@ -260,11 +271,15 @@ void trace_span_start(const char *name, const void *key)
260271
size_t numkey = trace_key(key);
261272
struct timeabs now = time_now();
262273

274+
if (disable_trace)
275+
return;
263276
trace_init();
264277
trace_check_tree();
265278

266279
assert(trace_span_find(numkey) == NULL);
267280
struct span *s = trace_span_slot();
281+
if (!s)
282+
return;
268283
s->key = numkey;
269284
randombytes_buf(s->id, SPAN_ID_SIZE);
270285
s->start_time = (now.ts.tv_sec * 1000000) + now.ts.tv_nsec / 1000;
@@ -293,6 +308,9 @@ void trace_span_remote(u8 trace_id[TRACE_ID_SIZE], u8 span_id[SPAN_ID_SIZE])
293308

294309
void trace_span_end(const void *key)
295310
{
311+
if (disable_trace)
312+
return;
313+
296314
size_t numkey = trace_key(key);
297315
struct span *s = trace_span_find(numkey);
298316
assert(s && "Span to end not found");
@@ -323,6 +341,9 @@ void trace_span_end(const void *key)
323341

324342
void trace_span_tag(const void *key, const char *name, const char *value)
325343
{
344+
if (disable_trace)
345+
return;
346+
326347
size_t numkey = trace_key(key);
327348
struct span *span = trace_span_find(numkey);
328349
assert(span);
@@ -341,6 +362,9 @@ void trace_span_tag(const void *key, const char *name, const char *value)
341362

342363
void trace_span_suspend_(const void *key, const char *lbl)
343364
{
365+
if (disable_trace)
366+
return;
367+
344368
size_t numkey = trace_key(key);
345369
struct span *span = trace_span_find(numkey);
346370
TRACE_DBG("Suspending span %s (%zu)\n", current->name, current->key);
@@ -349,8 +373,33 @@ void trace_span_suspend_(const void *key, const char *lbl)
349373
DTRACE_PROBE1(lightningd, span_suspend, span->id);
350374
}
351375

376+
static void destroy_trace_span(const void *key)
377+
{
378+
size_t numkey = trace_key(key);
379+
struct span *span = trace_span_find(numkey);
380+
381+
/* It's usually ended normally. */
382+
if (!span)
383+
return;
384+
385+
/* Otherwise resume so we can terminate it */
386+
trace_span_resume(key);
387+
trace_span_end(key);
388+
}
389+
390+
void trace_span_suspend_may_free_(const void *key, const char *lbl)
391+
{
392+
if (disable_trace)
393+
return;
394+
trace_span_suspend_(key, lbl);
395+
tal_add_destructor(key, destroy_trace_span);
396+
}
397+
352398
void trace_span_resume_(const void *key, const char *lbl)
353399
{
400+
if (disable_trace)
401+
return;
402+
354403
size_t numkey = trace_key(key);
355404
current = trace_span_find(numkey);
356405
TRACE_DBG("Resuming span %s (%zu)\n", current->name, current->key);
@@ -368,6 +417,7 @@ void trace_cleanup(void)
368417
void trace_span_start(const char *name, const void *key) {}
369418
void trace_span_end(const void *key) {}
370419
void trace_span_suspend_(const void *key, const char *lbl) {}
420+
void trace_span_suspend_may_free_(const void *key, const char *lbl) {}
371421
void trace_span_resume_(const void *key, const char *lbl) {}
372422
void trace_span_tag(const void *key, const char *name, const char *value) {}
373423
void trace_cleanup(void) {}

common/trace.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ void trace_span_remote(u8 trace_id[TRACE_ID_SIZE], u8 span_id[SPAN_ID_SIZE]);
1515

1616
#define TRACE_LBL __FILE__ ":" stringify(__LINE__)
1717
void trace_span_suspend_(const void *key, const char *lbl);
18+
void trace_span_suspend_may_free_(const void *key, const char *lbl);
1819
void trace_span_resume_(const void *key, const char *lbl);
1920
#define trace_span_suspend(key) trace_span_suspend_(key, TRACE_LBL)
21+
#define trace_span_suspend_may_free(key) trace_span_suspend_may_free_(key, TRACE_LBL)
2022
#define trace_span_resume(key) trace_span_resume_(key, TRACE_LBL)
2123

2224
#endif /* LIGHTNING_COMMON_TRACE_H */

0 commit comments

Comments
 (0)