Merge pull request #653 from nuttycom/bug/wallet_max_account

zcash_client_sqlite: fix wallet::get_max_account_id
This commit is contained in:
Kris Nuttycombe 2022-09-28 09:14:40 -06:00 committed by GitHub
commit 4e631697c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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>, wdb: &WalletDb<P>,
) -> Result<Option<AccountId>, SqliteClientError> { ) -> Result<Option<AccountId>, SqliteClientError> {
// This returns the most recently generated address. // This returns the most recently generated address.
Ok(wdb wdb.conn
.conn
.query_row("SELECT MAX(account) FROM accounts", NO_PARAMS, |row| { .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>( pub(crate) fn add_account<P: consensus::Parameters>(