Skip to content

Conversation

@Godzilla-oss
Copy link

@Godzilla-oss Godzilla-oss commented Dec 30, 2025

  • modified: ignored return value of rescan_blockchain
  • check rescan status using get_wallet_info and exit accordingly
  • updates last_synced_height after rescan completes
  • log wallet's birth height and last_synced_height
  • ADDS info log at sync site for maker

@mojoX911
Copy link

mojoX911 commented Dec 30, 2025

Logs from an old wallet file.

$ ./target/debug/makerd 
2025-12-30T20:25:59.087842+05:30 INFO coinswap::utill - ✅ Logger initialized successfully
2025-12-30T20:25:59.094889756+05:30 INFO coinswap::maker::config - Successfully loaded config file from : /home/mojo/.coinswap/maker/config.toml
2025-12-30T20:25:59.097842429+05:30 INFO coinswap::watch_tower::watcher - Watcher initiated
2025-12-30T20:25:59.098656060+05:30 INFO coinswap::wallet::api - Loaded wallet from disk: 0 incoming_v2, 0 outgoing_v2 swapcoins
2025-12-30T20:25:59.100121607+05:30 INFO coinswap::wallet::api - Wallet file at "/home/mojo/.coinswap/maker/wallets/maker-wallet" successfully loaded.
2025-12-30T20:25:59.100531872+05:30 INFO coinswap::utill - Tor is fully started and operational!
2025-12-30T20:25:59.100732529+05:30 INFO coinswap::wallet::rpc - Initializing wallet sync and save for "maker-wallet"
2025-12-30T20:26:14.304655464+05:30 ERROR coinswap::wallet::rpc - Blockchain sync failed. Retrying. | Rpc(JsonRpc(Rpc(RpcError { code: -4, message: "Wallet already loading.", data: None })))
2025-12-30T20:26:17.306685264+05:30 ERROR coinswap::wallet::rpc - Blockchain sync failed. Retrying. | Rpc(JsonRpc(Rpc(RpcError { code: -4, message: "Wallet already loading.", data: None })))
2025-12-30T20:26:20.308701247+05:30 ERROR coinswap::wallet::rpc - Blockchain sync failed. Retrying. | Rpc(JsonRpc(Rpc(RpcError { code: -4, message: "Wallet already loading.", data: None })))
2025-12-30T20:26:23.310373750+05:30 ERROR coinswap::wallet::rpc - Blockchain sync failed. Retrying. | Rpc(JsonRpc(Rpc(RpcError { code: -4, message: "Wallet already loading.", data: None })))
2025-12-30T20:26:26.312245583+05:30 ERROR coinswap::wallet::rpc - Blockchain sync failed. Retrying. | Rpc(JsonRpc(Rpc(RpcError { code: -4, message: "Wallet already loading.", data: None })))
2025-12-30T20:26:29.313925689+05:30 ERROR coinswap::wallet::rpc - Blockchain sync failed. Retrying. | Rpc(JsonRpc(Rpc(RpcError { code: -4, message: "Wallet already loading.", data: None })))
2025-12-30T20:26:32.321593939+05:30 ERROR coinswap::wallet::rpc - Blockchain sync failed. Retrying. | Rpc(JsonRpc(Rpc(RpcError { code: -4, message: "Wallet already loading.", data: None })))
2025-12-30T20:26:33.583988485+05:30 ERROR coinswap::watch_tower::registry_storage - Failed to rename registry file "/home/mojo/.coinswap/maker/.maker_6102_watcher/signet.tmp" -> "/home/mojo/.coinswap/maker/.maker_6102_watcher/signet": No such file or directory (os error 2)
2025-12-30T20:26:35.327806664+05:30 INFO coinswap::wallet::rpc - Importing Wallet spks/descriptors
2025-12-30T20:26:36.462435286+05:30 INFO coinswap::wallet::rpc - Initializing TxOut scan. This may take a while.
2025-12-30T20:26:36.462731240+05:30 INFO coinswap::wallet::rpc - Re-scanning Blockchain from:2728191 to:2741539
2025-12-30T20:26:51.687905995+05:30 INFO coinswap::wallet::rpc - Scanning for 15s - 0.00%
2025-12-30T20:26:52.725035683+05:30 ERROR coinswap::watch_tower::registry_storage - Failed to rename registry file "/home/mojo/.coinswap/maker/.maker_6102_watcher/signet.tmp" -> "/home/mojo/.coinswap/maker/.maker_6102_watcher/signet": No such file or directory (os error 2)
2025-12-30T20:26:54.688706867+05:30 INFO coinswap::wallet::rpc - Scanning for 18s - 0.00%
2025-12-30T20:26:57.689489786+05:30 INFO coinswap::wallet::rpc - Scanning for 21s - 0.00%
2025-12-30T20:27:00.690273443+05:30 INFO coinswap::wallet::rpc - Scanning for 24s - 0.00%
2025-12-30T20:27:03.691073156+05:30 INFO coinswap::wallet::rpc - Scanning for 27s - 0.00%
2025-12-30T20:27:06.691870614+05:30 INFO coinswap::wallet::rpc - Scanning for 30s - 0.00%
2025-12-30T20:27:09.692638526+05:30 INFO coinswap::wallet::rpc - Scanning completed

