X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fchain%2Fchaininterface.rs;h=bda99b2d83c2d47ecf95a274b9cdc412f47db705;hb=refs%2Fheads%2F2018-08-secp-0.10;hp=f99f581f133a4fea18642c152444418d250a25f1;hpb=de523c4ca38c4f671df11fa4c7f5781ba0ab00fc;p=rust-lightning diff --git a/src/chain/chaininterface.rs b/src/chain/chaininterface.rs index f99f581f..bda99b2d 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 @@ -12,7 +13,7 @@ use std::sync::atomic::{AtomicUsize, Ordering}; /// events). pub trait ChainWatchInterface: Sync + Send { /// Provides a scriptPubKey which much be watched for. - fn install_watch_script(&self, script_pub_key: Script); + fn install_watch_script(&self, script_pub_key: &Script); /// Provides an outpoint which must be watched for, providing any transactions which spend the /// given outpoint. @@ -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,14 +71,15 @@ pub trait FeeEstimator: Sync + Send { pub struct ChainWatchInterfaceUtil { watched: Mutex<(Vec