Browse Source

Move gossip_constants.h into common/

Turns out we weren't checking the BOLT comments before, so they
needed an overhaul.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
travis-debug
Rusty Russell 5 years ago
parent
commit
2a74d53841
  1. 2
      channeld/channeld.c
  2. 2
      common/Makefile
  3. 23
      common/gossip_constants.h
  4. 2
      common/per_peer_state.c
  5. 2
      devtools/mkgossip.c
  6. 2
      gossipd/Makefile
  7. 2
      gossipd/routing.h
  8. 2
      lightningd/channel_control.c
  9. 2
      plugins/pay.c

2
channeld/channeld.c

@ -29,6 +29,7 @@
#include <common/crypto_sync.h>
#include <common/dev_disconnect.h>
#include <common/features.h>
#include <common/gossip_constants.h>
#include <common/gossip_store.h>
#include <common/htlc_tx.h>
#include <common/key_derive.h>
@ -49,7 +50,6 @@
#include <errno.h>
#include <fcntl.h>
#include <gossipd/gen_gossip_peerd_wire.h>
#include <gossipd/gossip_constants.h>
#include <hsmd/gen_hsm_wire.h>
#include <inttypes.h>
#include <secp256k1.h>

2
common/Makefile

@ -64,7 +64,7 @@ COMMON_SRC_NOGEN := \
COMMON_SRC_GEN := common/gen_status_wire.c common/gen_peer_status_wire.c
COMMON_HEADERS_NOGEN := $(COMMON_SRC_NOGEN:.c=.h) common/overflows.h common/htlc.h common/status_levels.h common/json_command.h common/jsonrpc_errors.h
COMMON_HEADERS_NOGEN := $(COMMON_SRC_NOGEN:.c=.h) common/overflows.h common/htlc.h common/status_levels.h common/json_command.h common/jsonrpc_errors.h common/gossip_constants.h
COMMON_HEADERS_GEN := common/gen_htlc_state_names.h common/gen_status_wire.h common/gen_peer_status_wire.h
COMMON_HEADERS := $(COMMON_HEADERS_GEN) $(COMMON_HEADERS_NOGEN)

23
gossipd/gossip_constants.h → common/gossip_constants.h

@ -1,22 +1,18 @@
#ifndef LIGHTNING_GOSSIPD_GOSSIP_CONSTANTS_H
#define LIGHTNING_GOSSIPD_GOSSIP_CONSTANTS_H
#ifndef LIGHTNING_COMMON_GOSSIP_CONSTANTS_H
#define LIGHTNING_COMMON_GOSSIP_CONSTANTS_H
#include "config.h"
#include <common/utils.h>
/* BOLT #4:
*
* - Length: the maximum route length is limited to 20 hops.
*...
* 1. type: `onion_packet`
* 2. data:
* * [`byte`:`version`]
* * [`point`:`public_key`]
* * [`1300*byte`:`hops_data`]
* - a 1300-byte `hop_payloads` consisting of multiple, variable length,
* `hop_payload` payloads or up to 20 fixed sized legacy `hop_data` payloads.
*/
#define ROUTING_MAX_HOPS 20
/* BOLT #7:
*
* The `flags` bitfield...individual bits:
* The `channel_flags` bitfield...individual bits:
*...
* | 0 | `direction` | Direction this update refers to. |
* | 1 | `disable` | Disable the channel. |
@ -29,7 +25,7 @@
* The `message_flags` bitfield is used to indicate the presence of optional
* fields in the `channel_update` message:
* | Bit Position | Name | Field |
* | ------------- | ------------------------- | -------------------- |
* | ------------- | ------------------------- | ----------------...- |
* | 0 | `option_channel_htlc_max` | `htlc_maximum_msat` |
*/
#define ROUTING_OPT_HTLC_MAX_MSAT (1 << 0)
@ -37,7 +33,8 @@
/* BOLT #7:
*
* - MUST NOT send `announcement_signatures` messages until `funding_locked`
* has been sent AND the funding transaction has at least six confirmations.
* has been sent and received AND the funding transaction has at least six
* confirmations.
*/
#define ANNOUNCE_MIN_DEPTH 6
@ -81,4 +78,4 @@
#define GOSSIP_TOKEN_TIME(dev_fast_gossip_flag) \
DEV_FAST_GOSSIP(dev_fast_gossip_flag, 1, 3600)
#endif /* LIGHTNING_GOSSIPD_GOSSIP_CONSTANTS_H */
#endif /* LIGHTNING_COMMON_GOSSIP_CONSTANTS_H */

2
common/per_peer_state.c

@ -1,8 +1,8 @@
#include <assert.h>
#include <ccan/fdpass/fdpass.h>
#include <common/gossip_constants.h>
#include <common/gossip_rcvd_filter.h>
#include <common/per_peer_state.h>
#include <gossipd/gossip_constants.h>
#include <unistd.h>
#include <wire/wire.h>

2
devtools/mkgossip.c

@ -15,8 +15,8 @@
#include <ccan/crc32c/crc32c.h>
#include <ccan/err/err.h>
#include <ccan/str/hex/hex.h>
#include <common/gossip_constants.h>
#include <common/utils.h>
#include <gossipd/gossip_constants.h>
#include <inttypes.h>
#include <wire/gen_peer_wire.h>
#include <stdio.h>

2
gossipd/Makefile

@ -7,7 +7,7 @@ gossipd-wrongdir:
default: gossipd-all
# lightningd uses this:
LIGHTNINGD_GOSSIP_CONTROL_HEADERS := gossipd/gen_gossip_wire.h gossipd/gossip_constants.h
LIGHTNINGD_GOSSIP_CONTROL_HEADERS := gossipd/gen_gossip_wire.h
LIGHTNINGD_GOSSIP_CONTROL_SRC := gossipd/gen_gossip_wire.c
LIGHTNINGD_GOSSIP_CONTROL_OBJS := $(LIGHTNINGD_GOSSIP_CONTROL_SRC:.c=.o)

2
gossipd/routing.h

@ -7,9 +7,9 @@
#include <ccan/intmap/intmap.h>
#include <ccan/time/time.h>
#include <common/amount.h>
#include <common/gossip_constants.h>
#include <common/node_id.h>
#include <gossipd/broadcast.h>
#include <gossipd/gossip_constants.h>
#include <gossipd/gossip_store.h>
#include <wire/gen_onion_wire.h>
#include <wire/wire.h>

2
lightningd/channel_control.c

@ -3,6 +3,7 @@
#include <ccan/cast/cast.h>
#include <channeld/gen_channel_wire.h>
#include <common/features.h>
#include <common/gossip_constants.h>
#include <common/json_command.h>
#include <common/jsonrpc_errors.h>
#include <common/memleak.h>
@ -12,7 +13,6 @@
#include <common/wallet_tx.h>
#include <common/wire_error.h>
#include <errno.h>
#include <gossipd/gossip_constants.h>
#include <hsmd/gen_hsm_wire.h>
#include <inttypes.h>
#include <lightningd/channel_control.h>

2
plugins/pay.c

@ -5,9 +5,9 @@
#include <ccan/tal/str/str.h>
#include <common/amount.h>
#include <common/bolt11.h>
#include <common/gossip_constants.h>
#include <common/pseudorand.h>
#include <common/type_to_string.h>
#include <gossipd/gossip_constants.h>
#include <plugins/libplugin.h>
#include <stdio.h>
#include <wire/onion_defs.h>

Loading…
Cancel
Save