A few things:

  • Sync progress does not seem to be updating.
  • Someone else triggered the sync loop while the initial sync was going on.
  • A log of what the wallet's birth height and last_synced_height are at the wallet init() function would be helpful.

@Godzilla-oss
Copy link
Author

For some reason, the API is not updating the progress; it only updates when the scan is finished.

@mojoX911
Copy link

Okay then leave it. Add a todo comment there saying "Currently progress is not showing, figure out how to display progress here".

@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

❌ Patch coverage is 87.03704% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.13%. Comparing base (776b75d) to head (675925c).
⚠️ Report is 78 commits behind head on master.

Files with missing lines Patch % Lines
src/wallet/rpc.rs 78.26% 5 Missing ⚠️
src/maker/rpc/server.rs 0.00% 1 Missing ⚠️
src/wallet/api.rs 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #676      +/-   ##
==========================================
+ Coverage   68.87%   78.13%   +9.25%     
==========================================
  Files          35       49      +14     
  Lines        4932    15172   +10240     
==========================================
+ Hits         3397    11854    +8457     
- Misses       1535     3318    +1783     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Godzilla-oss
Copy link
Author

Godzilla-oss commented Dec 31, 2025

2025-12-31T17:57:44.786014407+05:30 INFO coinswap::utill - Tor is fully started and operational!
2025-12-31T17:57:44.786743407+05:30 INFO coinswap::maker::api - ----------Maker init----------
2025-12-31T17:57:44.786832407+05:30 INFO coinswap::wallet::rpc - Initializing wallet sync and save for "maker-wallet"
2025-12-31T17:57:44.795521510+05:30 INFO coinswap::wallet::rpc - previus Scanning completed
2025-12-31T17:57:44.795622410+05:30 INFO coinswap::wallet::rpc - ------------started sync------------
2025-12-31T17:57:46.397390516+05:30 INFO coinswap::wallet::rpc - Re-scanning Blockchain from:2733625 to:2743928
2025-12-31T17:58:01.421064260+05:30 INFO coinswap::wallet::rpc - Scanning for 15s
2025-12-31T17:58:04.424113503+05:30 INFO coinswap::wallet::rpc - Scanning for 18s
2025-12-31T17:58:07.462018801+05:30 INFO coinswap::wallet::rpc - Scanning for 21s
2025-12-31T17:58:10.463192535+05:30 INFO coinswap::wallet::rpc - Scanning for 24s
2025-12-31T17:58:13.471905405+05:30 INFO coinswap::wallet::rpc - Scanning for 27s
2025-12-31T17:58:16.473056739+05:30 INFO coinswap::wallet::rpc - Scanning for 30s
2025-12-31T17:58:19.472767200+05:30 INFO coinswap::wallet::rpc - Scanning completed
2025-12-31T17:58:19.476205901+05:30 INFO coinswap::wallet::api - Searching for unfinished swapcoins: 0 incoming, 0 outgoing in store
2025-12-31T17:58:19.476314601+05:30 INFO coinswap::wallet::api - Saving wallet to disk: 0 incoming_v2, 0 outgoing_v2 swapcoins
2025-12-31T17:58:19.477011301+05:30 INFO coinswap::wallet::rpc - Completed wallet sync and save for "maker-wallet"
2025-12-31T17:58:19.477218001+05:30 INFO makerd - ------start_maker_server--------
2025-12-31T17:58:19.477356801+05:30 INFO coinswap::maker::server - Starting Maker Server
2025-12-31T17:58:19.477802701+05:30 INFO coinswap::maker::server - -----------network_bootstrap---------
2025-12-31T17:58:19.577460339+05:30 INFO coinswap::utill - Generated existing Tor Hidden Service Hostname: gya4ul4js5odzhjrxqshbgbzs7g3ln4ogkqja2shm4agow6rk2k7wzyd.onion
2025-12-31T17:58:19.583584441+05:30 INFO coinswap::wallet::fidelity - Fidelity Bond found | Index: 1 | Bond Value : 0.00000694 BTC
2025-12-31T17:58:19.593638445+05:30 INFO coinswap::maker::server - Highest bond at outpoint ee6753df82f9cb70b46bde0899b01c4d2946050dbf5641ecd40b7bb7fdc2540c:0 | index 1 | Amount 50000 sats | Remaining Timelock for expiry : 10602 Blocks | Current Bond Value : 694 sats
2025-12-31T17:58:21.072811104+05:30 INFO coinswap::maker::server - nostr relay wss://nos.lol accepted event d666bcc68455333c51916d00891c514789e1c21321697ee5a7cbf3102b8440b0
2025-12-31T17:58:21.077998206+05:30 INFO coinswap::wallet::api - Saving wallet to disk: 0 incoming_v2, 0 outgoing_v2 swapcoins
2025-12-31T17:58:21.079346907+05:30 INFO coinswap::maker::server - -------------check_swap_liquidity--------------
2025-12-31T17:58:21.079422307+05:30 INFO coinswap::wallet::rpc - Initializing wallet sync and save for "maker-wallet"
2025-12-31T17:58:21.080728107+05:30 INFO coinswap::wallet::rpc - previus Scanning completed
2025-12-31T17:58:21.080899907+05:30 INFO coinswap::wallet::rpc - ------------started sync------------
2025-12-31T17:58:22.951765659+05:30 INFO coinswap::wallet::rpc - Re-scanning Blockchain from:2733625 to:2743929
2025-12-31T17:58:38.055711626+05:30 INFO coinswap::wallet::rpc - Scanning for 15s
2025-12-31T17:58:41.056901760+05:30 INFO coinswap::wallet::rpc - Scanning for 18s
2025-12-31T17:58:44.061036460+05:30 INFO coinswap::wallet::rpc - Scanning for 21s
2025-12-31T17:58:47.062108394+05:30 INFO coinswap::wallet::rpc - Scanning for 24s
2025-12-31T17:58:50.061957335+05:30 INFO coinswap::wallet::rpc - Scanning for 27s
2025-12-31T17:58:53.072235418+05:30 INFO coinswap::wallet::rpc - Scanning for 30s
2025-12-31T17:58:56.073396952+05:30 INFO coinswap::wallet::rpc - Scanning completed
2025-12-31T17:58:56.076485053+05:30 INFO coinswap::wallet::api - Searching for unfinished swapcoins: 0 incoming, 0 outgoing in store
2025-12-31T17:58:56.076592153+05:30 INFO coinswap::wallet::api - Saving wallet to disk: 0 incoming_v2, 0 outgoing_v2 swapcoins
2025-12-31T17:58:56.077413054+05:30 INFO coinswap::wallet::rpc - Completed wallet sync and save for "maker-wallet"
2025-12-31T17:58:56.077549254+05:30 INFO coinswap::maker::server - Swap Liquidity: 48722 sats | Min: 10000 sats | Listening for requests.
2025-12-31T17:58:56.077619254+05:30 INFO coinswap::maker::server - [6102] Bitcoin Network: signet
2025-12-31T17:58:56.078081754+05:30 INFO coinswap::wallet::api - Searching for unfinished swapcoins: 0 incoming, 0 outgoing in store
  • I don’t think some other function is trying to call the sync while Maker init is going on. Output for reference with info logs.

