Fix exclusive or in sent_notes recipient check.

This commit is contained in:
Kris Nuttycombe 2022-10-11 15:49:52 -06:00
parent 62e1f99eb0
commit fdf5aa7b8e
2 changed files with 2 additions and 4 deletions

View File

@ -392,8 +392,7 @@ mod tests {
FOREIGN KEY (to_account) REFERENCES accounts(account), FOREIGN KEY (to_account) REFERENCES accounts(account),
CONSTRAINT tx_output UNIQUE (tx, output_pool, output_index), CONSTRAINT tx_output UNIQUE (tx, output_pool, output_index),
CONSTRAINT note_recipient CHECK ( CONSTRAINT note_recipient CHECK (
(to_address IS NOT NULL OR to_account IS NOT NULL) (to_address IS NOT NULL) != (to_account IS NOT NULL)
AND NOT (to_address IS NOT NULL AND to_account IS NOT NULL)
) )
)", )",
"CREATE TABLE transactions ( "CREATE TABLE transactions (

View File

@ -60,8 +60,7 @@ impl RusqliteMigration for Migration {
FOREIGN KEY (to_account) REFERENCES accounts(account), FOREIGN KEY (to_account) REFERENCES accounts(account),
CONSTRAINT tx_output UNIQUE (tx, output_pool, output_index), CONSTRAINT tx_output UNIQUE (tx, output_pool, output_index),
CONSTRAINT note_recipient CHECK ( CONSTRAINT note_recipient CHECK (
(to_address IS NOT NULL OR to_account IS NOT NULL) (to_address IS NOT NULL) != (to_account IS NOT NULL)
AND NOT (to_address IS NOT NULL AND to_account IS NOT NULL)
) )
); );
INSERT INTO sent_notes_new ( INSERT INTO sent_notes_new (