Conversation
| #[rpc(server)] | ||
| pub(crate) trait Rpc { | ||
| /// Returns wallet status information. | ||
| #[method(name = "getwalletstatus")] |
There was a problem hiding this comment.
I named it thusly because @oxarbitrage suggested walletstatus but get* fits better with existing naming. But is getwalletstatus both sufficiently clear vs getwalletinfo, and non-colliding with existing Bitcoin JSON-RPC names?
There was a problem hiding this comment.
I think this is fine. There is no getwalletstatus in Bitcoin and i think the name is clear enough.
eb16fc7 to
7838054
Compare
| /// The height to which the wallet is fully synced. | ||
| /// | ||
| /// The wallet only has a partial view of chain data above this height. | ||
| /// | ||
| /// Omitted if the wallet does not have any accounts or birthday data and thus has | ||
| /// nowhere to sync from, or if the wallet birthday itself has not yet been synced. | ||
| /// The latter occurs when a recovered wallet first starts and is scanning the chain | ||
| /// tip region. | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| fully_synced_height: Option<u32>, |
There was a problem hiding this comment.
Currently what happens is:
- Accounts to recover are loaded into the wallet/
- Wallet scans the chain tip region.
fully_synced_height = Nonebecause the wallet birthday height has not been scanned.- This takes quite a while.
- Once the chain tip region is scanned, the next scan range is the birthday height.
fully_synced_heightis now set.
Should instead fully_synced_height be non-optional and set to the last ignored height, or as a fallback the genesis block?
There was a problem hiding this comment.
From an implementer’s perspective, optional fields are generally harder to work with, since the client needs to check for their presence before accessing them. They can also make responses more confusing in some cases.
In general, I tend to prefer having fields always present, but Zcash already uses this pattern in several places, so I think it’s fine as long as the behavior is clearly documented.
There was a problem hiding this comment.
Having it be present-but-null vs not-present-if-null is a different question than the one I was asking.
My question was, should None be an allowable value here, or should we instead return something else?
There was a problem hiding this comment.
Thanks for clarifying. I think returning the genesis block, the birthday block, or anything similar would also be confusing, so I prefer keeping None as you have it. Whatever we decide, I think it would be good to document this
behaviour in the field's description.
| // TODO: Replace these with accurate unscanned note counts, which we can determine | ||
| // because Zallet tracks the chain tip very closely. | ||
| progress_numerator: u64, | ||
| progress_denominator: u64, |
There was a problem hiding this comment.
These are temporary because it's all I have access to currently. Given that Zallet is intended to track the backing node's chain tip as closely as possible, once #237 is done we will always know the size of the note commitment trees, and thus it should always be possible to determine how many leaves within them have not yet been appended (and thus are unscanned).
Closes #316.
7838054 to
91ce9f5
Compare
|
Hey, thanks for adding this, looking good. I’ve been trying to integrate this into the Zebra QA framework so we can get rid of several anti-pattern sleeps. In particular, I was experimenting with using it in this test: The test passes most of the time, but occasionally it gets stuck in scenarios like this: In this case, I’m waiting for the node tip and wallet tip to match before proceeding, but that never happens unless I mine a new block (which then triggers the Zallet scan to advance). I’m not fully sure yet whether this is an issue in the test logic or something on the Zallet side. Any ideas or pointers would be very welcome. I’ll keep digging to find the root cause as well. Happy to continue reviewing and approve once I can get this sorted out. Thanks! |
| progress_numerator: u64, | ||
| progress_denominator: u64, |
There was a problem hiding this comment.
| progress_numerator: u64, | |
| progress_denominator: u64, | |
| progress: (numerator: u64, denominator: u64), |
Optional: These fields are closely related. Maybe consider grouping them into a tuple or a small type.
My guess is this will be fixed as part of #336. So I think we should get zcash/integration-tests#1 merged, then test applying this PR to its current state, and then test #336 after merging this PR. |
Closes #316.
Closes COR-338.