Make the block header struct's internals private (#2000)
* Make the block header struct's internals private Currently, this involves a lot of explicit cloning, but we could migrate the return types of the get_* functions to be copies rather than references since they are mostly copy types anyway. I opted to eliminate the constructor in favor of using Default::default() plus calling a bunch of setters. This is similar to the model that a Google Protobuf client uses and I think it looks fine. * Drop some unnecessary cloning by comparing references * Fix compiler errors from callsites in tests.
This commit is contained in:
committed by
Arkadiy Paronyan
parent
2d883c43c9
commit
4389742ca3
@@ -45,9 +45,9 @@ fn returns_state_root_basic() {
|
||||
let client_result = generate_dummy_client(6);
|
||||
let client = client_result.reference();
|
||||
let test_spec = get_test_spec();
|
||||
let state_root = test_spec.genesis_header().state_root;
|
||||
let genesis_header = test_spec.genesis_header();
|
||||
|
||||
assert!(client.state_data(&state_root).is_some());
|
||||
assert!(client.state_data(genesis_header.state_root()).is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user