Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions chain-impl-mockchain/src/accounting/account/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,16 @@ mod tests {
let mut ledger = Ledger::new();

// Add all arbitrary accounts
for account_id in arbitrary_accounts_ids.iter().cloned() {
for account_id in arbitrary_accounts_ids.iter() {
ledger = ledger
.add_account(&account_id, AverageValue::arbitrary(gen).into(), ())
.add_account(account_id, AverageValue::arbitrary(gen).into(), ())
.unwrap();

for token in &arbitrary_voting_tokens {
// TODO: maybe less probability is better (for performance)
if bool::arbitrary(gen) {
ledger = ledger
.token_add(&account_id, token.clone(), Value::arbitrary(gen))
.token_add(account_id, token.clone(), Value::arbitrary(gen))
.unwrap();
}
}
Expand Down
10 changes: 1 addition & 9 deletions chain-impl-mockchain/src/ledger/recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,18 +310,10 @@ fn pack_pool_registration<W: std::io::Write>(
pool_registration: &PoolRegistration,
codec: &mut Codec<W>,
) -> Result<(), WriteError> {
let byte_array = pool_registration.serialize();
let bytes = byte_array.as_slice();
let size = bytes.len() as u64;
// TODO: do not store extra bytes
codec.put_be_u64(size)?;
codec.put_bytes(bytes)?;
Ok(())
Serialize::serialize(&pool_registration, codec)
}

fn unpack_pool_registration(codec: &mut Codec<&[u8]>) -> Result<PoolRegistration, ReadError> {
// TODO: do not store extra bytes
codec.get_be_u64()?;
PoolRegistration::deserialize_from_slice(codec)
}

Expand Down
2 changes: 1 addition & 1 deletion chain-impl-mockchain/src/testing/arbitrary/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ where
let mut matrix: Vec<Vec<T>> = (0..number_of_splits)
.map(|_| Vec::with_capacity(number_of_splits))
.collect();
for x in source.iter().cloned() {
for x in source {
let index = usize::arbitrary(gen) % number_of_splits;
matrix.get_mut(index).unwrap().push(x.clone());
}
Expand Down
4 changes: 2 additions & 2 deletions chain-network/src/grpc/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ where
let res = proto::node::PeersResponse {
peers: peers
.nodes
.to_vec()
.into_iter()
.iter()
.cloned()
.map(|node| node.into_bytes())
.collect(),
};
Expand Down