Extract the hard dependency on rocksdb from the light client (#8034)

* Extract the hard dependency on rocksdb from the light client

* Remove TODO
This commit is contained in:
Pierre Krieger
2018-03-01 19:53:15 +01:00
committed by Rando
parent ca0d1f5eb7
commit d4205da484
11 changed files with 59 additions and 78 deletions

View File

@@ -25,6 +25,7 @@ use tests::helpers::{TestNet, Peer as PeerLike, TestPacket};
use ethcore::client::TestBlockChainClient;
use ethcore::spec::Spec;
use io::IoChannel;
use kvdb_memorydb;
use light::client::fetch::{self, Unavailable};
use light::net::{LightProtocol, IoContext, Capabilities, Params as LightParams};
use light::provider::LightProvider;
@@ -218,13 +219,16 @@ impl TestNet<Peer> {
// skip full verification because the blocks are bad.
config.verify_full = false;
let cache = Arc::new(Mutex::new(Cache::new(Default::default(), Duration::hours(6))));
let client = LightClient::in_memory(
let db = kvdb_memorydb::create(0);
let client = LightClient::new(
config,
Arc::new(db),
None,
&Spec::new_test(),
fetch::unavailable(), // TODO: allow fetch from full nodes.
IoChannel::disconnected(),
cache
);
).expect("New DB creation infallible; qed");
peers.push(Arc::new(Peer::new_light(Arc::new(client))))
}