|
| 1 | +//! Traits and utility impls which allow other parts of rust-lightning to interact with the |
| 2 | +//! blockchain - receiving notifications of new blocks and block disconnections and allowing |
| 3 | +//! rust-lightning to request that you monitor the chain for certain outpoints/transactions. |
| 4 | +
|
1 | 5 | use bitcoin::blockdata::block::{Block, BlockHeader};
|
2 | 6 | use bitcoin::blockdata::transaction::Transaction;
|
3 | 7 | use bitcoin::blockdata::script::Script;
|
@@ -38,6 +42,8 @@ pub trait ChainWatchInterface: Sync + Send {
|
38 | 42 | /// Indicates that a listener needs to see all transactions.
|
39 | 43 | fn watch_all_txn(&self);
|
40 | 44 |
|
| 45 | + /// Register the given listener to receive events. Only a weak pointer is provided and the |
| 46 | + /// registration should be freed once that pointer expires. |
41 | 47 | fn register_listener(&self, listener: Weak<ChainListener>);
|
42 | 48 | //TODO: unregister
|
43 | 49 |
|
@@ -70,9 +76,14 @@ pub trait ChainListener: Sync + Send {
|
70 | 76 | fn block_disconnected(&self, header: &BlockHeader);
|
71 | 77 | }
|
72 | 78 |
|
| 79 | +/// An enum that represents the speed at which we want a transaction to confirm used for feerate |
| 80 | +/// estimation. |
73 | 81 | pub enum ConfirmationTarget {
|
| 82 | + /// We are happy with this transaction confirming slowly when feerate drops some. |
74 | 83 | Background,
|
| 84 | + /// We'd like this transaction to confirm without major delay, but 12-18 blocks is fine. |
75 | 85 | Normal,
|
| 86 | + /// We'd like this transaction to confirm in the next few blocks. |
76 | 87 | HighPriority,
|
77 | 88 | }
|
78 | 89 |
|
@@ -224,6 +235,7 @@ impl ChainWatchInterface for ChainWatchInterfaceUtil {
|
224 | 235 | }
|
225 | 236 |
|
226 | 237 | impl ChainWatchInterfaceUtil {
|
| 238 | + /// Creates a new ChainWatchInterfaceUtil for the given network |
227 | 239 | pub fn new(network: Network, logger: Arc<Logger>) -> ChainWatchInterfaceUtil {
|
228 | 240 | ChainWatchInterfaceUtil {
|
229 | 241 | network: network,
|
|
0 commit comments