Skip to content
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: Fix sent note recipient constraint #1321

Merged
merged 2 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions zcash_client_sqlite/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,20 @@ and this library adheres to Rust's notion of

## [Unreleased]

## [0.10.1] - 2024-03-25

### Fixed
- The `sent_notes` table's `received_note` constraint was excessively restrictive
after zcash/librustzcash#1306. Any databases that have migrations from
zcash_client_sqlite 0.10.0 applied should be wiped and restored from seed.
In order to ensure that the incorrect migration is not used, the migration
id for the `full_account_ids` migration has been changed from
`0x1b104345_f27e_42da_a9e3_1de22694da43` to `0x6d02ec76_8720_4cc6_b646_c4e2ce69221c`

## [0.10.0] - 2024-03-25

This version was yanked, use 0.10.1 instead.

### Added
- A new `orchard` feature flag has been added to make it possible to
build client code without `orchard` dependendencies.
Expand Down
2 changes: 1 addition & 1 deletion zcash_client_sqlite/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "zcash_client_sqlite"
description = "An SQLite-based Zcash light client"
version = "0.10.0"
version = "0.10.1"
authors = [
"Jack Grigg <[email protected]>",
"Kris Nuttycombe <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion zcash_client_sqlite/src/wallet/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ mod tests {
FOREIGN KEY (to_account_id) REFERENCES accounts(id),
CONSTRAINT tx_output UNIQUE (tx, output_pool, output_index),
CONSTRAINT note_recipient CHECK (
(to_address IS NOT NULL) != (to_account_id IS NOT NULL)
(to_address IS NOT NULL) OR (to_account_id IS NOT NULL)
)
)"#,
// Internal table created by SQLite when we started using `AUTOINCREMENT`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use super::{

/// The migration that switched from presumed seed-derived account IDs to supporting
/// HD accounts and all sorts of imported keys.
pub(super) const MIGRATION_ID: Uuid = Uuid::from_u128(0x1b104345_f27e_42da_a9e3_1de22694da43);
pub(super) const MIGRATION_ID: Uuid = Uuid::from_u128(0x6d02ec76_8720_4cc6_b646_c4e2ce69221c);

pub(crate) struct Migration<P: consensus::Parameters> {
pub(super) seed: Option<Rc<SecretVec<u8>>>,
Expand Down Expand Up @@ -329,7 +329,7 @@ impl<P: consensus::Parameters> RusqliteMigration for Migration<P> {
FOREIGN KEY (to_account_id) REFERENCES accounts(id),
CONSTRAINT tx_output UNIQUE (tx, output_pool, output_index),
CONSTRAINT note_recipient CHECK (
(to_address IS NOT NULL) != (to_account_id IS NOT NULL)
(to_address IS NOT NULL) OR (to_account_id IS NOT NULL)
)
);
CREATE INDEX sent_notes_tx ON sent_notes_new (tx);
Expand Down
Loading