diff --git a/lightningd/channel.c b/lightningd/channel.c index cc48c0527..952e046b7 100644 --- a/lightningd/channel.c +++ b/lightningd/channel.c @@ -265,6 +265,19 @@ struct channel *active_channel_by_id(struct lightningd *ld, return peer_active_channel(peer); } +struct channel *channel_by_dbid(struct lightningd *ld, const u64 dbid) +{ + struct peer *p; + struct channel *chan; + list_for_each(&ld->peers, p, list) { + list_for_each(&p->channels, chan, list) { + if (chan->dbid == dbid) + return chan; + } + } + return NULL; +} + void channel_set_last_tx(struct channel *channel, struct bitcoin_tx *tx, const secp256k1_ecdsa_signature *sig) diff --git a/lightningd/channel.h b/lightningd/channel.h index b178afbf8..291d037cd 100644 --- a/lightningd/channel.h +++ b/lightningd/channel.h @@ -165,6 +165,8 @@ struct channel *active_channel_by_id(struct lightningd *ld, const struct pubkey *id, struct uncommitted_channel **uc); +struct channel *channel_by_dbid(struct lightningd *ld, const u64 dbid); + void channel_set_last_tx(struct channel *channel, struct bitcoin_tx *tx, const secp256k1_ecdsa_signature *sig);