|
|
@ -77,6 +77,7 @@ struct Connection { |
|
|
|
addr: SocketAddr, |
|
|
|
chan: SyncChannel<Message>, |
|
|
|
stats: Arc<Stats>, |
|
|
|
relayfee: f64, |
|
|
|
} |
|
|
|
|
|
|
|
impl Connection { |
|
|
@ -85,6 +86,7 @@ impl Connection { |
|
|
|
stream: TcpStream, |
|
|
|
addr: SocketAddr, |
|
|
|
stats: Arc<Stats>, |
|
|
|
relayfee: f64, |
|
|
|
) -> Connection { |
|
|
|
Connection { |
|
|
|
query, |
|
|
@ -94,6 +96,7 @@ impl Connection { |
|
|
|
addr, |
|
|
|
chan: SyncChannel::new(10), |
|
|
|
stats, |
|
|
|
relayfee, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -195,7 +198,7 @@ impl Connection { |
|
|
|
} |
|
|
|
|
|
|
|
fn blockchain_relayfee(&self) -> Result<Value> { |
|
|
|
Ok(json!(0.0)) // allow sending transactions with any fee.
|
|
|
|
Ok(json!(self.relayfee)) |
|
|
|
} |
|
|
|
|
|
|
|
fn blockchain_scripthash_subscribe(&mut self, params: &[Value]) -> Result<Value> { |
|
|
@ -526,7 +529,7 @@ impl RPC { |
|
|
|
chan |
|
|
|
} |
|
|
|
|
|
|
|
pub fn start(addr: SocketAddr, query: Arc<Query>, metrics: &Metrics) -> RPC { |
|
|
|
pub fn start(addr: SocketAddr, query: Arc<Query>, metrics: &Metrics, relayfee: f64) -> RPC { |
|
|
|
let stats = Arc::new(Stats { |
|
|
|
latency: metrics.histogram_vec( |
|
|
|
HistogramOpts::new("electrs_electrum_rpc", "Electrum RPC latency (seconds)"), |
|
|
@ -563,7 +566,7 @@ impl RPC { |
|
|
|
|
|
|
|
spawn_thread("peer", move || { |
|
|
|
info!("[{}] connected peer #{}", addr, handle_id); |
|
|
|
let conn = Connection::new(query, stream, addr, stats); |
|
|
|
let conn = Connection::new(query, stream, addr, stats, relayfee); |
|
|
|
senders |
|
|
|
.lock() |
|
|
|
.unwrap() |
|
|
|