PR fixes.

This commit is contained in:
Gav Wood 2016-01-18 15:47:50 +01:00
parent 0222b3e081
commit 1eafdc7008
3 changed files with 11 additions and 4 deletions

View File

@ -1,6 +1,5 @@
use util::*; use util::*;
use rocksdb::{Options, DB}; use rocksdb::{Options, DB};
use rocksdb::DBCompactionStyle::DBUniversalCompaction;
use blockchain::{BlockChain, BlockProvider}; use blockchain::{BlockChain, BlockProvider};
use views::BlockView; use views::BlockView;
use error::*; use error::*;

View File

@ -68,7 +68,7 @@ impl JournalDB {
let mut r = RlpStream::new_list(2); let mut r = RlpStream::new_list(2);
r.append(&now); r.append(&now);
r.append(&index); r.append(&index);
last = r.out(); last = r.drain();
&last &last
})).is_some() { })).is_some() {
index += 1; index += 1;
@ -78,7 +78,7 @@ impl JournalDB {
r.append(id); r.append(id);
r.append(&self.inserts); r.append(&self.inserts);
r.append(&self.removes); r.append(&self.removes);
try!(self.backing.put(&last, &r.out())); try!(self.backing.put(&last, r.as_raw()));
self.inserts.clear(); self.inserts.clear();
self.removes.clear(); self.removes.clear();
} }
@ -91,7 +91,7 @@ impl JournalDB {
let mut r = RlpStream::new_list(2); let mut r = RlpStream::new_list(2);
r.append(&end_era); r.append(&end_era);
r.append(&index); r.append(&index);
last = r.out(); last = r.drain();
&last &last
})) { })) {
let rlp = Rlp::new(&rlp_data); let rlp = Rlp::new(&rlp_data);

View File

@ -142,6 +142,14 @@ impl RlpStream {
self.note_appended(1); self.note_appended(1);
} }
} }
/// Drain the object and return the underlying ElasticArray.
pub fn drain(self) -> ElasticArray1024<u8> {
match self.is_finished() {
true => self.encoder.bytes,
false => panic!()
}
}
} }
struct BasicEncoder { struct BasicEncoder {