RLP decoder refactoring
This commit is contained in:
@@ -57,11 +57,10 @@ pub struct PeerCapabilityInfo {
|
||||
|
||||
impl Decodable for PeerCapabilityInfo {
|
||||
fn decode<D>(decoder: &D) -> Result<Self, DecoderError> where D: Decoder {
|
||||
let c = try!(decoder.as_list());
|
||||
let v: u32 = try!(Decodable::decode(&c[1]));
|
||||
let c = decoder.as_rlp();
|
||||
Ok(PeerCapabilityInfo {
|
||||
protocol: try!(Decodable::decode(&c[0])),
|
||||
version: v as u8,
|
||||
protocol: try!(c.val_at(0)),
|
||||
version: try!(c.val_at(1))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user