diff --git a/zcash_client_sqlite/src/wallet/orchard.rs b/zcash_client_sqlite/src/wallet/orchard.rs index ec3b5f468..47babda20 100644 --- a/zcash_client_sqlite/src/wallet/orchard.rs +++ b/zcash_client_sqlite/src/wallet/orchard.rs @@ -252,7 +252,7 @@ pub(crate) fn put_received_note( rseed = :rseed, nf = IFNULL(:nf, nf), memo = IFNULL(:memo, memo), - is_change = IFNULL(:is_change, is_change), + is_change = MAX(:is_change, is_change), commitment_tree_position = IFNULL(:commitment_tree_position, commitment_tree_position), recipient_key_scope = :recipient_key_scope RETURNING orchard_received_notes.id", diff --git a/zcash_client_sqlite/src/wallet/sapling.rs b/zcash_client_sqlite/src/wallet/sapling.rs index 67ed843d7..1db6c498f 100644 --- a/zcash_client_sqlite/src/wallet/sapling.rs +++ b/zcash_client_sqlite/src/wallet/sapling.rs @@ -355,7 +355,7 @@ pub(crate) fn put_received_note( rcm = :rcm, nf = IFNULL(:nf, nf), memo = IFNULL(:memo, memo), - is_change = IFNULL(:is_change, is_change), + is_change = MAX(:is_change, is_change), commitment_tree_position = IFNULL(:commitment_tree_position, commitment_tree_position), recipient_key_scope = :recipient_key_scope RETURNING sapling_received_notes.id",