From 1eafdc70087202f5fb9fe6a8ccc10b6641098dbd Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 18 Jan 2016 15:47:50 +0100 Subject: [PATCH] PR fixes. --- src/client.rs | 1 - util/src/journaldb.rs | 6 +++--- util/src/rlp/rlpstream.rs | 8 ++++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/client.rs b/src/client.rs index cb1f4672d..dc8bf3608 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1,6 +1,5 @@ use util::*; use rocksdb::{Options, DB}; -use rocksdb::DBCompactionStyle::DBUniversalCompaction; use blockchain::{BlockChain, BlockProvider}; use views::BlockView; use error::*; diff --git a/util/src/journaldb.rs b/util/src/journaldb.rs index db45d51c7..a4032c154 100644 --- a/util/src/journaldb.rs +++ b/util/src/journaldb.rs @@ -68,7 +68,7 @@ impl JournalDB { let mut r = RlpStream::new_list(2); r.append(&now); r.append(&index); - last = r.out(); + last = r.drain(); &last })).is_some() { index += 1; @@ -78,7 +78,7 @@ impl JournalDB { r.append(id); r.append(&self.inserts); r.append(&self.removes); - try!(self.backing.put(&last, &r.out())); + try!(self.backing.put(&last, r.as_raw())); self.inserts.clear(); self.removes.clear(); } @@ -91,7 +91,7 @@ impl JournalDB { let mut r = RlpStream::new_list(2); r.append(&end_era); r.append(&index); - last = r.out(); + last = r.drain(); &last })) { let rlp = Rlp::new(&rlp_data); diff --git a/util/src/rlp/rlpstream.rs b/util/src/rlp/rlpstream.rs index b8954ae6f..a30978f24 100644 --- a/util/src/rlp/rlpstream.rs +++ b/util/src/rlp/rlpstream.rs @@ -142,6 +142,14 @@ impl RlpStream { self.note_appended(1); } } + + /// Drain the object and return the underlying ElasticArray. + pub fn drain(self) -> ElasticArray1024 { + match self.is_finished() { + true => self.encoder.bytes, + false => panic!() + } + } } struct BasicEncoder {