core-lightning/lightningd/coin_mvts.c
lisa neigut 9bb9e69bf3 notifications: add new notification for coin movements and two helpers
Adds a new plugin notification for getting information about coin
movements. Also includes two 'helper' notification methods that can be
called from within lightningd. Separated from the 'common' set because
the lightningd struct is required to finalize the blockheight etc

Changelog-Added: Plugins: new notification type 'coin_movement'
2020-05-12 15:46:58 +09:30

27 lines
653 B
C

#include <lightningd/coin_mvts.h>
#include <lightningd/notification.h>
void notify_channel_mvt(struct lightningd *ld, const struct channel_coin_mvt *mvt)
{
const struct coin_mvt *cm;
u32 timestamp;
timestamp = time_now().ts.tv_sec;
cm = finalize_channel_mvt(mvt, mvt, timestamp,
get_block_height(ld->topology),
&ld->id);
notify_coin_mvt(ld, cm);
}
void notify_chain_mvt(struct lightningd *ld, const struct chain_coin_mvt *mvt)
{
const struct coin_mvt *cm;
u32 timestamp;
timestamp = time_now().ts.tv_sec;
cm = finalize_chain_mvt(mvt, mvt, timestamp,
get_block_height(ld->topology),
&ld->id);
notify_coin_mvt(ld, cm);
}