diff --git a/bitcoin/test/run-tx-bitcoin_tx_2of2_input_witness_weight.c b/bitcoin/test/run-tx-bitcoin_tx_2of2_input_witness_weight.c index af5483956300..d1c6a3c25d98 100644 --- a/bitcoin/test/run-tx-bitcoin_tx_2of2_input_witness_weight.c +++ b/bitcoin/test/run-tx-bitcoin_tx_2of2_input_witness_weight.c @@ -24,9 +24,6 @@ struct amount_sat amount_asset_to_sat(struct amount_asset *asset UNNEEDED) struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_add called!\n"); abort(); } -/* Generated stub for amount_sat_eq */ -bool amount_sat_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) -{ fprintf(stderr, "amount_sat_eq called!\n"); abort(); } /* Generated stub for amount_sat_greater_eq */ bool amount_sat_greater_eq(struct amount_sat a UNNEEDED, struct amount_sat b UNNEEDED) { fprintf(stderr, "amount_sat_greater_eq called!\n"); abort(); } diff --git a/doc/lightning-getinfo.7.md b/doc/lightning-getinfo.7.md index a3d4b5b118b1..c7150e41b895 100644 --- a/doc/lightning-getinfo.7.md +++ b/doc/lightning-getinfo.7.md @@ -39,6 +39,11 @@ On success, an object is returned, containing: - **blockheight** (u32): The highest block height we've learned - **network** (string): represents the type of network on the node are working (e.g: `bitcoin`, `testnet`, or `regtest`) - **fees_collected_msat** (msat): Total routing fees collected by this node +- **our_features** (object, optional): Our BOLT #9 feature bits (as hexstring) for various contexts: + - **init** (hex): features (incl. globalfeatures) in our init message, these also restrict what we offer in open_channel or accept in accept_channel + - **node** (hex): features in our node_announcement message + - **channel** (hex): negotiated channel features we — as channel initiator — publish in the channel_announcement message + - **invoice** (hex): features in our BOLT11 invoices - **address** (array of objects, optional): The addresses we announce to the world: - **type** (string): Type of connection (one of "dns", "ipv4", "ipv6", "torv2", "torv3", "websocket") - **port** (u16): port number @@ -91,12 +96,18 @@ EXAMPLE JSON RESPONSE "port": 9736 } ], - "version": "0.9.0", - "blockheight": 644297, + "version": "v0.10.2", + "blockheight": 724302, "network": "bitcoin", "msatoshi_fees_collected": 0, "fees_collected_msat": "0msat", "lightning-dir": "/media/vincent/Maxtor/C-lightning/node/bitcoin" + "our_features": { + "init": "8828226aa2", + "node": "80008828226aa2", + "channel": "", + "invoice": "20024200" + } } ``` @@ -117,4 +128,4 @@ RESOURCES --------- Main web site: -[comment]: # ( SHA256STAMP:90a3bacb6cb4456119afee8e60677c29bf5f46c4cd950e660a9f9c8e0433b473) +[comment]: # ( SHA256STAMP:041768347542d7cf4260739ad8934c77d52682d089d9fe07499e22f7331b53f5) diff --git a/doc/schemas/getinfo.schema.json b/doc/schemas/getinfo.schema.json index fc07c5de9bb5..2ddbfc3553aa 100644 --- a/doc/schemas/getinfo.schema.json +++ b/doc/schemas/getinfo.schema.json @@ -56,6 +56,35 @@ "type": "string", "description": "Identifies where you can find the configuration and other related files" }, + "our_features": { + "type": "object", + "description": "Our BOLT #9 feature bits (as hexstring) for various contexts", + "additionalProperties": true, + "required": [ + "init", + "node", + "channel", + "invoice" + ], + "properties": { + "init": { + "type": "hex", + "description": "features (incl. globalfeatures) in our init message, these also restrict what we offer in open_channel or accept in accept_channel" + }, + "node": { + "type": "hex", + "description": "features in our node_announcement message" + }, + "channel": { + "type": "hex", + "description": "negotiated channel features we — as channel initiator — publish in the channel_announcement message" + }, + "invoice": { + "type": "hex", + "description": "features in our BOLT11 invoices" + } + } + }, "blockheight": { "type": "u32", "description": "The highest block height we've learned" diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index a08134fc0262..212208467166 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -1747,6 +1747,15 @@ static struct command_result *json_getinfo(struct command *cmd, json_add_string(response, "warning_lightningd_sync", "Still loading latest blocks from bitcoind."); + u8 **bits = cmd->ld->our_features->bits; + json_object_start(response, "our_features"); + json_add_hex_talarr(response, "init", + featurebits_or(cmd, bits[INIT_FEATURE], bits[GLOBAL_INIT_FEATURE])); + json_add_hex_talarr(response, "node", bits[NODE_ANNOUNCE_FEATURE]); + json_add_hex_talarr(response, "channel", bits[CHANNEL_FEATURE]); + json_add_hex_talarr(response, "invoice", bits[BOLT11_FEATURE]); + json_object_end(response); + return command_success(cmd, response); } diff --git a/lightningd/test/run-invoice-select-inchan.c b/lightningd/test/run-invoice-select-inchan.c index f9e65d420abb..1a8ddc3d8c9d 100644 --- a/lightningd/test/run-invoice-select-inchan.c +++ b/lightningd/test/run-invoice-select-inchan.c @@ -184,6 +184,9 @@ bool feature_is_set(const u8 *features UNNEEDED, size_t bit UNNEEDED) bool feature_negotiated(const struct feature_set *our_features UNNEEDED, const u8 *their_features UNNEEDED, size_t f UNNEEDED) { fprintf(stderr, "feature_negotiated called!\n"); abort(); } +/* Generated stub for featurebits_or */ +u8 *featurebits_or(const tal_t *ctx UNNEEDED, const u8 *f1 TAKES UNNEEDED, const u8 *f2 TAKES UNNEEDED) +{ fprintf(stderr, "featurebits_or called!\n"); abort(); } /* Generated stub for find_plugin_for_command */ struct plugin *find_plugin_for_command(struct lightningd *ld UNNEEDED, const char *cmd_name UNNEEDED)