bitcoin: use mut ref for start_rescan

This commit is contained in:
Michael Mallan 2024-09-04 10:53:29 +01:00
parent 69259c1236
commit 4c02b0d431
No known key found for this signature in database
GPG Key ID: 5177CDCEDB0EABEB
6 changed files with 10 additions and 10 deletions

View File

@ -1096,7 +1096,7 @@ impl BitcoinD {
}
pub fn start_rescan(
&self,
&mut self,
desc: &LianaDescriptor,
timestamp: u32,
) -> Result<(), BitcoindError> {

View File

@ -109,7 +109,7 @@ pub trait BitcoinInterface: Send {
/// Trigger a rescan of the block chain for transactions related to this descriptor since
/// the given date.
fn start_rescan(
&self,
&mut self,
desc: &descriptors::LianaDescriptor,
timestamp: u32,
) -> Result<(), String>;
@ -367,7 +367,7 @@ impl BitcoinInterface for d::BitcoinD {
}
fn start_rescan(
&self,
&mut self,
desc: &descriptors::LianaDescriptor,
timestamp: u32,
) -> Result<(), String> {
@ -481,7 +481,7 @@ impl BitcoinInterface for sync::Arc<sync::Mutex<dyn BitcoinInterface + 'static>>
}
fn start_rescan(
&self,
&mut self,
desc: &descriptors::LianaDescriptor,
timestamp: u32,
) -> Result<(), String> {

View File

@ -986,7 +986,7 @@ impl DaemonControl {
/// Trigger a rescan of the block chain for transactions involving our main descriptor between
/// the given date and the current tip.
/// The date must be after the genesis block time and before the current tip blocktime.
pub fn start_rescan(&self, timestamp: u32) -> Result<(), CommandError> {
pub fn start_rescan(&mut self, timestamp: u32) -> Result<(), CommandError> {
let mut db_conn = self.db.connection();
let genesis_timestamp = self.bitcoin.genesis_block_timestamp();

View File

@ -266,7 +266,7 @@ fn list_transactions(control: &DaemonControl, params: Params) -> Result<serde_js
Ok(serde_json::json!(&control.list_transactions(&txids)))
}
fn start_rescan(control: &DaemonControl, params: Params) -> Result<serde_json::Value, Error> {
fn start_rescan(control: &mut DaemonControl, params: Params) -> Result<serde_json::Value, Error> {
let timestamp: u32 = params
.get(0, "timestamp")
.ok_or_else(|| Error::invalid_params("Missing 'timestamp' parameter."))?
@ -365,7 +365,7 @@ fn get_labels(control: &DaemonControl, params: Params) -> Result<serde_json::Val
}
/// Handle an incoming JSONRPC2 request.
pub fn handle_request(control: &DaemonControl, req: Request) -> Result<Response, Error> {
pub fn handle_request(control: &mut DaemonControl, req: Request) -> Result<Response, Error> {
let result = match req.method.as_str() {
"broadcastspend" => {
let params = req

View File

@ -81,7 +81,7 @@ fn read_command(
// Handle all messages from this connection.
fn connection_handler(
control: DaemonControl,
mut control: DaemonControl,
mut stream: net::UnixStream,
shutdown: sync::Arc<atomic::AtomicBool>,
) -> Result<(), io::Error> {
@ -106,7 +106,7 @@ fn connection_handler(
log::trace!("JSONRPC request: {:?}", serde_json::to_string(&req));
let response =
api::handle_request(&control, req).unwrap_or_else(|e| Response::error(req_id, e));
api::handle_request(&mut control, req).unwrap_or_else(|e| Response::error(req_id, e));
log::trace!("JSONRPC response: {:?}", serde_json::to_string(&response));
if let Err(e) = serde_json::to_writer(&stream, &response) {
log::error!("Error writing response: '{}'", e);

View File

@ -109,7 +109,7 @@ impl BitcoinInterface for DummyBitcoind {
todo!()
}
fn start_rescan(&self, _: &descriptors::LianaDescriptor, _: u32) -> Result<(), String> {
fn start_rescan(&mut self, _: &descriptors::LianaDescriptor, _: u32) -> Result<(), String> {
todo!()
}