Skip to content

Commit 780f32d

Browse files
committed
global: remove deprecated non-msat-named msat fields.
Signed-off-by: Rusty Russell <[email protected]> Changelog-Removed: JSON-RPC: all the non-msat-named millisatoshi fields deprecated in v0.12.0.
1 parent 67f23c1 commit 780f32d

27 files changed

+96
-288
lines changed

cln-grpc/proto/node.proto

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cln-grpc/src/convert.rs

-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cln-grpc/src/test.rs

-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ fn test_getinfo() {
244244
"version": "v0.10.2-509-ged26651-modded",
245245
"blockheight": 103,
246246
"network": "regtest",
247-
"msatoshi_fees_collected": 0,
248247
"fees_collected_msat": "0msat", "lightning-dir": "/tmp/ltests-20irp76f/test_pay_variants_1/lightning-1/regtest",
249248
"our_features": {"init": "8808226aa2", "node": "80008808226aa2", "channel": "", "invoice": "024200"}});
250249
let u: cln_rpc::model::GetinfoResponse = serde_json::from_value(j.clone()).unwrap();

cln-rpc/src/model.rs

-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/bolt11_json.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ void json_add_bolt11(struct json_stream *response,
5151
json_add_u64(response, "expiry", b11->expiry);
5252
json_add_node_id(response, "payee", &b11->receiver_id);
5353
if (b11->msat)
54-
json_add_amount_msat_compat(response, *b11->msat,
55-
"msatoshi", "amount_msat");
54+
json_add_amount_msat(response, "amount_msat", *b11->msat);
5655
if (b11->description)
5756
json_add_string(response, "description", b11->description);
5857
if (b11->description_hash)

common/json_stream.c

-36
Original file line numberDiff line numberDiff line change
@@ -589,16 +589,6 @@ void json_add_psbt(struct json_stream *stream,
589589
tal_free(psbt);
590590
}
591591

592-
void json_add_amount_msat_compat(struct json_stream *result,
593-
struct amount_msat msat,
594-
const char *rawfieldname,
595-
const char *msatfieldname)
596-
{
597-
if (deprecated_apis)
598-
json_add_u64(result, rawfieldname, msat.millisatoshis); /* Raw: low-level helper */
599-
json_add_amount_msat_only(result, msatfieldname, msat);
600-
}
601-
602592
void json_add_amount_msat_only(struct json_stream *result,
603593
const char *msatfieldname,
604594
struct amount_msat msat)
@@ -612,16 +602,6 @@ void json_add_amount_msat_only(struct json_stream *result,
612602
json_add_u64(result, msatfieldname, msat.millisatoshis); /* Raw: low-level helper */
613603
}
614604

615-
void json_add_amount_sat_compat(struct json_stream *result,
616-
struct amount_sat sat,
617-
const char *rawfieldname,
618-
const char *msatfieldname)
619-
{
620-
if (deprecated_apis)
621-
json_add_u64(result, rawfieldname, sat.satoshis); /* Raw: low-level helper */
622-
json_add_amount_sat_msat(result, msatfieldname, sat);
623-
}
624-
625605
void json_add_amount_sat_msat(struct json_stream *result,
626606
const char *msatfieldname,
627607
struct amount_sat sat)
@@ -632,22 +612,6 @@ void json_add_amount_sat_msat(struct json_stream *result,
632612
json_add_amount_msat_only(result, msatfieldname, msat);
633613
}
634614

635-
/* When I noticed that we were adding "XXXmsat" fields *not* ending in _msat */
636-
void json_add_amount_sats_deprecated(struct json_stream *result,
637-
const char *fieldname,
638-
const char *msatfieldname,
639-
struct amount_sat sat)
640-
{
641-
if (deprecated_apis) {
642-
struct amount_msat msat;
643-
assert(!strends(fieldname, "_msat"));
644-
if (amount_sat_to_msat(&msat, sat))
645-
json_add_string(result, fieldname,
646-
take(fmt_amount_msat(NULL, msat)));
647-
}
648-
json_add_amount_sat_msat(result, msatfieldname, sat);
649-
}
650-
651615
void json_add_sats(struct json_stream *result,
652616
const char *fieldname,
653617
struct amount_sat sat)

common/json_stream.h

+2-26
Original file line numberDiff line numberDiff line change
@@ -324,45 +324,21 @@ void json_add_address_internal(struct json_stream *response,
324324
const char *fieldname,
325325
const struct wireaddr_internal *addr);
326326

327-
/* Adds both a 'raw' number field and an 'amount_msat' field */
328-
void json_add_amount_msat_compat(struct json_stream *result,
329-
struct amount_msat msat,
330-
const char *rawfieldname,
331-
const char *msatfieldname)
332-
NO_NULL_ARGS;
333-
334-
/* Adds both a 'raw' number field and an 'amount_msat' field */
335-
void json_add_amount_sat_compat(struct json_stream *result,
336-
struct amount_sat sat,
337-
const char *rawfieldname,
338-
const char *msatfieldname)
339-
NO_NULL_ARGS;
340-
341327
/* Adds an 'msat' field */
342328
void json_add_amount_msat_only(struct json_stream *result,
343329
const char *msatfieldname,
344330
struct amount_msat msat)
345331
NO_NULL_ARGS;
346332

347-
/* Adds an 'msat' field */
348-
void json_add_amount_sat_only(struct json_stream *result,
349-
const char *msatfieldname,
350-
struct amount_sat sat)
351-
NO_NULL_ARGS;
333+
/* Compat shim */
334+
#define json_add_amount_msat json_add_amount_msat_only
352335

353336
/* Adds an 'msat' field */
354337
void json_add_amount_sat_msat(struct json_stream *result,
355338
const char *msatfieldname,
356339
struct amount_sat sat)
357340
NO_NULL_ARGS;
358341

359-
/* Adds an 'msat' field, and an older deprecated field. */
360-
void json_add_amount_sats_deprecated(struct json_stream *result,
361-
const char *fieldname,
362-
const char *msatfieldname,
363-
struct amount_sat sat)
364-
NO_NULL_ARGS;
365-
366342
/* This is used to create requests, *never* for output (output is always
367343
* msat!) */
368344
void json_add_sats(struct json_stream *result,

common/test/run-json_stream-filter.c

-3
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ struct json_filter **command_filter_ptr(struct command *cmd UNNEEDED)
5757
{ fprintf(stderr, "command_filter_ptr called!\n"); abort(); }
5858
/* Generated stub for deprecated_apis */
5959
bool deprecated_apis;
60-
/* Generated stub for fmt_amount_msat */
61-
const char *fmt_amount_msat(const tal_t *ctx UNNEEDED, struct amount_msat msat UNNEEDED)
62-
{ fprintf(stderr, "fmt_amount_msat called!\n"); abort(); }
6360
/* Generated stub for fmt_amount_sat */
6461
const char *fmt_amount_sat(const tal_t *ctx UNNEEDED, struct amount_sat sat UNNEEDED)
6562
{ fprintf(stderr, "fmt_amount_sat called!\n"); abort(); }

contrib/pyln-testing/pyln/testing/grpc2py.py

-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ def getinfo2py(m):
5959
"lightning_dir": m.lightning_dir, # PrimitiveField in generate_composite
6060
"blockheight": m.blockheight, # PrimitiveField in generate_composite
6161
"network": m.network, # PrimitiveField in generate_composite
62-
"msatoshi_fees_collected": m.msatoshi_fees_collected, # PrimitiveField in generate_composite
6362
"fees_collected_msat": amount2msat(m.fees_collected_msat), # PrimitiveField in generate_composite
6463
"address": [getinfo_address2py(i) for i in m.address], # ArrayField[composite] in generate_composite
6564
"binding": [getinfo_binding2py(i) for i in m.binding], # ArrayField[composite] in generate_composite
@@ -787,7 +786,6 @@ def getroute_route2py(m):
787786
"id": hexlify(m.id), # PrimitiveField in generate_composite
788787
"channel": m.channel, # PrimitiveField in generate_composite
789788
"direction": m.direction, # PrimitiveField in generate_composite
790-
"msatoshi": m.msatoshi, # PrimitiveField in generate_composite
791789
"amount_msat": amount2msat(m.amount_msat), # PrimitiveField in generate_composite
792790
"delay": m.delay, # PrimitiveField in generate_composite
793791
"style": str(m.style), # EnumField in generate_composite

doc/lightning-getinfo.7.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ On success, an object is returned, containing:
5252
- **node** (hex): features in our node\_announcement message
5353
- **channel** (hex): negotiated channel features we (as channel initiator) publish in the channel\_announcement message
5454
- **invoice** (hex): features in our BOLT11 invoices
55-
- **msatoshi\_fees\_collected** (u64, optional) **deprecated, removal in v23.05**
5655
- **binding** (array of objects, optional): The addresses we are listening on:
5756
- **type** (string): Type of connection (one of "local socket", "ipv4", "ipv6", "torv2", "torv3")
5857
- **address** (string, optional): address in expected format for **type**
@@ -133,4 +132,4 @@ RESOURCES
133132

134133
Main web site: <https://github.com/ElementsProject/lightning>
135134

136-
[comment]: # ( SHA256STAMP:5c7c4d6279279b6c92cd3b039dcb24429214b2460a6ad82bed384796389a9b5c)
135+
[comment]: # ( SHA256STAMP:ac7ea19a5294ebb8d8e0acaa3e813849ce1b1f7f8ef2f3e52a9ca22e5e5d82fc)

doc/lightning-getroute.7.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ On success, an object containing **route** is returned. It is an array of objec
286286
- **amount\_msat** (msat): The amount expected by the node at the end of this hop
287287
- **delay** (u32): The total CLTV expected by the node at the end of this hop
288288
- **style** (string): The features understood by the destination node (always "tlv")
289-
- **msatoshi** (u64, optional) **deprecated, removal in v23.05**
290289

291290
[comment]: # (GENERATE-FROM-SCHEMA-END)
292291

@@ -311,4 +310,4 @@ RESOURCES
311310

312311
Main web site: <https://github.com/ElementsProject/lightning>
313312

314-
[comment]: # ( SHA256STAMP:336fb7d687a26e733ca0cc5f0ca49fb00edfaf311edc43773375201b1180f716)
313+
[comment]: # ( SHA256STAMP:9ef1e1107c9b649e3e1c17593e3b1855852e60060c70ed6b13ff73b5575cffad)

doc/schemas/getinfo.schema.json

-4
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@
9494
"type": "string",
9595
"description": "represents the type of network on the node are working (e.g: `bitcoin`, `testnet`, or `regtest`)"
9696
},
97-
"msatoshi_fees_collected": {
98-
"type": "u64",
99-
"deprecated": "v0.12.0"
100-
},
10197
"fees_collected_msat": {
10298
"type": "msat",
10399
"description": "Total routing fees collected by this node"

doc/schemas/getroute.schema.json

-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@
3232
"type": "u32",
3333
"description": "0 if this channel is traversed from lesser to greater **id**, otherwise 1"
3434
},
35-
"msatoshi": {
36-
"type": "u64",
37-
"deprecated": "v0.12.0"
38-
},
3935
"amount_msat": {
4036
"type": "msat",
4137
"description": "The amount expected by the node at the end of this hop"

lightningd/dual_open_control.c

+7-11
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,9 @@ void json_add_unsaved_channel(struct json_stream *response,
150150
/* funding + our_upfront_shutdown only available if we're initiator */
151151
if (oa->role == TX_INITIATOR) {
152152
if (amount_sat_to_msat(&total, oa->funding)) {
153-
json_add_amount_msat_compat(response, total,
154-
"msatoshi_to_us",
155-
"to_us_msat");
153+
json_add_amount_msat(response, "to_us_msat", total);
156154
/* This will change if peer adds funds */
157-
json_add_amount_msat_compat(response, total,
158-
"msatoshi_total",
159-
"total_msat");
155+
json_add_amount_msat(response, "total_msat", total);
160156
}
161157
}
162158

@@ -289,11 +285,11 @@ static void openchannel2_hook_serialize(struct openchannel2_payload *payload,
289285
json_object_start(stream, "openchannel2");
290286
json_add_node_id(stream, "id", &payload->peer_id);
291287
json_add_channel_id(stream, "channel_id", &payload->channel_id);
292-
json_add_amount_sats_deprecated(stream, "their_funding", "their_funding_msat",
293-
payload->their_funding);
294-
json_add_amount_sats_deprecated(stream, "dust_limit_satoshis",
295-
"dust_limit_msat",
296-
payload->dust_limit_satoshis);
288+
json_add_amount_sat_msat(stream,
289+
"their_funding_msat", payload->their_funding);
290+
json_add_amount_sat_msat(stream,
291+
"dust_limit_msat", payload->dust_limit_satoshis);
292+
297293
json_add_amount_msat_only(stream, "max_htlc_value_in_flight_msat",
298294
payload->max_htlc_value_in_flight_msat);
299295
json_add_amount_msat_only(stream, "htlc_minimum_msat",

lightningd/invoice.c

+3-5
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,12 @@ static void json_add_invoice_fields(struct json_stream *response,
4444
json_add_invstring(response, inv->invstring);
4545
json_add_sha256(response, "payment_hash", &inv->rhash);
4646
if (inv->msat)
47-
json_add_amount_msat_compat(response, *inv->msat,
48-
"msatoshi", "amount_msat");
47+
json_add_amount_msat(response, "amount_msat", *inv->msat);
4948
json_add_string(response, "status", invoice_status_str(inv));
5049
if (inv->state == PAID) {
5150
json_add_u64(response, "pay_index", inv->pay_index);
52-
json_add_amount_msat_compat(response, inv->received,
53-
"msatoshi_received",
54-
"amount_received_msat");
51+
json_add_amount_msat(response,
52+
"amount_received_msat", inv->received);
5553
json_add_u64(response, "paid_at", inv->paid_timestamp);
5654
json_add_preimage(response, "payment_preimage", &inv->r);
5755
}

lightningd/notification.c

+3-14
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static void channel_opened_notification_serialize(struct json_stream *stream,
205205
{
206206
json_object_start(stream, "channel_opened");
207207
json_add_node_id(stream, "id", node_id);
208-
json_add_amount_sats_deprecated(stream, "amount", "funding_msat", *funding_sat);
208+
json_add_amount_sat_msat(stream, "funding_msat", *funding_sat);
209209
json_add_txid(stream, "funding_txid", funding_txid);
210210
if (deprecated_apis)
211211
json_add_bool(stream, "funding_locked", channel_ready);
@@ -490,26 +490,18 @@ static void coin_movement_notification_serialize(struct json_stream *stream,
490490
json_add_string(stream, "originating_account",
491491
mvt->originating_acct);
492492
json_mvt_id(stream, mvt->type, &mvt->id);
493-
if (deprecated_apis) {
494-
json_add_amount_msat_only(stream, "credit", mvt->credit);
495-
json_add_amount_msat_only(stream, "debit", mvt->debit);
496-
}
497493
json_add_amount_msat_only(stream, "credit_msat", mvt->credit);
498494
json_add_amount_msat_only(stream, "debit_msat", mvt->debit);
499495

500496
/* Only chain movements */
501497
if (mvt->output_val)
502-
json_add_amount_sats_deprecated(stream, "output_value",
503-
"output_msat",
504-
*mvt->output_val);
498+
json_add_amount_sat_msat(stream,
499+
"output_msat", *mvt->output_val);
505500
if (mvt->output_count > 0)
506501
json_add_num(stream, "output_count",
507502
mvt->output_count);
508503

509504
if (mvt->fees) {
510-
if (deprecated_apis)
511-
json_add_amount_msat_only(stream, "fees",
512-
*mvt->fees);
513505
json_add_amount_msat_only(stream, "fees_msat",
514506
*mvt->fees);
515507
}
@@ -556,9 +548,6 @@ static void balance_snapshot_notification_serialize(struct json_stream *stream,
556548
json_object_start(stream, NULL);
557549
json_add_string(stream, "account_id",
558550
snap->accts[i]->acct_id);
559-
if (deprecated_apis)
560-
json_add_amount_msat_only(stream, "balance",
561-
snap->accts[i]->balance);
562551
json_add_amount_msat_only(stream, "balance_msat",
563552
snap->accts[i]->balance);
564553
json_add_string(stream, "coin_type", snap->accts[i]->bip173_name);

0 commit comments

Comments
 (0)