X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fchain%2Fchaininterface.rs;h=e08c8cdbd47dcff18a9c193356037517d981ae68;hb=1a9ef40203da58e03defd13379983e6474c20d1b;hp=518b20b128c70a6143cdb15587b694fe2bd23585;hpb=a611ae4741fc213b2d59b49722121f0f7a1f6873;p=rust-lightning diff --git a/src/chain/chaininterface.rs b/src/chain/chaininterface.rs index 518b20b1..e08c8cdb 100644 --- a/src/chain/chaininterface.rs +++ b/src/chain/chaininterface.rs @@ -2,7 +2,8 @@ use bitcoin::blockdata::block::{Block, BlockHeader}; use bitcoin::blockdata::transaction::Transaction; use bitcoin::blockdata::script::Script; use bitcoin::util::hash::Sha256dHash; -use std::sync::{Mutex,Weak,MutexGuard}; +use util::logger::Logger; +use std::sync::{Mutex,Weak,MutexGuard,Arc}; use std::sync::atomic::{AtomicUsize, Ordering}; /// An interface to request notification of certain scripts as they appear the @@ -57,7 +58,12 @@ pub enum ConfirmationTarget { /// called from inside the library in response to ChainListener events, P2P events, or timer /// events). pub trait FeeEstimator: Sync + Send { - fn get_est_sat_per_vbyte(&self, confirmation_target: ConfirmationTarget) -> u64; + /// Gets estimated satoshis of fee required per 1000 Weight-Units. This translates to: + /// * satoshis-per-byte * 250 + /// * ceil(satoshis-per-kbyte / 4) + /// Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs + /// don't put us below 1 satoshi-per-byte). + fn get_est_sat_per_1000_weight(&self, confirmation_target: ConfirmationTarget) -> u64; } /// Utility to capture some common parts of ChainWatchInterface implementors. @@ -65,7 +71,8 @@ pub trait FeeEstimator: Sync + Send { pub struct ChainWatchInterfaceUtil { watched: Mutex<(Vec