Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Dunitrust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nodes
rust
Dunitrust
Commits
b2a56f6b
Commit
b2a56f6b
authored
6 years ago
by
Éloïs
Browse files
Options
Downloads
Patches
Plain Diff
[clippy]
parent
e53d5eaa
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!93
Migrate network documents to pest
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
blockchain/lib.rs
+1
-1
1 addition, 1 deletion
blockchain/lib.rs
network-documents/src/network_endpoint.rs
+3
-3
3 additions, 3 deletions
network-documents/src/network_endpoint.rs
ws2p/generate_peer.rs
+13
-9
13 additions, 9 deletions
ws2p/generate_peer.rs
with
17 additions
and
13 deletions
blockchain/lib.rs
+
1
−
1
View file @
b2a56f6b
...
@@ -444,7 +444,7 @@ impl BlockchainModule {
...
@@ -444,7 +444,7 @@ impl BlockchainModule {
wot
:
&
BinDB
<
W
>
,
wot
:
&
BinDB
<
W
>
,
)
->
Blockstamp
{
)
->
Blockstamp
{
debug!
(
"BlockchainModule : receive_blocks()"
);
debug!
(
"BlockchainModule : receive_blocks()"
);
let
blocks
:
Vec
<&
NetworkBlock
>
=
blocks_in_box
.
into_
iter
()
.map
(|
b
|
b
.deref
())
.collect
();
let
blocks
:
Vec
<&
NetworkBlock
>
=
blocks_in_box
.iter
()
.map
(|
b
|
b
.deref
())
.collect
();
let
mut
current_blockstamp
=
*
current_blockstamp
;
let
mut
current_blockstamp
=
*
current_blockstamp
;
let
mut
save_blocks_dbs
=
false
;
let
mut
save_blocks_dbs
=
false
;
let
mut
save_wots_dbs
=
false
;
let
mut
save_wots_dbs
=
false
;
...
...
This diff is collapsed.
Click to expand it.
network-documents/src/network_endpoint.rs
+
3
−
3
View file @
b2a56f6b
...
@@ -194,7 +194,7 @@ pub struct EndpointV2NetworkFeatures(pub Vec<u8>);
...
@@ -194,7 +194,7 @@ pub struct EndpointV2NetworkFeatures(pub Vec<u8>);
impl
ToString
for
EndpointV2NetworkFeatures
{
impl
ToString
for
EndpointV2NetworkFeatures
{
fn
to_string
(
&
self
)
->
String
{
fn
to_string
(
&
self
)
->
String
{
if
self
.is_empty
()
{
if
self
.is_empty
()
{
return
format!
(
""
);
return
""
.to_owned
(
);
}
}
let
mut
features_str
=
Vec
::
with_capacity
(
2
);
let
mut
features_str
=
Vec
::
with_capacity
(
2
);
if
self
.tls
()
{
if
self
.tls
()
{
...
@@ -288,7 +288,7 @@ impl ToString for EndpointV2 {
...
@@ -288,7 +288,7 @@ impl ToString for EndpointV2 {
let
path
=
if
let
Some
(
ref
path
)
=
self
.path
{
let
path
=
if
let
Some
(
ref
path
)
=
self
.path
{
format!
(
" {}"
,
path
)
format!
(
" {}"
,
path
)
}
else
{
}
else
{
format!
(
""
)
""
.to_owned
(
)
};
};
format!
(
format!
(
"{api} {version}{nf}{af}{host}{ip4}{ip6}{port}{path}"
,
"{api} {version}{nf}{af}{host}{ip4}{ip6}{port}{path}"
,
...
@@ -296,7 +296,7 @@ impl ToString for EndpointV2 {
...
@@ -296,7 +296,7 @@ impl ToString for EndpointV2 {
version
=
if
self
.api_version
>
0
{
version
=
if
self
.api_version
>
0
{
format!
(
"V{} "
,
self
.api_version
)
format!
(
"V{} "
,
self
.api_version
)
}
else
{
}
else
{
format!
(
""
)
""
.to_owned
(
)
},
},
nf
=
self
.network_features
.to_string
(),
nf
=
self
.network_features
.to_string
(),
af
=
self
.api_features
.to_string
(),
af
=
self
.api_features
.to_string
(),
...
...
This diff is collapsed.
Click to expand it.
ws2p/generate_peer.rs
+
13
−
9
View file @
b2a56f6b
...
@@ -48,7 +48,7 @@ pub fn _self_peer_update_endpoints(
...
@@ -48,7 +48,7 @@ pub fn _self_peer_update_endpoints(
}
}
for
ep
in
self_peer
.endpoints_str
{
for
ep
in
self_peer
.endpoints_str
{
let
ep_clone
=
ep
.clone
();
let
ep_clone
=
ep
.clone
();
let
ep_fields
:
Vec
<&
str
>
=
ep_clone
.split
(
" "
)
.collect
();
let
ep_fields
:
Vec
<&
str
>
=
ep_clone
.split
(
' '
)
.collect
();
if
!
apis
.contains
(
&
NetworkEndpointApi
(
ep_fields
[
0
]
.to_owned
()))
{
if
!
apis
.contains
(
&
NetworkEndpointApi
(
ep_fields
[
0
]
.to_owned
()))
{
new_endpoints_str
.push
(
ep
);
new_endpoints_str
.push
(
ep
);
}
}
...
@@ -56,10 +56,12 @@ pub fn _self_peer_update_endpoints(
...
@@ -56,10 +56,12 @@ pub fn _self_peer_update_endpoints(
for
ep
in
new_endpoints
{
for
ep
in
new_endpoints
{
if
let
EndpointEnum
::
V2
(
ep_v2
)
=
ep
{
if
let
EndpointEnum
::
V2
(
ep_v2
)
=
ep
{
let
bin_len
=
bincode
::
serialize
(
&
ep_v2
)
let
bin_len
=
bincode
::
serialize
(
&
ep_v2
)
.expect
(
&
format!
(
.unwrap_or_else
(|
_
|
{
panic!
(
"Fail to update self peer : invalid endpoint : {:?} !"
,
"Fail to update self peer : invalid endpoint : {:?} !"
,
ep_v2
,
ep_v2
))
)
})
.len
();
.len
();
let
str_ep
=
ep_v2
.to_string
();
let
str_ep
=
ep_v2
.to_string
();
if
str_ep
.len
()
<
bin_len
{
if
str_ep
.len
()
<
bin_len
{
...
@@ -94,10 +96,12 @@ pub fn _generate_self_peer(
...
@@ -94,10 +96,12 @@ pub fn _generate_self_peer(
for
ep
in
endpoints
{
for
ep
in
endpoints
{
if
let
EndpointEnum
::
V2
(
ep_v2
)
=
ep
{
if
let
EndpointEnum
::
V2
(
ep_v2
)
=
ep
{
let
bin_len
=
bincode
::
serialize
(
&
ep_v2
)
let
bin_len
=
bincode
::
serialize
(
&
ep_v2
)
.expect
(
&
format!
(
.unwrap_or_else
(|
_
|
{
panic!
(
"Fail to generate self peer : invalid endpoint : {:?} !"
,
"Fail to generate self peer : invalid endpoint : {:?} !"
,
ep_v2
,
ep_v2
))
)
})
.len
();
.len
();
let
str_ep
=
ep_v2
.to_string
();
let
str_ep
=
ep_v2
.to_string
();
if
str_ep
.len
()
<
bin_len
{
if
str_ep
.len
()
<
bin_len
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment