diff --git a/zcash_client_sqlite/src/wallet.rs b/zcash_client_sqlite/src/wallet.rs
index c9e74cb88..a97146f5d 100644
--- a/zcash_client_sqlite/src/wallet.rs
+++ b/zcash_client_sqlite/src/wallet.rs
@@ -470,13 +470,21 @@ pub fn get_witnesses
(
Ok(res)
}
+/// Retrieve the nullifiers for notes that the wallet is tracking
+/// that have not yet been confirmed as a consequence of the spending
+/// transaction being included in a block.
pub fn get_nullifiers
(
wdb: &WalletDB
,
) -> Result, SqliteClientError> {
// Get the nullifiers for the notes we are tracking
let mut stmt_fetch_nullifiers = wdb
.conn
- .prepare("SELECT id_note, account, nf FROM received_notes WHERE spent IS NULL")?;
+ .prepare(
+ "SELECT rn.id_note, rn.account, rn.nf, tx.block as block
+ FROM received_notes rn
+ LEFT OUTER JOIN transactions tx
+ ON tx.id_tx = rn.spent
+ WHERE block IS NULL")?;
let nullifiers = stmt_fetch_nullifiers.query_map(NO_PARAMS, |row| {
let account = AccountId(row.get(1)?);
let nf_bytes: Vec = row.get(2)?;