@Godzilla-oss Godzilla-oss force-pushed the sync-bug branch 2 times, most recently from 71259d0 to ca7bd4f Compare December 31, 2025 13:11
@Godzilla-oss
Copy link
Author

Sync progress is not included in this PR, the progress always returns 0.00%.

@Godzilla-oss Godzilla-oss marked this pull request as ready for review January 1, 2026 09:44
Copy link

@mojoX911 mojoX911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack

Copy link

@mojoX911 mojoX911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following few things can be ironed out.

in the maker::api2::init()

 log::info!("Initializing wallet sync");
        wallet.sync_and_save()?;
        log::info!("Completed wallet sync");

Just keep the site log with the current new format. Remove the completion log. As its already printed in sync_and_save() internals.

in the maker::server::shutdown section

    log::info!("Shutdown wallet sync initiated.");
    maker.get_wallet().write()?.sync_and_save()?;
    log::info!("Shutdown wallet syncing completed.");
    log::info!("Wallet file saved to disk.");

Just keep the site log and remove other logs.

In the wallet::sync_and_save() function

log::info!(
            "Initializing wallet sync and save for {:?}",
            &self.store.file_name
        );
        self.sync_no_fail();
        self.save_to_disk()?;
        log::info!(
            "Completed wallet sync and save for {:?}",
            &self.store.file_name
        );

Shorten the logs as below.
Sync Started for {wallet name}
Synced & Saved {wallet name}

In the maker::server2::shutdown.
We are not syncing at the end. We should.

@Godzilla-oss Godzilla-oss force-pushed the sync-bug branch 2 times, most recently from ed184e4 to 70408d6 Compare January 3, 2026 14:07
stark-3k and others added 2 commits January 4, 2026 00:07
- modified: ignored return value of rescan_blockchain
- check rescan status using get_wallet_info and exit accordingly
- updates last_synced_height after rescan completes
- log wallet's birth height and last_synced_height
- ADDS info log at sync site for maker
- Changes: `refresh_offer_maxsize_cache` calculation from spendable to max(swap, regular)
- Changes: `fn check_swap_liquidity` to use `refresh_offer_maxsize_cache`
insted of `sync_and_save`
- Udates: `fn check_swap_liquidity_taproot` to use `refresh_offer_maxsize_cache`
- Remove `sync_and_save` from update_fidelity_bond_conf_details
- Adds sync_and_save to test
Copy link

@mojoX911 mojoX911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack

@mojoX911 mojoX911 merged commit cebc1ab into citadel-tech:master Jan 3, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants