[database] Add AnyDatabase and ConfigurableDatabase
This is related to #43
This commit is contained in:
@@ -34,7 +34,7 @@ use bitcoin::consensus::encode::{deserialize, serialize};
|
||||
use bitcoin::hash_types::Txid;
|
||||
use bitcoin::{OutPoint, Script, Transaction};
|
||||
|
||||
use crate::database::{BatchDatabase, BatchOperations, Database};
|
||||
use crate::database::{BatchDatabase, BatchOperations, ConfigurableDatabase, Database};
|
||||
use crate::error::Error;
|
||||
use crate::types::*;
|
||||
|
||||
@@ -450,6 +450,14 @@ impl BatchDatabase for MemoryDatabase {
|
||||
}
|
||||
}
|
||||
|
||||
impl ConfigurableDatabase for MemoryDatabase {
|
||||
type Config = ();
|
||||
|
||||
fn from_config(_config: &Self::Config) -> Result<Self, Error> {
|
||||
Ok(MemoryDatabase::default())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
impl MemoryDatabase {
|
||||
// Artificially insert a tx in the database, as if we had found it with a `sync`
|
||||
|
||||
Reference in New Issue
Block a user