Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions common/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion common/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions contrib/msggen/msggen/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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*"
]
}
}
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion doc/schemas/askrene-age.json
Original file line number Diff line number Diff line change
Expand Up @@ -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*"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion doc/schemas/askrene-create-layer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion doc/schemas/askrene-inform-channel.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion doc/schemas/askrene-listlayers.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 0 additions & 3 deletions lightningd/offer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down
3 changes: 1 addition & 2 deletions plugins/askrene/datastore_wire.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions plugins/askrene/datastore_wire.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions plugins/askrene/layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -1212,15 +1212,15 @@ 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. */
tal_steal(tmpctx, intelarr[i].impression);
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. */
Expand Down
5 changes: 3 additions & 2 deletions plugins/libplugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++);
}
Expand Down
10 changes: 8 additions & 2 deletions plugins/offers_invreq_hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Comment thread
Lagrang3 marked this conversation as resolved.
if (until < rel_expiry)
rel_expiry = until;
}
Expand Down