This commit is contained in:
w3lld1 2026-08-13 01:52:12 +09:30 committed by GitHub
commit 4c6f629fdf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 29 additions and 27 deletions

View file

@ -137,7 +137,7 @@ void clean_tmpctx(void)
void tal_arr_remove_(void *p, size_t elemsize, size_t n)
{
// p is a pointer-to-pointer for tal_resize.
/* p is a pointer-to-pointer for tal_resize. */
char *objp = *(char **)p;
size_t len = tal_bytelen(objp);
assert(len % elemsize == 0);
@ -149,7 +149,7 @@ void tal_arr_remove_(void *p, size_t elemsize, size_t n)
void tal_arr_remove_range_(void *p, size_t position, size_t chunk_size)
{
// p is a pointer-to-pointer for tal_resize.
/* p is a pointer-to-pointer for tal_resize. */
char *objp = *(char **)p;
size_t len = tal_bytelen(objp);
assert(chunk_size + position <= len);

View file

@ -87,7 +87,7 @@ bool tal_arr_eq_(const void *a, const void *b, size_t unused);
void tal_arr_remove_(void *p, size_t elemsize, size_t n);
/**
* Remove a range of element from an array
* Remove a range of elements from an array
*
* This will shift the elements past the removed elements, changing
* their position in memory, so only use this for simple arrays.

View file

@ -241,7 +241,7 @@
"num_removed": {
"type": "u64",
"description": [
"The number of constraints removed from *layer*"
"The number of constraints and impressions removed from *layer*"
]
}
}
@ -928,7 +928,7 @@
"timestamp": {
"type": "u64",
"description": [
"The UNIX timestamp when this constraint was created."
"The UNIX timestamp when this impression was created."
]
},
"amount_msat": {
@ -1267,7 +1267,7 @@
"timestamp": {
"type": "u64",
"description": [
"The UNIX timestamp when this constraint was created."
"The UNIX timestamp when this impression was created."
]
},
"amount_msat": {
@ -1542,7 +1542,7 @@
"timestamp": {
"type": "u64",
"description": [
"The UNIX timestamp when this constraint was created."
"The UNIX timestamp when this impression was created."
]
},
"amount_msat": {

View file

@ -44,7 +44,7 @@
"num_removed": {
"type": "u64",
"description": [
"The number of constraints removed from *layer*"
"The number of constraints and impressions removed from *layer*"
]
}
}

View file

@ -218,7 +218,7 @@
"timestamp": {
"type": "u64",
"description": [
"The UNIX timestamp when this constraint was created."
"The UNIX timestamp when this impression was created."
]
},
"amount_msat": {

View file

@ -127,7 +127,7 @@
"timestamp": {
"type": "u64",
"description": [
"The UNIX timestamp when this constraint was created."
"The UNIX timestamp when this impression was created."
]
},
"amount_msat": {

View file

@ -220,7 +220,7 @@
"timestamp": {
"type": "u64",
"description": [
"The UNIX timestamp when this constraint was created."
"The UNIX timestamp when this impression was created."
]
},
"amount_msat": {

View file

@ -377,7 +377,6 @@ static struct command_result *json_createinvoicerequest(struct command *cmd,
struct tlv_invoice_request *invreq;
struct json_escape *label;
struct json_stream *response;
u64 *prev_basetime = NULL;
struct sha256 merkle;
bool *save, *single_use;
enum offer_status status;
@ -448,8 +447,6 @@ static struct command_result *json_createinvoicerequest(struct command *cmd,
b12str,
label,
status);
if (prev_basetime)
json_add_u64(response, "previous_basetime", *prev_basetime);
return command_success(cmd, response);
}

View file

@ -216,8 +216,7 @@ void towire_dstore_channel_constraint(u8 **data,
towire_opt_amount_msat(data, max);
}
bool fromwire_dstore_channel_impression(const tal_t *ctx,
const u8 **cursor, size_t *len,
bool fromwire_dstore_channel_impression(const u8 **cursor, size_t *len,
struct short_channel_id_dir *scidd,
u64 *timestamp,
struct amount_msat *amount)

View file

@ -61,8 +61,7 @@ void towire_dstore_channel_constraint(u8 **data,
const struct amount_msat *min,
const struct amount_msat *max);
bool fromwire_dstore_channel_impression(const tal_t *ctx,
const u8 **cursor, size_t *len,
bool fromwire_dstore_channel_impression(const u8 **cursor, size_t *len,
struct short_channel_id_dir *scidd,
u64 *timestamp,
struct amount_msat *amount);

View file

@ -669,7 +669,7 @@ static void load_channel_impression(struct plugin *plugin,
struct amount_msat amount;
u64 timestamp;
if (fromwire_dstore_channel_impression(tmpctx, cursor, len,
if (fromwire_dstore_channel_impression(cursor, len,
&scidd, &timestamp,
&amount))
add_impression(layer, &scidd, timestamp, amount);
@ -1139,9 +1139,9 @@ void layer_apply_constraints(const struct layer *layer,
} else {
/* We made the other way? Capacity has increased */
if (!amount_msat_add(min, *min, imp->amount))
*min = AMOUNT_MSAT(-1ULL);
*min = AMOUNT_MSAT(UINT64_MAX);
if (!amount_msat_add(max, *max, imp->amount))
*max = AMOUNT_MSAT(-1ULL);
*max = AMOUNT_MSAT(UINT64_MAX);
}
}
}
@ -1212,7 +1212,7 @@ size_t layer_trim_constraints(struct layer *layer, u64 cutoff)
/* We assume the array is sorted by timestamp */
for (size_t i = 0; i < tal_count(intelarr); i++) {
if (channel_intel_timestamp(&intelarr[i]) >= cutoff)
continue;
break;
count_old++;
/* The pointer inside channel_intel has to be freed. */
@ -1220,7 +1220,7 @@ size_t layer_trim_constraints(struct layer *layer, u64 cutoff)
tal_steal(tmpctx, intelarr[i].constraint);
}
num_removed += count_old;
if(count_old){
if (count_old) {
/* Remove from table before realloc!
* Removing elements from the table is safe during
* iteration. */

View file

@ -344,9 +344,10 @@ static const char *json_id(const tal_t *ctx, struct plugin *plugin,
const char *method, const char *prefix)
{
/* Don't create weird IDs, they will get escaped and we won't match the reply. */
if (json_escape_needed(method, strlen(method)) ||
json_escape_needed(prefix, strlen(prefix)))
if (json_escape_needed(method, strlen(method)))
method = "!weird!";
if (json_escape_needed(prefix, strlen(prefix)))
prefix = "!weird!";
return tal_fmt(ctx, "%s/%s:%s#%"PRIu64,
prefix, plugin->id, method, plugin->next_outreq_id++);
}

View file

@ -791,8 +791,14 @@ static struct command_result *handle_amount_and_recurrence(struct command *cmd,
/* Don't allow invoices past expiry of offer. */
if (ir->invreq->offer_absolute_expiry) {
u64 until = *ir->invreq->offer_absolute_expiry
- *ir->inv->invoice_created_at;
u64 until;
if (*ir->invreq->offer_absolute_expiry
> *ir->inv->invoice_created_at)
until = *ir->invreq->offer_absolute_expiry
- *ir->inv->invoice_created_at;
else
until = 1;
if (until < rel_expiry)
rel_expiry = until;
}