monero-project / monero

Monero: the secure, private, untraceable cryptocurrency
https://getmonero.org
Other
8.92k stars 3.1k forks source link

Scan_tx stucks on newer versions #9354

Open sharifzadesina opened 4 months ago

sharifzadesina commented 4 months ago

It seems because of this todo, Scan_tx gets stuck when trying to scan transactions before syncing wallet.

It is related to woodser/monero-ts#212.

woodser commented 4 months ago

Essentially the issue is that calling scan_tx also calls refresh which syncs the entire blockchain starting from the tx height.

So this issue is requesting to scan the minimum necessary.

sharifzadesina commented 4 months ago

@0xFFFC0000 Excuse me, but Is this considered a "question"? because literally scan_tx takes 10 (or more) minutes to run.

0xFFFC0000 commented 4 months ago

@sharifzadesina thank you for reporting this. We will take a look into this.

  1. This happened after specific updates?
  2. Have you tried on other systems with other configurations too, and problem was still present?

In the meantime it appears to me @woodser has explained the actual reason.

selsta commented 4 months ago

Issue got introduced here: https://github.com/monero-project/monero/pull/8566

j-berman commented 4 months ago

The expected behavior:

The problem: scan_tx calls refresh(), which can take a long time to complete even if the wallet's restore height is set to the current height.

This needs confirmation (repro with the RPC and observe the logs), but I believe refresh is slow to complete even when setting restore height to current height because it's taking a while to get all block hashes from the chain starting from genesis.

Assuming this is the general issue (long-running refresh in scan_tx), the simplest fix for this is probably to remove the call to refresh in scan_tx, which means the wallet won't have the latest chain state upon completion of scan_tx. This is probably ok and expected.

The more involved fix is to refactor fast_refresh and scanning to not need all block hashes from the chain, and to only need hashes starting from the wallet's restore height. The Seraphis lib does this refactoring already, which we're in the process of migrating toward, so I would lean towards the simpler fix for now.

sharifzadesina commented 4 months ago

@j-berman Exactly, Thank you.

Even when I set restore height to a higher value, it takes too long to finish.

sharifzadesina commented 3 months ago

Bump! any update on this?

j-berman commented 3 months ago

Will fix by end of this week

sharifzadesina commented 3 months ago

@j-berman Thank you, I wish I could help, I just don't know C++,