forked from zcash/librustzcash
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from KomodoPlatform/mm2_extras
make lib komodefi compatible
- Loading branch information
Showing
15 changed files
with
1,258 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
use crate::error::SqliteClientError; | ||
use crate::for_async::{async_blocking, WalletDbAsync}; | ||
use crate::wallet; | ||
use zcash_primitives::block::BlockHash; | ||
use zcash_primitives::consensus; | ||
use zcash_primitives::consensus::BlockHeight; | ||
use zcash_primitives::zip32::ExtendedFullViewingKey; | ||
|
||
pub async fn init_wallet_db<P: consensus::Parameters + 'static>( | ||
wdb: &WalletDbAsync<P>, | ||
) -> Result<(), rusqlite::Error> | ||
where | ||
P: Clone + Send + Sync, | ||
{ | ||
let wdb = wdb.inner(); | ||
async_blocking(move || { | ||
let wdb = wdb.lock().unwrap(); | ||
wallet::init::init_wallet_db(&wdb) | ||
}) | ||
.await | ||
} | ||
|
||
pub async fn init_accounts_table<P: consensus::Parameters + 'static>( | ||
wdb: &WalletDbAsync<P>, | ||
extfvks: &[ExtendedFullViewingKey], | ||
) -> Result<(), SqliteClientError> | ||
where | ||
P: Clone + Send + Sync, | ||
{ | ||
let wdb = wdb.inner(); | ||
let extfvks = extfvks.to_vec(); | ||
async_blocking(move || { | ||
let wdb = wdb.lock().unwrap(); | ||
wallet::init::init_accounts_table(&wdb, &extfvks) | ||
}) | ||
.await | ||
} | ||
|
||
pub async fn init_blocks_table<P: consensus::Parameters + 'static>( | ||
wdb: &WalletDbAsync<P>, | ||
height: BlockHeight, | ||
hash: BlockHash, | ||
time: u32, | ||
sapling_tree: &[u8], | ||
) -> Result<(), SqliteClientError> | ||
where | ||
P: Clone + Send + Sync, | ||
{ | ||
let wdb = wdb.inner(); | ||
let sapling_tree = sapling_tree.to_vec(); | ||
async_blocking(move || { | ||
let wdb = wdb.lock().unwrap(); | ||
wallet::init::init_blocks_table(&wdb, height, hash, time, &sapling_tree) | ||
}) | ||
.await | ||
} |
Oops, something went wrong.