lightwalletd icon indicating copy to clipboard operation
lightwalletd copied to clipboard

use getblock verbose=3 instead of two getblock calls

Open LarryRuane opened this issue 2 years ago • 1 comments

If available, use getblock verbose=3. If not available, use the old way, which requires making two getblock RPCs. This is only a performance improvement.

After the EOL of the latest version that doesn't support verbose=3, this code can be simplified to only do the verbose=3 form (since it will be guaranteed to be implemented in zcashd).

This still needs a unit test, but seeking a concept and approach ACKs first.

See also #392 and corresponding PR https://github.com/zcash/zcash/pull/6747. These PRs can be merged and deployed in either order.

LarryRuane avatar Aug 09 '23 02:08 LarryRuane

Force-pushed rebase, then another (23f18895e4f4bd9c11d6888afc16f96c20a396a9) to implement a performance improvement for the case that zcashd hasn't been updated to support getblock verbose=3. The case of a non-upgraded zcashd was handled before this force-push, but lightwalletd would do three RPCs for each block that was fetched:

  1. try getblock v=3
  2. it failed, so getblock v=1 (as is done before this PR)
  3. getblock v=0 (as before this PR)

The whole idea of this PR is to improve performance; we don't want to make it worse in a (temporarily) common situation. With this force-push, lightwalletd will try getblock v=3, and if it fails, remember that, so from then on it only does steps 2 and 3. (Of course, if getblock v=3 works, then we're done, no more RPCs are needed for this block.)

This code can be removed when the last zcashd version that doesn't support v=3 hits end-of-life.

LarryRuane avatar Mar 29 '24 18:03 LarryRuane