asyncnotedecryption #389

Open
duke wants to merge 14 commits from asyncnotedecryption into dev
duke commented 2 months ago
Owner

Making a PR for @fekt 's work to make it easier for others to review what is changing

Making a PR for @fekt 's work to make it easier for others to review what is changing
duke added 8 commits 2 months ago
duke added 1 commit 2 months ago
duke added 1 commit 2 months ago
duke added 1 commit 2 months ago
duke added 1 commit 2 months ago
c06f6505d3 Fix remaining compile errors
Poster
Owner

Compile errors are fixed on this branch, I think it's time to test it. One test can be to send zaddr funds to a zaddr in a different wallet and make sure the correct amount shows up. And to make sure it can received zaddr funds from a different wallet (running dev or latest release). Another test can be to run z_getbalances with at least 2 zaddrs with balances on the dev branch and then do a fresh sync with this branch with the same wallet and see if the same zaddrs with correct balances show up.

Compile errors are fixed on this branch, I think it's time to test it. One test can be to send zaddr funds to a zaddr in a different wallet and make sure the correct amount shows up. And to make sure it can received zaddr funds from a different wallet (running dev or latest release). Another test can be to run `z_getbalances` with at least 2 zaddrs with balances on the dev branch and then do a fresh sync with this branch with the same wallet and see if the same zaddrs with correct balances show up.
Collaborator

Spinning up a couple nodes to test.

Spinning up a couple nodes to test.
Collaborator

Seems to have bugs. Sending from dev > asyncnotedecrpytion and the balance never shows up. If I try a rescan from hush-cli, I get this too:

hushd: wallet/wallet.cpp:2896: int CWallet::ScanForWalletTransactions(CBlockIndex*, bool): Assertion `pcoinsTip->GetSaplingAnchorAt(pindex->pprev->hashFinalSaplingRoot, saplingTree)' failed.
Seems to have bugs. Sending from `dev` > `asyncnotedecrpytion` and the balance never shows up. If I try a rescan from hush-cli, I get this too: ``` hushd: wallet/wallet.cpp:2896: int CWallet::ScanForWalletTransactions(CBlockIndex*, bool): Assertion `pcoinsTip->GetSaplingAnchorAt(pindex->pprev->hashFinalSaplingRoot, saplingTree)' failed. ```
Poster
Owner

@fekt I would not despair, my guess is that the code is 50-75% complete. There is more code to port and things don't work without it.

The assertion error above about the sapling anchor basically means metadata about the state of zaddr transactions is inconsistent, i.e. the previous block's hashFinalSaplingRoot isn't the same as saplingTree which means something is wrong.

One way to debug and move forward is to add some debug prints to see if the async code is even running. My guess is it might not be, which would explain the assertion error about hashFinalSaplingRoot not matching saplingTree

@fekt I would not despair, my guess is that the code is 50-75% complete. There is more code to port and things don't work without it. The assertion error above about the sapling anchor basically means metadata about the state of zaddr transactions is inconsistent, i.e. the previous block's `hashFinalSaplingRoot` isn't the same as `saplingTree` which means something is wrong. One way to debug and move forward is to add some debug prints to see if the async code is even running. My guess is it might not be, which would explain the assertion error about `hashFinalSaplingRoot` not matching `saplingTree`
Collaborator

FindMySaplingNotesAsync does get called by default regularly when syncing and rescanning it seems. May need to add more debugging though.

Also, that coredump was with running ./hush-cli rescan without any height. It took awhile to rescan from genesis after, but is expected.

After the rescan finished from coredumping, the balance still did not display. I just tested rescanning again specifying a height shortly before tx was sent and balance showed up. Seems to be partially working, but maybe only after a rescan.

Testing another tx from dev > asyncnotedecrpytion to see if it shows up automatically this time.

`FindMySaplingNotesAsync` does get called by default regularly when syncing and rescanning it seems. May need to add more debugging though. Also, that coredump was with running `./hush-cli rescan` without any height. It took awhile to rescan from genesis after, but is expected. After the rescan finished from coredumping, the balance still did not display. I just tested rescanning again specifying a height shortly before tx was sent and balance showed up. Seems to be partially working, but maybe only after a rescan. Testing another tx from `dev` > `asyncnotedecrpytion` to see if it shows up automatically this time.
Collaborator

Sending from asyncnotedecrpytion > dev and balance shows up on dev but does not update on asyncnotedecrpytion without a rescan.

I sent back from dev to asyncnotedecrpytion and balance on asyncnotedecrpytion only shows after a rescan.

From what I can tell, it seems FindMySaplingNotesAsync is only called on initial startup sync and rescans. Guessing whatever is responsible for checking new blocks for txs the wallet owns needs some changes.

Testing fresh sync with wallet from asyncnotedecrpytion on dev branch now to see what happens.

Sending from `asyncnotedecrpytion` > `dev` and balance shows up on `dev` but does not update on `asyncnotedecrpytion` without a rescan. I sent back from `dev` to `asyncnotedecrpytion` and balance on `asyncnotedecrpytion` only shows after a rescan. From what I can tell, it seems `FindMySaplingNotesAsync` is only called on initial startup sync and rescans. Guessing whatever is responsible for checking new blocks for txs the wallet owns needs some changes. Testing fresh sync with wallet from `asyncnotedecrpytion` on `dev` branch now to see what happens.
Poster
Owner

@fekt from what you describe, it sounds like things partially work and what is missing is making sure incoming zfunds are recognized without a rescan.

I think this may be the missing code you need to port: e7a19a8f94

@fekt from what you describe, it sounds like things partially work and what is missing is making sure incoming zfunds are recognized without a rescan. I think this may be the missing code you need to port: https://github.com/ycashfoundation/ycash/commit/e7a19a8f9461e2138f7da09d7c92b522412d3d49
Collaborator

@duke Thanks for the tip. I was diff checking BuildWitnessCache previously and thought that may be it. I wasn't sure what was responsible for checking if a tx belonged to a wallet when new blocks come in and was going to check with you. Will try porting that code over to see if things work.

A fresh sync with wallet from asyncnotedecrpytion on dev did show balances fine so it's just this piece that seems to be missing.

@duke Thanks for the tip. I was diff checking `BuildWitnessCache` previously and thought that may be it. I wasn't sure what was responsible for checking if a tx belonged to a wallet when new blocks come in and was going to check with you. Will try porting that code over to see if things work. A fresh sync with wallet from `asyncnotedecrpytion` on `dev` did show balances fine so it's just this piece that seems to be missing.
fekt added 1 commit 2 months ago
63b5513781 Porting AddToSifted() and AppendSingleSaplingCommitment()
duke added 1 commit 23 hours ago
This pull request can be merged automatically.
You are not authorized to merge this pull request.
Sign in to join this conversation.
Loading…
There is no content yet.