zcash_client_sqlite: fix wallet::get_max_account_id

This had the same bug as was fixed in 5b8ec380a0
This commit is contained in:
Kris Nuttycombe 2022-09-26 16:48:58 -06:00
parent c06760e985
commit 2c16f78fee
1 changed files with 4 additions and 4 deletions

View File

@ -183,12 +183,12 @@ pub(crate) fn get_max_account_id<P>(
wdb: &WalletDb<P>,
) -> Result<Option<AccountId>, SqliteClientError> {
// This returns the most recently generated address.
Ok(wdb
.conn
wdb.conn
.query_row("SELECT MAX(account) FROM accounts", NO_PARAMS, |row| {
row.get::<_, u32>(0).map(AccountId::from)
let account_id: Option<u32> = row.get(0)?;
Ok(account_id.map(AccountId::from))
})
.optional()?)
.map_err(SqliteClientError::from)
}
pub(crate) fn add_account<P: consensus::Parameters>(