From fdf5aa7b8e6f27dd56d657d8125db466f782a556 Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Tue, 11 Oct 2022 15:49:52 -0600 Subject: [PATCH] Fix exclusive or in sent_notes recipient check. --- zcash_client_sqlite/src/wallet/init.rs | 3 +-- .../src/wallet/init/migrations/sent_notes_to_internal.rs | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/zcash_client_sqlite/src/wallet/init.rs b/zcash_client_sqlite/src/wallet/init.rs index 609897d4a..cb50cb77c 100644 --- a/zcash_client_sqlite/src/wallet/init.rs +++ b/zcash_client_sqlite/src/wallet/init.rs @@ -392,8 +392,7 @@ mod tests { FOREIGN KEY (to_account) REFERENCES accounts(account), CONSTRAINT tx_output UNIQUE (tx, output_pool, output_index), CONSTRAINT note_recipient CHECK ( - (to_address IS NOT NULL OR to_account IS NOT NULL) - AND NOT (to_address IS NOT NULL AND to_account IS NOT NULL) + (to_address IS NOT NULL) != (to_account IS NOT NULL) ) )", "CREATE TABLE transactions ( diff --git a/zcash_client_sqlite/src/wallet/init/migrations/sent_notes_to_internal.rs b/zcash_client_sqlite/src/wallet/init/migrations/sent_notes_to_internal.rs index 5debe5db6..c67777660 100644 --- a/zcash_client_sqlite/src/wallet/init/migrations/sent_notes_to_internal.rs +++ b/zcash_client_sqlite/src/wallet/init/migrations/sent_notes_to_internal.rs @@ -60,8 +60,7 @@ impl RusqliteMigration for Migration { FOREIGN KEY (to_account) REFERENCES accounts(account), CONSTRAINT tx_output UNIQUE (tx, output_pool, output_index), CONSTRAINT note_recipient CHECK ( - (to_address IS NOT NULL OR to_account IS NOT NULL) - AND NOT (to_address IS NOT NULL AND to_account IS NOT NULL) + (to_address IS NOT NULL) != (to_account IS NOT NULL) ) ); INSERT INTO sent_notes_new (