From: Alekos Filini Date: Thu, 6 Feb 2020 11:17:28 +0000 (+0100) Subject: Improve the database interface, add a few tests for the keyvalue database X-Git-Tag: 0.1.0-beta.1~77 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/database/errors.html?a=commitdiff_plain;h=a4c6005c7b85d09ab89a8168e74aa9cb2380f14e;p=bdk Improve the database interface, add a few tests for the keyvalue database --- diff --git a/core/lib/Cargo.toml b/core/lib/Cargo.toml index 1f0b2c2d..81e268f9 100644 --- a/core/lib/Cargo.toml +++ b/core/lib/Cargo.toml @@ -17,3 +17,6 @@ sled = { version = "0.31.0", optional = true } [features] default = ["sled"] key-value-db = ["sled"] + +[dev-dependencies] +lazy_static = "1.4.0" diff --git a/core/lib/src/database/keyvalue.rs b/core/lib/src/database/keyvalue.rs index f04e9fbd..d34ac9f7 100644 --- a/core/lib/src/database/keyvalue.rs +++ b/core/lib/src/database/keyvalue.rs @@ -1,25 +1,22 @@ -use std::borrow::Borrow; use std::convert::{From, TryInto}; -use sled::{Batch, Db, IVec, Tree}; +use sled::{Batch, Tree}; use bitcoin::consensus::encode::{deserialize, serialize}; use bitcoin::hash_types::Txid; use bitcoin::util::bip32::{ChildNumber, DerivationPath}; -use bitcoin::{OutPoint, Script, Transaction, TxOut}; +use bitcoin::{OutPoint, Script, Transaction}; use crate::database::{BatchDatabase, BatchOperations, Database}; use crate::error::Error; use crate::types::*; -// TODO: rename mod to Sled? - // path -> script p{i,e} -> script // script -> path s