// Bitcoin Dev Kit // Written in 2020 by Alekos Filini // // Copyright (c) 2020-2021 Bitcoin Dev Kit Developers // // This file is licensed under the Apache License, Version 2.0 or the MIT license // , at your option. // You may not use this file except in accordance with one or both of these // licenses. //! In-memory ephemeral database //! //! This module defines an in-memory database type called [`MemoryDatabase`] that is based on a //! [`BTreeMap`]. use std::collections::BTreeMap; use std::ops::Bound::{Excluded, Included}; use bitcoin::consensus::encode::{deserialize, serialize}; use bitcoin::hash_types::Txid; use bitcoin::{OutPoint, Script, Transaction}; use crate::database::{BatchDatabase, BatchOperations, ConfigurableDatabase, Database}; use crate::error::Error; use crate::types::*; // path -> script p{i,e} -> script // script -> path s