mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-18 22:54:25 +01:00
channel: Allow channel lookup by database id
Since we reference the channel ID to allow cascades in the database we also need the ability to look up a channel by its database ID. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
@@ -265,6 +265,19 @@ struct channel *active_channel_by_id(struct lightningd *ld,
|
|||||||
return peer_active_channel(peer);
|
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,
|
void channel_set_last_tx(struct channel *channel,
|
||||||
struct bitcoin_tx *tx,
|
struct bitcoin_tx *tx,
|
||||||
const secp256k1_ecdsa_signature *sig)
|
const secp256k1_ecdsa_signature *sig)
|
||||||
|
|||||||
@@ -165,6 +165,8 @@ struct channel *active_channel_by_id(struct lightningd *ld,
|
|||||||
const struct pubkey *id,
|
const struct pubkey *id,
|
||||||
struct uncommitted_channel **uc);
|
struct uncommitted_channel **uc);
|
||||||
|
|
||||||
|
struct channel *channel_by_dbid(struct lightningd *ld, const u64 dbid);
|
||||||
|
|
||||||
void channel_set_last_tx(struct channel *channel,
|
void channel_set_last_tx(struct channel *channel,
|
||||||
struct bitcoin_tx *tx,
|
struct bitcoin_tx *tx,
|
||||||
const secp256k1_ecdsa_signature *sig);
|
const secp256k1_ecdsa_signature *sig);
|
||||||
|
|||||||
Reference in New Issue
Block a user