Merge pull request #767 from nuttycom/fix/fsblockdb_for_path_doc

Add a note about metadata database initialization to `FsBlockDb::for_path`
This commit is contained in:
Kris Nuttycombe 2023-01-27 14:05:44 -07:00 committed by GitHub
commit 7599fbd3c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -37,6 +37,9 @@ pub fn init_cache_database(db_cache: &BlockDb) -> Result<(), rusqlite::Error> {
/// Sets up the internal structure of the metadata cache database.
///
/// This will automatically apply any available migrations that have not yet been applied to the
/// database as part of its operation.
///
/// # Examples
///
/// ```

View File

@ -627,7 +627,7 @@ impl<'a, P: consensus::Parameters> WalletWrite for DataConnStmtCache<'a, P> {
let nullifiers = self.wallet_db.get_all_nullifiers()?;
// If the transaction contains shielded spends from our wallet, we will store z->t
// transactions we observe in the same way they would be stored by
// create_spend_to_address.
// create_spend_to_address.
if let Some((account_id, _)) = nullifiers.iter().find(
|(_, nf)|
d_tx.tx.sapling_bundle().iter().flat_map(|b| b.shielded_spends().iter())
@ -883,6 +883,11 @@ impl FsBlockDb {
/// `<fsblockdb_root>/blockmeta.sqlite` and will ensure that a directory exists at
/// `<fsblockdb_root>/blocks` where this block store will expect to find serialized block
/// files as described for [`FsBlockDb`].
///
/// An application using this constructor should ensure that they call
/// [`zcash_client_sqlite::chain::init::init_blockmetadb`] at application startup to ensure
/// that the resulting metadata database is properly initialized and has had all required
/// migrations applied before use.
pub fn for_path<P: AsRef<Path>>(fsblockdb_root: P) -> Result<Self, FsBlockDbError> {
let meta = fs::metadata(&fsblockdb_root).map_err(FsBlockDbError::Fs)?;
if meta.is_dir() {