mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
9bb9e69bf3
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'
27 lines
653 B
C
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);
|
|
}
|