Skip to content

Commit bf2eddf

Browse files
committed
nit: remove sync call during taker initialization
1 parent 878cf12 commit bf2eddf

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

src/bin/taker.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ fn main() -> Result<(), TakerError> {
221221
#[cfg(feature = "integration-test")]
222222
TaprootTakerBehavior::Normal,
223223
)?;
224+
// Sync and save the wallet data after initialization
225+
taproot_taker.get_wallet_mut().sync_and_save()?;
224226

225227
let taproot_swap_params = coinswap::taker::api2::SwapParams {
226228
send_amount: Amount::from_sat(*amount),
@@ -247,6 +249,8 @@ fn main() -> Result<(), TakerError> {
247249
args.zmq,
248250
args.password,
249251
)?;
252+
// Sync and save the wallet data after initialization
253+
taker.get_wallet_mut().sync_and_save()?;
250254
match &args.command {
251255
Commands::ListUtxo => {
252256
let utxos = taker.get_wallet().list_all_utxo_spend_info();

src/taker/api.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ impl Taker {
247247

248248
let watch_service = WatchService::new(tx_requests, rx_responses);
249249

250-
let mut wallet = Wallet::load_or_init_wallet(&wallet_path, &rpc_config, password)?;
250+
let wallet = Wallet::load_or_init_wallet(&wallet_path, &rpc_config, password)?;
251251

252252
// If config file doesn't exist, default config will be loaded.
253253
let mut config = TakerConfig::new(Some(&data_dir.join("config.toml")))?;
@@ -276,8 +276,6 @@ impl Taker {
276276
)
277277
.start();
278278

279-
wallet.sync_and_save()?;
280-
281279
Ok(Self {
282280
wallet,
283281
config,

src/taker/api2.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl Taker {
280280

281281
let watch_service = WatchService::new(tx_requests, rx_responses);
282282

283-
let mut wallet = if wallet_path.exists() {
283+
let wallet = if wallet_path.exists() {
284284
let wallet = Wallet::load(&wallet_path, &rpc_config, password)?;
285285
log::info!("Loaded wallet from {}", wallet_path.display());
286286
wallet
@@ -312,10 +312,6 @@ impl Taker {
312312
)
313313
.start();
314314

315-
log::info!("Initializing wallet sync...");
316-
wallet.sync_and_save()?;
317-
log::info!("Completed wallet sync");
318-
319315
Ok(Self {
320316
wallet,
321317
config,

0 commit comments

Comments
 (0)