-
Notifications
You must be signed in to change notification settings - Fork 307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for an async Database
in Wallet<D>
#795
Comments
Hey @garydevenay. There's a lot of simplifications coming up for
You don't need to provide any indexes for these things. Being able to iterate over the records and slurp them all into memory is all that is required. If you wanted to get started now I'd say at a low level API you'd need in but instead of inserting things into memory it would insert into a database. It wouldn't need to do the One good reason not to get started now is that we are in the middle of adding "associated data" to transactions so you can store things like the position in the block and/or timestamp or even some application data along with the txid. For |
Hey @LLFourn, thanks for those notes. Agree the I will be taking the existing migrations, tables, and queries from the I understand that there may be better future opportunities to start that, but it's currently a large blocker for me at the moment. Example method: async fn insert_script_pubkey(&self, keychain: String, child: u32, script: &[u8]) -> Result<i64, bdk::Error> {
let mut conn = self.pool.acquire().await?;
let id = sqlx::query!(
"INSERT INTO script_pubkeys (keychain, child, script) VALUES (?1, ?2, ?3)",
keychain,
child,
script,
).execute(&mut conn).await?;
Ok(id)
} Edit (10/11/22): I'm also open to writing an implementation for this in |
Need to verify we can do this with new 1.0 wallet api. |
The example above doesn't apply here since we don't insert script pubkeys in the database anyway as part of BDK's architecture atm. In general I think you can't get the next address (which persists the newly revealed derivation index) in an |
Describe the enhancement
The current storage backends don't have support for
async
operations. After speaking with @afilini briefly on Discord about this, it's clear that BDK 1.0/bdk_core should give us better support for that.Since we are a few months away from the bdk_core release, I'm proposing to create an
async
capableSqliteDatabase
(PooledSqliteDatabase
?) that will allow us to access a pool of connections across threads and serve as a bridge until the 1.0 release.Use case
Wallet
to be used across threads safely.async
applicationsThe text was updated successfully, but these errors were encountered: