Skip to content

Commit

Permalink
Merge pull request #1321 from zcash/fix_sent_note_recipient_constraint
Browse files Browse the repository at this point in the history
zcash_client_sqlite: Fix sent note recipient constraint
  • Loading branch information
nuttycom authored Mar 26, 2024
2 parents ad4bc84 + da3869a commit 3ccc14f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
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

0 comments on commit 3ccc14f

Please sign in to comment.