-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zcash_client_sqlite: Align handling of transparent UTXOs with that of shielded notes. #1402
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1402 +/- ##
==========================================
+ Coverage 63.13% 63.20% +0.06%
==========================================
Files 127 128 +1
Lines 14864 14869 +5
==========================================
+ Hits 9385 9398 +13
+ Misses 5479 5471 -8 ☔ View full report in Codecov by Sentry. |
zcash_client_sqlite/src/wallet/init/migrations/receiving_key_scopes.rs
Outdated
Show resolved
Hide resolved
77fe74d
to
baa2ad3
Compare
acedca8
to
bf86c08
Compare
bf86c08
to
648df30
Compare
ae834bc
to
0eb0b3f
Compare
zcash_client_sqlite/src/wallet/init/migrations/utxos_to_txos.rs
Outdated
Show resolved
Hide resolved
0eb0b3f
to
ddbe993
Compare
3e28b19
to
4ba438c
Compare
…`wallet::transparent` module.
… shielded notes. Co-authored-by: Daira-Emma Hopwood <[email protected]> Co-authored-by: Jack Grigg <[email protected]>
4ba438c
to
10258b8
Compare
@@ -525,7 +523,12 @@ impl<C: Borrow<rusqlite::Connection>, P: consensus::Parameters> WalletRead for W | |||
account: AccountId, | |||
max_height: BlockHeight, | |||
) -> Result<HashMap<TransparentAddress, NonNegativeAmount>, Self::Error> { | |||
wallet::get_transparent_balances(self.conn.borrow(), &self.params, account, max_height) | |||
wallet::transparent::get_transparent_address_balances( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this renaming the function in wallet::transparent
so that it doesn't match the trait method? I think that for all of the other functions there that correspond to trait methods, the names do match.
(Currently I'm renaming it back in #1257, because I hadn't previously noticed that the change was made here.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When moving the methods, I got confused about the meaning of get_transparent_balances
vs get_transparent_account_balance
and I wanted to clarify. I didn't want to change the top-level trait method, but since this is crate-private I thought that it was a good start.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want me to undo renaming it back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel strongly about it.
/// Originally this table only stored the current UTXO set (as of latest refresh), and the | ||
/// table was cleared prior to loading in the latest UTXO set. We now upsert instead of | ||
/// insert into the database, meaning that spent outputs are left in the database. This | ||
/// makes it similar to the `*_received_notes` tables in that it can store history, but | ||
/// has several downsides: | ||
/// - The table has incomplete contents for recovered-from-seed wallets. | ||
/// - The table can have inconsistent contents for seeds loaded into multiple wallets | ||
/// makes it similar to the `*_received_notes` tables in that it can store history. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Originally this table, when it was called utxos
, ..." (Non-blocking.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 10258b8 with nit about tracing spans. I did not review the codebase outside of what is already changed in this PR to look for other places in e.g. the SQL queries that might need to be altered.
WHERE ( | ||
t.mined_height < :mempool_height -- tx is mined | ||
OR t.expiry_height = 0 -- tx will not expire | ||
OR t.expiry_height >= :mempool_height | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Observation: The other minconf-0 instances of this pattern use t.mined_height <= SOME_HEIGHT OR t.expiry_height >= SOME_HEIGHT
. I think it's okay to use < :mempool_height
here however, solely because we never actually encounter the off-by-one here (because we encode mempool heights in the database as NULL
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-utACK 5c8f585
zcash_client_sqlite/src/wallet/db.rs
Outdated
ro.account_id AS to_account_id, | ||
sent_notes.to_address AS to_address, | ||
sent_notes.value AS value, | ||
0 AS is_change, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just occurs to me, will this be correct behavior after ZIP 320 integration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why not, but we should test it. Note that put_transparent_output
is called from store_sent_tx
for ephemeral outputs.
Co-authored-by: Jack Grigg <[email protected]> Co-authored-by: Daira-Emma Hopwood <[email protected]>
5c8f585
to
9716617
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 9716617
This PR is best reviewed hiding whitespace changes.