Browse Source
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'nifty/pset-pre
committed by
Rusty Russell
6 changed files with 111 additions and 0 deletions
@ -0,0 +1,26 @@ |
|||||
|
#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); |
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
#ifndef LIGHTNING_LIGHTNINGD_COIN_MVTS_H |
||||
|
#define LIGHTNING_LIGHTNINGD_COIN_MVTS_H |
||||
|
#include "config.h" |
||||
|
|
||||
|
#include <common/coin_mvt.h> |
||||
|
#include <lightningd/lightningd.h> |
||||
|
|
||||
|
void notify_channel_mvt(struct lightningd *ld, const struct channel_coin_mvt *mvt); |
||||
|
void notify_chain_mvt(struct lightningd *ld, const struct chain_coin_mvt *mvt); |
||||
|
#endif /* LIGHTNING_LIGHTNINGD_COIN_MVTS_H */ |
Loading…
Reference in new issue