mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-22 16:44:20 +01:00
gossipd: Update BOLT-split flags in channel_update
BOLT 7's been updated to split the flags field in `channel_update` into two: `channel_flags` and `message_flags`. This changeset does the minimal necessary to get to building with the new flags.
This commit is contained in:
committed by
Rusty Russell
parent
b1f15c2605
commit
b1ceaf9910
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
### Added
|
### Added
|
||||||
|
|
||||||
- JSON API: `listpeers` has new field `scratch_txid`: the latest tx in channel.
|
- JSON API: `listpeers` has new field `scratch_txid`: the latest tx in channel.
|
||||||
|
- JSON API: `listchannels` has two new fields: `message_flags` and `channel_flags`. This replaces `flags`.
|
||||||
- Bitcoind: more parallelism in requests, for very slow nodes.
|
- Bitcoind: more parallelism in requests, for very slow nodes.
|
||||||
- Testing: fixed logging, cleaner interception of bitcoind, minor fixes.
|
- Testing: fixed logging, cleaner interception of bitcoind, minor fixes.
|
||||||
|
|
||||||
@@ -19,6 +20,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
Note: You should always set `allow-deprecated-apis=false` to test for
|
Note: You should always set `allow-deprecated-apis=false` to test for
|
||||||
changes.
|
changes.
|
||||||
|
|
||||||
|
- JSON RPC: `listchannels`' `flags` field. This has been split into two fields, see Added.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -9,7 +9,7 @@ CCANDIR := ccan
|
|||||||
|
|
||||||
# Where we keep the BOLT RFCs
|
# Where we keep the BOLT RFCs
|
||||||
BOLTDIR := ../lightning-rfc/
|
BOLTDIR := ../lightning-rfc/
|
||||||
BOLTVERSION := a9195a84d07b9350f0eb1262ed0c1a82bc42e4ef
|
BOLTVERSION := 0891374d47ddffa64c5a2e6ad151247e3d6b7a59
|
||||||
|
|
||||||
-include config.vars
|
-include config.vars
|
||||||
|
|
||||||
|
|||||||
@@ -1008,7 +1008,11 @@ static u8 *create_channel_update(const tal_t *ctx,
|
|||||||
secp256k1_ecdsa_signature dummy_sig;
|
secp256k1_ecdsa_signature dummy_sig;
|
||||||
u8 *update, *msg;
|
u8 *update, *msg;
|
||||||
u32 timestamp = time_now().ts.tv_sec;
|
u32 timestamp = time_now().ts.tv_sec;
|
||||||
u16 flags;
|
u8 message_flags, channel_flags;
|
||||||
|
|
||||||
|
/* `message_flags` are optional.
|
||||||
|
* Currently, not set by c-lightning */
|
||||||
|
message_flags = 0;
|
||||||
|
|
||||||
/* So valgrind doesn't complain */
|
/* So valgrind doesn't complain */
|
||||||
memset(&dummy_sig, 0, sizeof(dummy_sig));
|
memset(&dummy_sig, 0, sizeof(dummy_sig));
|
||||||
@@ -1018,15 +1022,16 @@ static u8 *create_channel_update(const tal_t *ctx,
|
|||||||
&& timestamp == chan->half[direction].last_timestamp)
|
&& timestamp == chan->half[direction].last_timestamp)
|
||||||
timestamp++;
|
timestamp++;
|
||||||
|
|
||||||
flags = direction;
|
channel_flags = direction;
|
||||||
if (disable)
|
if (disable)
|
||||||
flags |= ROUTING_FLAGS_DISABLED;
|
channel_flags |= ROUTING_FLAGS_DISABLED;
|
||||||
|
|
||||||
update = towire_channel_update(ctx, &dummy_sig,
|
update = towire_channel_update(ctx, &dummy_sig,
|
||||||
&rstate->chain_hash,
|
&rstate->chain_hash,
|
||||||
&chan->scid,
|
&chan->scid,
|
||||||
timestamp,
|
timestamp,
|
||||||
flags, cltv_expiry_delta,
|
message_flags, channel_flags,
|
||||||
|
cltv_expiry_delta,
|
||||||
htlc_minimum_msat,
|
htlc_minimum_msat,
|
||||||
fee_base_msat,
|
fee_base_msat,
|
||||||
fee_proportional_millionths);
|
fee_proportional_millionths);
|
||||||
@@ -1055,7 +1060,7 @@ static bool update_redundant(const struct half_chan *hc,
|
|||||||
if (!is_halfchan_defined(hc))
|
if (!is_halfchan_defined(hc))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return !(hc->flags & ROUTING_FLAGS_DISABLED) == !disable
|
return !(hc->channel_flags & ROUTING_FLAGS_DISABLED) == !disable
|
||||||
&& hc->delay == cltv_delta
|
&& hc->delay == cltv_delta
|
||||||
&& hc->htlc_minimum_msat == htlc_minimum_msat
|
&& hc->htlc_minimum_msat == htlc_minimum_msat
|
||||||
&& hc->base_fee == fee_base_msat
|
&& hc->base_fee == fee_base_msat
|
||||||
@@ -1108,11 +1113,11 @@ static void apply_delayed_local_update(struct local_update *local_update)
|
|||||||
&local_update->scid),
|
&local_update->scid),
|
||||||
local_update->direction,
|
local_update->direction,
|
||||||
is_halfchan_defined(hc)
|
is_halfchan_defined(hc)
|
||||||
? (hc->flags & ROUTING_FLAGS_DISABLED ? "DISABLED" : "ACTIVE")
|
? (hc->channel_flags & ROUTING_FLAGS_DISABLED ? "DISABLED" : "ACTIVE")
|
||||||
: "UNDEFINED",
|
: "UNDEFINED",
|
||||||
hc->last_timestamp,
|
hc->last_timestamp,
|
||||||
(u32)time_now().ts.tv_sec,
|
(u32)time_now().ts.tv_sec,
|
||||||
hc->flags,
|
hc->channel_flags,
|
||||||
local_update->disable);
|
local_update->disable);
|
||||||
tal_free(local_update);
|
tal_free(local_update);
|
||||||
return;
|
return;
|
||||||
@@ -1441,7 +1446,8 @@ static void append_half_channel(struct gossip_getchannels_entry **entries,
|
|||||||
e->source = chan->nodes[idx]->id;
|
e->source = chan->nodes[idx]->id;
|
||||||
e->destination = chan->nodes[!idx]->id;
|
e->destination = chan->nodes[!idx]->id;
|
||||||
e->satoshis = chan->satoshis;
|
e->satoshis = chan->satoshis;
|
||||||
e->flags = c->flags;
|
e->channel_flags = c->channel_flags;
|
||||||
|
e->message_flags = c->message_flags;
|
||||||
e->local_disabled = chan->local_disabled;
|
e->local_disabled = chan->local_disabled;
|
||||||
e->public = is_chan_public(chan);
|
e->public = is_chan_public(chan);
|
||||||
e->short_channel_id = chan->scid;
|
e->short_channel_id = chan->scid;
|
||||||
@@ -1767,7 +1773,7 @@ static void gossip_send_keepalive_update(struct routing_state *rstate,
|
|||||||
|
|
||||||
/* Generate a new update, with up to date timestamp */
|
/* Generate a new update, with up to date timestamp */
|
||||||
update = create_channel_update(tmpctx, rstate, chan,
|
update = create_channel_update(tmpctx, rstate, chan,
|
||||||
hc->flags & ROUTING_FLAGS_DIRECTION,
|
hc->channel_flags & ROUTING_FLAGS_DIRECTION,
|
||||||
false,
|
false,
|
||||||
hc->delay,
|
hc->delay,
|
||||||
hc->htlc_minimum_msat,
|
hc->htlc_minimum_msat,
|
||||||
@@ -1834,7 +1840,7 @@ static void gossip_disable_outgoing_halfchan(struct daemon *daemon,
|
|||||||
{
|
{
|
||||||
u8 direction;
|
u8 direction;
|
||||||
struct half_chan *hc;
|
struct half_chan *hc;
|
||||||
u16 flags;
|
u8 message_flags, channel_flags;
|
||||||
u32 timestamp;
|
u32 timestamp;
|
||||||
struct bitcoin_blkid chain_hash;
|
struct bitcoin_blkid chain_hash;
|
||||||
secp256k1_ecdsa_signature sig;
|
secp256k1_ecdsa_signature sig;
|
||||||
@@ -1858,7 +1864,8 @@ static void gossip_disable_outgoing_halfchan(struct daemon *daemon,
|
|||||||
|
|
||||||
if (!fromwire_channel_update(
|
if (!fromwire_channel_update(
|
||||||
hc->channel_update, &sig, &chain_hash,
|
hc->channel_update, &sig, &chain_hash,
|
||||||
&local_update->scid, ×tamp, &flags,
|
&local_update->scid, ×tamp,
|
||||||
|
&message_flags, &channel_flags,
|
||||||
&local_update->cltv_delta,
|
&local_update->cltv_delta,
|
||||||
&local_update->htlc_minimum_msat,
|
&local_update->htlc_minimum_msat,
|
||||||
&local_update->fee_base_msat,
|
&local_update->fee_base_msat,
|
||||||
|
|||||||
@@ -259,13 +259,17 @@ static void destroy_chan(struct chan *chan, struct routing_state *rstate)
|
|||||||
|
|
||||||
static void init_half_chan(struct routing_state *rstate,
|
static void init_half_chan(struct routing_state *rstate,
|
||||||
struct chan *chan,
|
struct chan *chan,
|
||||||
int idx)
|
int channel_idx)
|
||||||
{
|
{
|
||||||
struct half_chan *c = &chan->half[idx];
|
struct half_chan *c = &chan->half[channel_idx];
|
||||||
|
|
||||||
c->channel_update = NULL;
|
c->channel_update = NULL;
|
||||||
c->unroutable_until = 0;
|
c->unroutable_until = 0;
|
||||||
c->flags = idx;
|
|
||||||
|
/* Set the channel direction */
|
||||||
|
c->channel_flags = channel_idx;
|
||||||
|
// TODO: wireup message_flags
|
||||||
|
c->message_flags = 0;
|
||||||
/* We haven't seen channel_update: make it halfway to prune time,
|
/* We haven't seen channel_update: make it halfway to prune time,
|
||||||
* which should be older than any update we'd see. */
|
* which should be older than any update we'd see. */
|
||||||
c->last_timestamp = time_now().ts.tv_sec - rstate->prune_timeout/2;
|
c->last_timestamp = time_now().ts.tv_sec - rstate->prune_timeout/2;
|
||||||
@@ -1003,7 +1007,8 @@ static void set_connection_values(struct chan *chan,
|
|||||||
u32 base_fee,
|
u32 base_fee,
|
||||||
u32 proportional_fee,
|
u32 proportional_fee,
|
||||||
u32 delay,
|
u32 delay,
|
||||||
u16 flags,
|
u8 message_flags,
|
||||||
|
u8 channel_flags,
|
||||||
u64 timestamp,
|
u64 timestamp,
|
||||||
u32 htlc_minimum_msat)
|
u32 htlc_minimum_msat)
|
||||||
{
|
{
|
||||||
@@ -1013,9 +1018,10 @@ static void set_connection_values(struct chan *chan,
|
|||||||
c->htlc_minimum_msat = htlc_minimum_msat;
|
c->htlc_minimum_msat = htlc_minimum_msat;
|
||||||
c->base_fee = base_fee;
|
c->base_fee = base_fee;
|
||||||
c->proportional_fee = proportional_fee;
|
c->proportional_fee = proportional_fee;
|
||||||
c->flags = flags;
|
c->message_flags = message_flags;
|
||||||
|
c->channel_flags = channel_flags;
|
||||||
c->last_timestamp = timestamp;
|
c->last_timestamp = timestamp;
|
||||||
assert((c->flags & ROUTING_FLAGS_DIRECTION) == idx);
|
assert((c->channel_flags & ROUTING_FLAGS_DIRECTION) == idx);
|
||||||
|
|
||||||
/* If it was temporarily unroutable, re-enable */
|
/* If it was temporarily unroutable, re-enable */
|
||||||
c->unroutable_until = 0;
|
c->unroutable_until = 0;
|
||||||
@@ -1031,7 +1037,7 @@ static void set_connection_values(struct chan *chan,
|
|||||||
&chan->scid),
|
&chan->scid),
|
||||||
idx,
|
idx,
|
||||||
c->proportional_fee);
|
c->proportional_fee);
|
||||||
c->flags |= ROUTING_FLAGS_DISABLED;
|
c->channel_flags |= ROUTING_FLAGS_DISABLED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1041,7 +1047,7 @@ bool routing_add_channel_update(struct routing_state *rstate,
|
|||||||
secp256k1_ecdsa_signature signature;
|
secp256k1_ecdsa_signature signature;
|
||||||
struct short_channel_id short_channel_id;
|
struct short_channel_id short_channel_id;
|
||||||
u32 timestamp;
|
u32 timestamp;
|
||||||
u16 flags;
|
u8 message_flags, channel_flags;
|
||||||
u16 expiry;
|
u16 expiry;
|
||||||
u64 htlc_minimum_msat;
|
u64 htlc_minimum_msat;
|
||||||
u32 fee_base_msat;
|
u32 fee_base_msat;
|
||||||
@@ -1052,7 +1058,8 @@ bool routing_add_channel_update(struct routing_state *rstate,
|
|||||||
bool have_broadcast_announce;
|
bool have_broadcast_announce;
|
||||||
|
|
||||||
if (!fromwire_channel_update(update, &signature, &chain_hash,
|
if (!fromwire_channel_update(update, &signature, &chain_hash,
|
||||||
&short_channel_id, ×tamp, &flags,
|
&short_channel_id, ×tamp,
|
||||||
|
&message_flags, &channel_flags,
|
||||||
&expiry, &htlc_minimum_msat, &fee_base_msat,
|
&expiry, &htlc_minimum_msat, &fee_base_msat,
|
||||||
&fee_proportional_millionths))
|
&fee_proportional_millionths))
|
||||||
return false;
|
return false;
|
||||||
@@ -1064,10 +1071,11 @@ bool routing_add_channel_update(struct routing_state *rstate,
|
|||||||
have_broadcast_announce = is_halfchan_defined(&chan->half[0])
|
have_broadcast_announce = is_halfchan_defined(&chan->half[0])
|
||||||
|| is_halfchan_defined(&chan->half[1]);
|
|| is_halfchan_defined(&chan->half[1]);
|
||||||
|
|
||||||
direction = flags & 0x1;
|
direction = channel_flags & 0x1;
|
||||||
set_connection_values(chan, direction, fee_base_msat,
|
set_connection_values(chan, direction, fee_base_msat,
|
||||||
fee_proportional_millionths, expiry,
|
fee_proportional_millionths, expiry,
|
||||||
flags, timestamp, htlc_minimum_msat);
|
message_flags, channel_flags,
|
||||||
|
timestamp, htlc_minimum_msat);
|
||||||
|
|
||||||
/* Replace any old one. */
|
/* Replace any old one. */
|
||||||
tal_free(chan->half[direction].channel_update);
|
tal_free(chan->half[direction].channel_update);
|
||||||
@@ -1101,7 +1109,7 @@ u8 *handle_channel_update(struct routing_state *rstate, const u8 *update,
|
|||||||
secp256k1_ecdsa_signature signature;
|
secp256k1_ecdsa_signature signature;
|
||||||
struct short_channel_id short_channel_id;
|
struct short_channel_id short_channel_id;
|
||||||
u32 timestamp;
|
u32 timestamp;
|
||||||
u16 flags;
|
u8 message_flags, channel_flags;
|
||||||
u16 expiry;
|
u16 expiry;
|
||||||
u64 htlc_minimum_msat;
|
u64 htlc_minimum_msat;
|
||||||
u32 fee_base_msat;
|
u32 fee_base_msat;
|
||||||
@@ -1115,7 +1123,8 @@ u8 *handle_channel_update(struct routing_state *rstate, const u8 *update,
|
|||||||
serialized = tal_dup_arr(tmpctx, u8, update, len, 0);
|
serialized = tal_dup_arr(tmpctx, u8, update, len, 0);
|
||||||
if (!fromwire_channel_update(serialized, &signature,
|
if (!fromwire_channel_update(serialized, &signature,
|
||||||
&chain_hash, &short_channel_id,
|
&chain_hash, &short_channel_id,
|
||||||
×tamp, &flags, &expiry,
|
×tamp, &message_flags,
|
||||||
|
&channel_flags, &expiry,
|
||||||
&htlc_minimum_msat, &fee_base_msat,
|
&htlc_minimum_msat, &fee_base_msat,
|
||||||
&fee_proportional_millionths)) {
|
&fee_proportional_millionths)) {
|
||||||
err = towire_errorfmt(rstate, NULL,
|
err = towire_errorfmt(rstate, NULL,
|
||||||
@@ -1123,7 +1132,7 @@ u8 *handle_channel_update(struct routing_state *rstate, const u8 *update,
|
|||||||
tal_hex(tmpctx, serialized));
|
tal_hex(tmpctx, serialized));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
direction = flags & 0x1;
|
direction = channel_flags & 0x1;
|
||||||
|
|
||||||
/* BOLT #7:
|
/* BOLT #7:
|
||||||
*
|
*
|
||||||
@@ -1160,7 +1169,7 @@ u8 *handle_channel_update(struct routing_state *rstate, const u8 *update,
|
|||||||
type_to_string(tmpctx,
|
type_to_string(tmpctx,
|
||||||
struct short_channel_id,
|
struct short_channel_id,
|
||||||
&short_channel_id),
|
&short_channel_id),
|
||||||
flags));
|
channel_flags));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1198,7 +1207,7 @@ u8 *handle_channel_update(struct routing_state *rstate, const u8 *update,
|
|||||||
type_to_string(tmpctx,
|
type_to_string(tmpctx,
|
||||||
struct short_channel_id,
|
struct short_channel_id,
|
||||||
&short_channel_id),
|
&short_channel_id),
|
||||||
flags,
|
channel_flags,
|
||||||
tal_hex(tmpctx, c->channel_update),
|
tal_hex(tmpctx, c->channel_update),
|
||||||
tal_hex(tmpctx, serialized));
|
tal_hex(tmpctx, serialized));
|
||||||
}
|
}
|
||||||
@@ -1224,10 +1233,10 @@ u8 *handle_channel_update(struct routing_state *rstate, const u8 *update,
|
|||||||
status_trace("Received channel_update for channel %s(%d) now %s was %s (from %s)",
|
status_trace("Received channel_update for channel %s(%d) now %s was %s (from %s)",
|
||||||
type_to_string(tmpctx, struct short_channel_id,
|
type_to_string(tmpctx, struct short_channel_id,
|
||||||
&short_channel_id),
|
&short_channel_id),
|
||||||
flags & 0x01,
|
channel_flags & 0x01,
|
||||||
flags & ROUTING_FLAGS_DISABLED ? "DISABLED" : "ACTIVE",
|
channel_flags & ROUTING_FLAGS_DISABLED ? "DISABLED" : "ACTIVE",
|
||||||
is_halfchan_defined(c)
|
is_halfchan_defined(c)
|
||||||
? (c->flags & ROUTING_FLAGS_DISABLED ? "DISABLED" : "ACTIVE")
|
? (c->channel_flags & ROUTING_FLAGS_DISABLED ? "DISABLED" : "ACTIVE")
|
||||||
: "UNDEFINED",
|
: "UNDEFINED",
|
||||||
source);
|
source);
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,11 @@ struct half_chan {
|
|||||||
|
|
||||||
/* Flags as specified by the `channel_update`s, among other
|
/* Flags as specified by the `channel_update`s, among other
|
||||||
* things indicated direction wrt the `channel_id` */
|
* things indicated direction wrt the `channel_id` */
|
||||||
u16 flags;
|
u8 channel_flags;
|
||||||
|
|
||||||
|
/* Flags as specified by the `channel_update`s, indicates
|
||||||
|
* optional fields. */
|
||||||
|
u8 message_flags;
|
||||||
|
|
||||||
/* If greater than current time, this connection should not
|
/* If greater than current time, this connection should not
|
||||||
* be used for routing. */
|
* be used for routing. */
|
||||||
@@ -81,7 +85,7 @@ static inline bool is_halfchan_defined(const struct half_chan *hc)
|
|||||||
|
|
||||||
static inline bool is_halfchan_enabled(const struct half_chan *hc)
|
static inline bool is_halfchan_enabled(const struct half_chan *hc)
|
||||||
{
|
{
|
||||||
return is_halfchan_defined(hc) && !(hc->flags & ROUTING_FLAGS_DISABLED);
|
return is_halfchan_defined(hc) && !(hc->channel_flags & ROUTING_FLAGS_DISABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct node {
|
struct node {
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ void broadcast_del(struct broadcast_state *bstate UNNEEDED, u64 index UNNEEDED,
|
|||||||
bool fromwire_channel_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, secp256k1_ecdsa_signature *node_signature_1 UNNEEDED, secp256k1_ecdsa_signature *node_signature_2 UNNEEDED, secp256k1_ecdsa_signature *bitcoin_signature_1 UNNEEDED, secp256k1_ecdsa_signature *bitcoin_signature_2 UNNEEDED, u8 **features UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *node_id_1 UNNEEDED, struct pubkey *node_id_2 UNNEEDED, struct pubkey *bitcoin_key_1 UNNEEDED, struct pubkey *bitcoin_key_2 UNNEEDED)
|
bool fromwire_channel_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, secp256k1_ecdsa_signature *node_signature_1 UNNEEDED, secp256k1_ecdsa_signature *node_signature_2 UNNEEDED, secp256k1_ecdsa_signature *bitcoin_signature_1 UNNEEDED, secp256k1_ecdsa_signature *bitcoin_signature_2 UNNEEDED, u8 **features UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *node_id_1 UNNEEDED, struct pubkey *node_id_2 UNNEEDED, struct pubkey *bitcoin_key_1 UNNEEDED, struct pubkey *bitcoin_key_2 UNNEEDED)
|
||||||
{ fprintf(stderr, "fromwire_channel_announcement called!\n"); abort(); }
|
{ fprintf(stderr, "fromwire_channel_announcement called!\n"); abort(); }
|
||||||
/* Generated stub for fromwire_channel_update */
|
/* Generated stub for fromwire_channel_update */
|
||||||
bool fromwire_channel_update(const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, u32 *timestamp UNNEEDED, u16 *flags UNNEEDED, u16 *cltv_expiry_delta UNNEEDED, u64 *htlc_minimum_msat UNNEEDED, u32 *fee_base_msat UNNEEDED, u32 *fee_proportional_millionths UNNEEDED)
|
bool fromwire_channel_update(const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, u32 *timestamp UNNEEDED, u8 *message_flags UNNEEDED, u8 *channel_flags UNNEEDED, u16 *cltv_expiry_delta UNNEEDED, u64 *htlc_minimum_msat UNNEEDED, u32 *fee_base_msat UNNEEDED, u32 *fee_proportional_millionths UNNEEDED)
|
||||||
{ fprintf(stderr, "fromwire_channel_update called!\n"); abort(); }
|
{ fprintf(stderr, "fromwire_channel_update called!\n"); abort(); }
|
||||||
/* Generated stub for fromwire_gossip_local_add_channel */
|
/* Generated stub for fromwire_gossip_local_add_channel */
|
||||||
bool fromwire_gossip_local_add_channel(const void *p UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *remote_node_id UNNEEDED, u64 *satoshis UNNEEDED)
|
bool fromwire_gossip_local_add_channel(const void *p UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *remote_node_id UNNEEDED, u64 *satoshis UNNEEDED)
|
||||||
@@ -160,7 +160,7 @@ static void add_connection(struct routing_state *rstate,
|
|||||||
c->base_fee = base_fee;
|
c->base_fee = base_fee;
|
||||||
c->proportional_fee = proportional_fee;
|
c->proportional_fee = proportional_fee;
|
||||||
c->delay = delay;
|
c->delay = delay;
|
||||||
c->flags = get_channel_direction(from, to);
|
c->channel_flags = get_channel_direction(from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct pubkey nodeid(size_t n)
|
static struct pubkey nodeid(size_t n)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Expect route 03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf -> 0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae -> 02ea622d5c8d6143f15ed3ce1d501dd0d3d09d3b1c83a44d0034949f8a9ab60f06
|
* Expect route 03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf -> 0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae -> 02ea622d5c8d6143f15ed3ce1d501dd0d3d09d3b1c83a44d0034949f8a9ab60f06
|
||||||
*
|
*
|
||||||
* getchannels:
|
* getchannels:
|
||||||
* {'channels': [{'active': True, 'short_id': '6990:2:1/1', 'fee_per_kw': 10, 'delay': 5, 'flags': 1, 'destination': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'source': '02ea622d5c8d6143f15ed3ce1d501dd0d3d09d3b1c83a44d0034949f8a9ab60f06', 'last_update': 1504064344}, {'active': True, 'short_id': '6989:2:1/0', 'fee_per_kw': 10, 'delay': 5, 'flags': 0, 'destination': '03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf', 'source': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'last_update': 1504064344}, {'active': True, 'short_id': '6990:2:1/0', 'fee_per_kw': 10, 'delay': 5, 'flags': 0, 'destination': '02ea622d5c8d6143f15ed3ce1d501dd0d3d09d3b1c83a44d0034949f8a9ab60f06', 'source': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'last_update': 1504064344}, {'active': True, 'short_id': '6989:2:1/1', 'fee_per_kw': 10, 'delay': 5, 'flags': 1, 'destination': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'source': '03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf', 'last_update': 1504064344}]}
|
* {'channels': [{'active': True, 'short_id': '6990:2:1/1', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 1, 'destination': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'source': '02ea622d5c8d6143f15ed3ce1d501dd0d3d09d3b1c83a44d0034949f8a9ab60f06', 'last_update': 1504064344}, {'active': True, 'short_id': '6989:2:1/0', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 0, 'destination': '03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf', 'source': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'last_update': 1504064344}, {'active': True, 'short_id': '6990:2:1/0', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 0, 'destination': '02ea622d5c8d6143f15ed3ce1d501dd0d3d09d3b1c83a44d0034949f8a9ab60f06', 'source': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'last_update': 1504064344}, {'active': True, 'short_id': '6989:2:1/1', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 1, 'destination': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'source': '03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf', 'last_update': 1504064344}]}
|
||||||
*/
|
*/
|
||||||
#include <common/status.h>
|
#include <common/status.h>
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ void broadcast_del(struct broadcast_state *bstate UNNEEDED, u64 index UNNEEDED,
|
|||||||
bool fromwire_channel_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, secp256k1_ecdsa_signature *node_signature_1 UNNEEDED, secp256k1_ecdsa_signature *node_signature_2 UNNEEDED, secp256k1_ecdsa_signature *bitcoin_signature_1 UNNEEDED, secp256k1_ecdsa_signature *bitcoin_signature_2 UNNEEDED, u8 **features UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *node_id_1 UNNEEDED, struct pubkey *node_id_2 UNNEEDED, struct pubkey *bitcoin_key_1 UNNEEDED, struct pubkey *bitcoin_key_2 UNNEEDED)
|
bool fromwire_channel_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, secp256k1_ecdsa_signature *node_signature_1 UNNEEDED, secp256k1_ecdsa_signature *node_signature_2 UNNEEDED, secp256k1_ecdsa_signature *bitcoin_signature_1 UNNEEDED, secp256k1_ecdsa_signature *bitcoin_signature_2 UNNEEDED, u8 **features UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *node_id_1 UNNEEDED, struct pubkey *node_id_2 UNNEEDED, struct pubkey *bitcoin_key_1 UNNEEDED, struct pubkey *bitcoin_key_2 UNNEEDED)
|
||||||
{ fprintf(stderr, "fromwire_channel_announcement called!\n"); abort(); }
|
{ fprintf(stderr, "fromwire_channel_announcement called!\n"); abort(); }
|
||||||
/* Generated stub for fromwire_channel_update */
|
/* Generated stub for fromwire_channel_update */
|
||||||
bool fromwire_channel_update(const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, u32 *timestamp UNNEEDED, u16 *flags UNNEEDED, u16 *cltv_expiry_delta UNNEEDED, u64 *htlc_minimum_msat UNNEEDED, u32 *fee_base_msat UNNEEDED, u32 *fee_proportional_millionths UNNEEDED)
|
bool fromwire_channel_update(const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, u32 *timestamp UNNEEDED, u8 *message_flags UNNEEDED, u8 *channel_flags UNNEEDED, u16 *cltv_expiry_delta UNNEEDED, u64 *htlc_minimum_msat UNNEEDED, u32 *fee_base_msat UNNEEDED, u32 *fee_proportional_millionths UNNEEDED)
|
||||||
{ fprintf(stderr, "fromwire_channel_update called!\n"); abort(); }
|
{ fprintf(stderr, "fromwire_channel_update called!\n"); abort(); }
|
||||||
/* Generated stub for fromwire_gossip_local_add_channel */
|
/* Generated stub for fromwire_gossip_local_add_channel */
|
||||||
bool fromwire_gossip_local_add_channel(const void *p UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *remote_node_id UNNEEDED, u64 *satoshis UNNEEDED)
|
bool fromwire_gossip_local_add_channel(const void *p UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *remote_node_id UNNEEDED, u64 *satoshis UNNEEDED)
|
||||||
@@ -172,38 +172,42 @@ int main(void)
|
|||||||
|
|
||||||
rstate = new_routing_state(tmpctx, &zerohash, &a, 0);
|
rstate = new_routing_state(tmpctx, &zerohash, &a, 0);
|
||||||
|
|
||||||
/* [{'active': True, 'short_id': '6990:2:1/1', 'fee_per_kw': 10, 'delay': 5, 'flags': 1, 'destination': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'source': '02ea622d5c8d6143f15ed3ce1d501dd0d3d09d3b1c83a44d0034949f8a9ab60f06', 'last_update': 1504064344}, */
|
/* [{'active': True, 'short_id': '6990:2:1/1', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 1, 'destination': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'source': '02ea622d5c8d6143f15ed3ce1d501dd0d3d09d3b1c83a44d0034949f8a9ab60f06', 'last_update': 1504064344}, */
|
||||||
|
|
||||||
nc = get_or_make_connection(rstate, &c, &b, "6990:2:1", 1000);
|
nc = get_or_make_connection(rstate, &c, &b, "6990:2:1", 1000);
|
||||||
nc->base_fee = 0;
|
nc->base_fee = 0;
|
||||||
nc->proportional_fee = 10;
|
nc->proportional_fee = 10;
|
||||||
nc->delay = 5;
|
nc->delay = 5;
|
||||||
nc->flags = 1;
|
nc->channel_flags = 1;
|
||||||
|
nc->message_flags = 0;
|
||||||
nc->last_timestamp = 1504064344;
|
nc->last_timestamp = 1504064344;
|
||||||
|
|
||||||
/* {'active': True, 'short_id': '6989:2:1/0', 'fee_per_kw': 10, 'delay': 5, 'flags': 0, 'destination': '03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf', 'source': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'last_update': 1504064344}, */
|
/* {'active': True, 'short_id': '6989:2:1/0', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 0, 'destination': '03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf', 'source': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'last_update': 1504064344}, */
|
||||||
nc = get_or_make_connection(rstate, &b, &a, "6989:2:1", 1000);
|
nc = get_or_make_connection(rstate, &b, &a, "6989:2:1", 1000);
|
||||||
nc->base_fee = 0;
|
nc->base_fee = 0;
|
||||||
nc->proportional_fee = 10;
|
nc->proportional_fee = 10;
|
||||||
nc->delay = 5;
|
nc->delay = 5;
|
||||||
nc->flags = 0;
|
nc->channel_flags = 0;
|
||||||
|
nc->message_flags = 0;
|
||||||
nc->last_timestamp = 1504064344;
|
nc->last_timestamp = 1504064344;
|
||||||
|
|
||||||
/* {'active': True, 'short_id': '6990:2:1/0', 'fee_per_kw': 10, 'delay': 5, 'flags': 0, 'destination': '02ea622d5c8d6143f15ed3ce1d501dd0d3d09d3b1c83a44d0034949f8a9ab60f06', 'source': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'last_update': 1504064344}, */
|
/* {'active': True, 'short_id': '6990:2:1/0', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 0, 'destination': '02ea622d5c8d6143f15ed3ce1d501dd0d3d09d3b1c83a44d0034949f8a9ab60f06', 'source': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'last_update': 1504064344}, */
|
||||||
nc = get_or_make_connection(rstate, &b, &c, "6990:2:1", 1000);
|
nc = get_or_make_connection(rstate, &b, &c, "6990:2:1", 1000);
|
||||||
nc->base_fee = 0;
|
nc->base_fee = 0;
|
||||||
nc->proportional_fee = 10;
|
nc->proportional_fee = 10;
|
||||||
nc->delay = 5;
|
nc->delay = 5;
|
||||||
nc->flags = 0;
|
nc->channel_flags = 0;
|
||||||
|
nc->message_flags = 0;
|
||||||
nc->last_timestamp = 1504064344;
|
nc->last_timestamp = 1504064344;
|
||||||
nc->htlc_minimum_msat = 100;
|
nc->htlc_minimum_msat = 100;
|
||||||
|
|
||||||
/* {'active': True, 'short_id': '6989:2:1/1', 'fee_per_kw': 10, 'delay': 5, 'flags': 1, 'destination': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'source': '03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf', 'last_update': 1504064344}]} */
|
/* {'active': True, 'short_id': '6989:2:1/1', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 1, 'destination': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'source': '03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf', 'last_update': 1504064344}]} */
|
||||||
nc = get_or_make_connection(rstate, &a, &b, "6989:2:1", 1000);
|
nc = get_or_make_connection(rstate, &a, &b, "6989:2:1", 1000);
|
||||||
nc->base_fee = 0;
|
nc->base_fee = 0;
|
||||||
nc->proportional_fee = 10;
|
nc->proportional_fee = 10;
|
||||||
nc->delay = 5;
|
nc->delay = 5;
|
||||||
nc->flags = 1;
|
nc->channel_flags = 1;
|
||||||
|
nc->message_flags = 0;
|
||||||
nc->last_timestamp = 1504064344;
|
nc->last_timestamp = 1504064344;
|
||||||
|
|
||||||
route = find_route(tmpctx, rstate, &a, &c, 100000, riskfactor, 0.0, NULL, &fee);
|
route = find_route(tmpctx, rstate, &a, &c, 100000, riskfactor, 0.0, NULL, &fee);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ void broadcast_del(struct broadcast_state *bstate UNNEEDED, u64 index UNNEEDED,
|
|||||||
bool fromwire_channel_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, secp256k1_ecdsa_signature *node_signature_1 UNNEEDED, secp256k1_ecdsa_signature *node_signature_2 UNNEEDED, secp256k1_ecdsa_signature *bitcoin_signature_1 UNNEEDED, secp256k1_ecdsa_signature *bitcoin_signature_2 UNNEEDED, u8 **features UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *node_id_1 UNNEEDED, struct pubkey *node_id_2 UNNEEDED, struct pubkey *bitcoin_key_1 UNNEEDED, struct pubkey *bitcoin_key_2 UNNEEDED)
|
bool fromwire_channel_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, secp256k1_ecdsa_signature *node_signature_1 UNNEEDED, secp256k1_ecdsa_signature *node_signature_2 UNNEEDED, secp256k1_ecdsa_signature *bitcoin_signature_1 UNNEEDED, secp256k1_ecdsa_signature *bitcoin_signature_2 UNNEEDED, u8 **features UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *node_id_1 UNNEEDED, struct pubkey *node_id_2 UNNEEDED, struct pubkey *bitcoin_key_1 UNNEEDED, struct pubkey *bitcoin_key_2 UNNEEDED)
|
||||||
{ fprintf(stderr, "fromwire_channel_announcement called!\n"); abort(); }
|
{ fprintf(stderr, "fromwire_channel_announcement called!\n"); abort(); }
|
||||||
/* Generated stub for fromwire_channel_update */
|
/* Generated stub for fromwire_channel_update */
|
||||||
bool fromwire_channel_update(const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, u32 *timestamp UNNEEDED, u16 *flags UNNEEDED, u16 *cltv_expiry_delta UNNEEDED, u64 *htlc_minimum_msat UNNEEDED, u32 *fee_base_msat UNNEEDED, u32 *fee_proportional_millionths UNNEEDED)
|
bool fromwire_channel_update(const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, u32 *timestamp UNNEEDED, u8 *message_flags UNNEEDED, u8 *channel_flags UNNEEDED, u16 *cltv_expiry_delta UNNEEDED, u64 *htlc_minimum_msat UNNEEDED, u32 *fee_base_msat UNNEEDED, u32 *fee_proportional_millionths UNNEEDED)
|
||||||
{ fprintf(stderr, "fromwire_channel_update called!\n"); abort(); }
|
{ fprintf(stderr, "fromwire_channel_update called!\n"); abort(); }
|
||||||
/* Generated stub for fromwire_gossip_local_add_channel */
|
/* Generated stub for fromwire_gossip_local_add_channel */
|
||||||
bool fromwire_gossip_local_add_channel(const void *p UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *remote_node_id UNNEEDED, u64 *satoshis UNNEEDED)
|
bool fromwire_gossip_local_add_channel(const void *p UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *remote_node_id UNNEEDED, u64 *satoshis UNNEEDED)
|
||||||
@@ -127,7 +127,7 @@ static void add_connection(struct routing_state *rstate,
|
|||||||
c->base_fee = base_fee;
|
c->base_fee = base_fee;
|
||||||
c->proportional_fee = proportional_fee;
|
c->proportional_fee = proportional_fee;
|
||||||
c->delay = delay;
|
c->delay = delay;
|
||||||
c->flags = get_channel_direction(from, to);
|
c->channel_flags = get_channel_direction(from, to);
|
||||||
c->htlc_minimum_msat = 0;
|
c->htlc_minimum_msat = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ int main(void)
|
|||||||
assert(fee == 1 + 3);
|
assert(fee == 1 + 3);
|
||||||
|
|
||||||
/* Make B->C inactive, force it back via D */
|
/* Make B->C inactive, force it back via D */
|
||||||
get_connection(rstate, &b, &c)->flags |= ROUTING_FLAGS_DISABLED;
|
get_connection(rstate, &b, &c)->channel_flags |= ROUTING_FLAGS_DISABLED;
|
||||||
route = find_route(tmpctx, rstate, &a, &c, 3000000, riskfactor, 0.0, NULL, &fee);
|
route = find_route(tmpctx, rstate, &a, &c, 3000000, riskfactor, 0.0, NULL, &fee);
|
||||||
assert(route);
|
assert(route);
|
||||||
assert(tal_count(route) == 2);
|
assert(tal_count(route) == 2);
|
||||||
|
|||||||
@@ -653,7 +653,8 @@ static struct io_plan *handle_channel_update_sig(struct io_conn *conn,
|
|||||||
struct short_channel_id scid;
|
struct short_channel_id scid;
|
||||||
u32 timestamp, fee_base_msat, fee_proportional_mill;
|
u32 timestamp, fee_base_msat, fee_proportional_mill;
|
||||||
u64 htlc_minimum_msat;
|
u64 htlc_minimum_msat;
|
||||||
u16 flags, cltv_expiry_delta;
|
u8 message_flags, channel_flags;
|
||||||
|
u16 cltv_expiry_delta;
|
||||||
struct bitcoin_blkid chain_hash;
|
struct bitcoin_blkid chain_hash;
|
||||||
u8 *cu;
|
u8 *cu;
|
||||||
|
|
||||||
@@ -661,7 +662,7 @@ static struct io_plan *handle_channel_update_sig(struct io_conn *conn,
|
|||||||
return bad_req(conn, c, msg_in);
|
return bad_req(conn, c, msg_in);
|
||||||
|
|
||||||
if (!fromwire_channel_update(cu, &sig, &chain_hash,
|
if (!fromwire_channel_update(cu, &sig, &chain_hash,
|
||||||
&scid, ×tamp, &flags,
|
&scid, ×tamp, &message_flags, &channel_flags,
|
||||||
&cltv_expiry_delta, &htlc_minimum_msat,
|
&cltv_expiry_delta, &htlc_minimum_msat,
|
||||||
&fee_base_msat, &fee_proportional_mill)) {
|
&fee_base_msat, &fee_proportional_mill)) {
|
||||||
return bad_req_fmt(conn, c, msg_in, "Bad inner channel_update");
|
return bad_req_fmt(conn, c, msg_in, "Bad inner channel_update");
|
||||||
@@ -676,7 +677,7 @@ static struct io_plan *handle_channel_update_sig(struct io_conn *conn,
|
|||||||
sign_hash(&node_pkey, &hash, &sig);
|
sign_hash(&node_pkey, &hash, &sig);
|
||||||
|
|
||||||
cu = towire_channel_update(tmpctx, &sig, &chain_hash,
|
cu = towire_channel_update(tmpctx, &sig, &chain_hash,
|
||||||
&scid, timestamp, flags,
|
&scid, timestamp, message_flags, channel_flags,
|
||||||
cltv_expiry_delta, htlc_minimum_msat,
|
cltv_expiry_delta, htlc_minimum_msat,
|
||||||
fee_base_msat, fee_proportional_mill);
|
fee_base_msat, fee_proportional_mill);
|
||||||
return req_reply(conn, c, take(towire_hsm_cupdate_sig_reply(NULL, cu)));
|
return req_reply(conn, c, take(towire_hsm_cupdate_sig_reply(NULL, cu)));
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <lightningd/jsonrpc.h>
|
#include <lightningd/jsonrpc.h>
|
||||||
#include <lightningd/jsonrpc_errors.h>
|
#include <lightningd/jsonrpc_errors.h>
|
||||||
#include <lightningd/log.h>
|
#include <lightningd/log.h>
|
||||||
|
#include <lightningd/options.h>
|
||||||
#include <lightningd/param.h>
|
#include <lightningd/param.h>
|
||||||
#include <lightningd/ping.h>
|
#include <lightningd/ping.h>
|
||||||
#include <sodium/randombytes.h>
|
#include <sodium/randombytes.h>
|
||||||
@@ -346,9 +347,13 @@ static void json_listchannels_reply(struct subd *gossip UNUSED, const u8 *reply,
|
|||||||
&entries[i].short_channel_id));
|
&entries[i].short_channel_id));
|
||||||
json_add_bool(response, "public", entries[i].public);
|
json_add_bool(response, "public", entries[i].public);
|
||||||
json_add_u64(response, "satoshis", entries[i].satoshis);
|
json_add_u64(response, "satoshis", entries[i].satoshis);
|
||||||
json_add_num(response, "flags", entries[i].flags);
|
json_add_num(response, "message_flags", entries[i].message_flags);
|
||||||
|
json_add_num(response, "channel_flags", entries[i].channel_flags);
|
||||||
|
/* Prior to spec v0891374d47ddffa64c5a2e6ad151247e3d6b7a59, these two were a single u16 field */
|
||||||
|
if (deprecated_apis)
|
||||||
|
json_add_num(response, "flags", ((u16)entries[i].message_flags << 8) | entries[i].channel_flags);
|
||||||
json_add_bool(response, "active",
|
json_add_bool(response, "active",
|
||||||
!(entries[i].flags & ROUTING_FLAGS_DISABLED)
|
!(entries[i].channel_flags & ROUTING_FLAGS_DISABLED)
|
||||||
&& !entries[i].local_disabled);
|
&& !entries[i].local_disabled);
|
||||||
json_add_num(response, "last_update",
|
json_add_num(response, "last_update",
|
||||||
entries[i].last_update_timestamp);
|
entries[i].last_update_timestamp);
|
||||||
|
|||||||
@@ -84,7 +84,8 @@ void fromwire_gossip_getchannels_entry(const u8 **pptr, size_t *max,
|
|||||||
fromwire_pubkey(pptr, max, &entry->source);
|
fromwire_pubkey(pptr, max, &entry->source);
|
||||||
fromwire_pubkey(pptr, max, &entry->destination);
|
fromwire_pubkey(pptr, max, &entry->destination);
|
||||||
entry->satoshis = fromwire_u64(pptr, max);
|
entry->satoshis = fromwire_u64(pptr, max);
|
||||||
entry->flags = fromwire_u16(pptr, max);
|
entry->message_flags = fromwire_u8(pptr, max);
|
||||||
|
entry->channel_flags = fromwire_u8(pptr, max);
|
||||||
entry->public = fromwire_bool(pptr, max);
|
entry->public = fromwire_bool(pptr, max);
|
||||||
entry->local_disabled = fromwire_bool(pptr, max);
|
entry->local_disabled = fromwire_bool(pptr, max);
|
||||||
entry->last_update_timestamp = fromwire_u32(pptr, max);
|
entry->last_update_timestamp = fromwire_u32(pptr, max);
|
||||||
@@ -100,7 +101,8 @@ void towire_gossip_getchannels_entry(u8 **pptr,
|
|||||||
towire_pubkey(pptr, &entry->source);
|
towire_pubkey(pptr, &entry->source);
|
||||||
towire_pubkey(pptr, &entry->destination);
|
towire_pubkey(pptr, &entry->destination);
|
||||||
towire_u64(pptr, entry->satoshis);
|
towire_u64(pptr, entry->satoshis);
|
||||||
towire_u16(pptr, entry->flags);
|
towire_u8(pptr, entry->message_flags);
|
||||||
|
towire_u8(pptr, entry->channel_flags);
|
||||||
towire_bool(pptr, entry->public);
|
towire_bool(pptr, entry->public);
|
||||||
towire_bool(pptr, entry->local_disabled);
|
towire_bool(pptr, entry->local_disabled);
|
||||||
towire_u32(pptr, entry->last_update_timestamp);
|
towire_u32(pptr, entry->last_update_timestamp);
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ struct gossip_getchannels_entry {
|
|||||||
struct pubkey source, destination;
|
struct pubkey source, destination;
|
||||||
u64 satoshis;
|
u64 satoshis;
|
||||||
struct short_channel_id short_channel_id;
|
struct short_channel_id short_channel_id;
|
||||||
u16 flags;
|
u8 message_flags;
|
||||||
|
u8 channel_flags;
|
||||||
bool public;
|
bool public;
|
||||||
bool local_disabled;
|
bool local_disabled;
|
||||||
u32 last_update_timestamp;
|
u32 last_update_timestamp;
|
||||||
|
|||||||
@@ -557,7 +557,7 @@ class LightningNode(object):
|
|||||||
|
|
||||||
def is_channel_active(self, chanid):
|
def is_channel_active(self, chanid):
|
||||||
channels = self.rpc.listchannels()['channels']
|
channels = self.rpc.listchannels()['channels']
|
||||||
active = [(c['short_channel_id'], c['flags']) for c in channels if c['active']]
|
active = [(c['short_channel_id'], c['channel_flags']) for c in channels if c['active']]
|
||||||
return (chanid, 0) in active and (chanid, 1) in active
|
return (chanid, 0) in active and (chanid, 1) in active
|
||||||
|
|
||||||
def wait_for_channel_onchain(self, peerid):
|
def wait_for_channel_onchain(self, peerid):
|
||||||
|
|||||||
@@ -143,7 +143,8 @@ channel_update,0,signature,64
|
|||||||
channel_update,64,chain_hash,32
|
channel_update,64,chain_hash,32
|
||||||
channel_update,96,short_channel_id,8
|
channel_update,96,short_channel_id,8
|
||||||
channel_update,104,timestamp,4
|
channel_update,104,timestamp,4
|
||||||
channel_update,108,flags,2
|
channel_update,108,message_flags,1
|
||||||
|
channel_update,109,channel_flags,1
|
||||||
channel_update,110,cltv_expiry_delta,2
|
channel_update,110,cltv_expiry_delta,2
|
||||||
channel_update,112,htlc_minimum_msat,8
|
channel_update,112,htlc_minimum_msat,8
|
||||||
channel_update,120,fee_base_msat,4
|
channel_update,120,fee_base_msat,4
|
||||||
|
|||||||
@@ -123,7 +123,8 @@ struct msg_revoke_and_ack {
|
|||||||
struct msg_channel_update {
|
struct msg_channel_update {
|
||||||
secp256k1_ecdsa_signature signature;
|
secp256k1_ecdsa_signature signature;
|
||||||
u32 timestamp;
|
u32 timestamp;
|
||||||
u16 flags;
|
u8 message_flags;
|
||||||
|
u8 channel_flags;
|
||||||
u16 expiry;
|
u16 expiry;
|
||||||
u64 htlc_minimum_msat;
|
u64 htlc_minimum_msat;
|
||||||
u32 fee_base_msat;
|
u32 fee_base_msat;
|
||||||
@@ -376,7 +377,8 @@ static void *towire_struct_channel_update(const tal_t *ctx,
|
|||||||
&s->chain_hash,
|
&s->chain_hash,
|
||||||
&s->short_channel_id,
|
&s->short_channel_id,
|
||||||
s->timestamp,
|
s->timestamp,
|
||||||
s->flags,
|
s->message_flags,
|
||||||
|
s->channel_flags,
|
||||||
s->expiry,
|
s->expiry,
|
||||||
s->htlc_minimum_msat,
|
s->htlc_minimum_msat,
|
||||||
s->fee_base_msat,
|
s->fee_base_msat,
|
||||||
@@ -392,7 +394,8 @@ static struct msg_channel_update *fromwire_struct_channel_update(const tal_t *ct
|
|||||||
&s->chain_hash,
|
&s->chain_hash,
|
||||||
&s->short_channel_id,
|
&s->short_channel_id,
|
||||||
&s->timestamp,
|
&s->timestamp,
|
||||||
&s->flags,
|
&s->message_flags,
|
||||||
|
&s->channel_flags,
|
||||||
&s->expiry,
|
&s->expiry,
|
||||||
&s->htlc_minimum_msat,
|
&s->htlc_minimum_msat,
|
||||||
&s->fee_base_msat,
|
&s->fee_base_msat,
|
||||||
|
|||||||
Reference in New Issue
Block a user