1
1
use std:: sync:: Arc ;
2
2
3
- use bitcoin:: blockdata:: script:: Script ;
4
3
use bitcoin:: blockdata:: transaction:: Transaction ;
5
- use bitcoin:: blockdata:: block:: Block ;
6
- use bitcoin_hashes:: sha256d:: Hash as Sha256dHash ;
7
4
8
5
use lightning:: chain:: transaction:: OutPoint ;
9
- use lightning:: chain:: chaininterface:: { ChainWatchInterface , ChainError } ;
10
6
use lightning:: chain:: keysinterface:: { InMemoryChannelKeys } ;
11
7
use lightning:: ln:: channelmonitor:: SimpleManyChannelMonitor ;
12
8
@@ -15,46 +11,6 @@ use crate::adaptors::primitives::{FFIScript, FFIOutPoint, FFIBlock, FFISha256dHa
15
11
use crate :: error:: FFIResult ;
16
12
use crate :: handle:: { Ref , HandleShared , Out } ;
17
13
18
-
19
- mod ChainWatchInterfaceFn {
20
- use super :: * ;
21
- pub type install_watch_tx_ptr = extern "cdecl" fn ( * const FFIChainWatchInterface , * const FFISha256dHash , script_pub_key : * const FFIScript ) ;
22
- pub type install_watch_outpoint_ptr = extern "cdecl" fn ( * const FFIChainWatchInterface , outpoint : * const FFIOutPoint , out_script : * const FFIScript ) ;
23
- pub type watch_all_txn_ptr = extern "cdecl" fn ( * const FFIChainWatchInterface ) ;
24
- pub type get_chain_utxo_ptr = extern "cdecl" fn ( * const FFIChainWatchInterface , genesis_hash : * const FFISha256dHash , unspent_tx_output_identifier : u64 , err : * mut ChainError , script : * mut FFITxOut ) ;
25
- pub type filter_block_ptr = extern "cdecl" fn ( * const FFIChainWatchInterface , * const FFIBlock ) ;
26
- }
27
-
28
- #[ repr( C ) ]
29
- pub struct FFIChainWatchInterface {
30
- install_watch_tx_ptr : ChainWatchInterfaceFn :: install_watch_tx_ptr ,
31
- install_watch_outpoint_ptr : ChainWatchInterfaceFn :: install_watch_tx_ptr ,
32
- watch_all_txn_ptr : ChainWatchInterfaceFn :: watch_all_txn_ptr ,
33
- get_chain_utxo_ptr : ChainWatchInterfaceFn :: get_chain_utxo_ptr ,
34
- filter_block_ptr : ChainWatchInterfaceFn :: filter_block_ptr ,
35
- }
36
-
37
- impl ChainWatchInterface for FFIChainWatchInterface {
38
- fn install_watch_tx ( & self , txid : & Sha256dHash , script_pub_key : & Script ) {
39
- ( self . install_watch_tx_ptr ) ( self , & txid. into ( ) as * const _ , & script_pub_key. into ( ) as * const _ )
40
- }
41
- fn install_watch_outpoint ( & self , outpoint : ( Sha256dHash , u32 ) , out_script : & Script ) {
42
- unimplemented ! ( "TODO" )
43
- }
44
- fn watch_all_txn ( & self ) {
45
- unimplemented ! ( )
46
- }
47
- fn get_chain_utxo ( & self , genesis_hash : Sha256dHash , unspent_tx_output_identifier : u64 ) -> Result < ( Script , u64 ) , ChainError > {
48
- unimplemented ! ( )
49
- }
50
- fn filter_block < ' a > ( & self , block : & ' a Block ) -> ( Vec < & ' a Transaction > , Vec < u32 > ) {
51
- unimplemented ! ( )
52
- }
53
- fn reentered ( & self ) -> usize {
54
- unimplemented ! ( )
55
- }
56
- }
57
-
58
14
type FFIManyChannelMonitor = SimpleManyChannelMonitor < u64 , InMemoryChannelKeys , Arc < FFIBroadCaster > , Arc < FFIFeeEstimator > > ;
59
15
type FFIManyChannelMonitorHandle < ' a > = HandleShared < ' a , FFIManyChannelMonitor > ;
60
16
0 commit comments