Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter v2S
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
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Commits
22fdbdd9
Unverified
Commit
22fdbdd9
authored
2 years ago
by
bgallois
Browse files
Options
Downloads
Patches
Plain Diff
fix manual and instant sealing
parent
586b23ea
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
node/src/rpc.rs
+18
-16
18 additions, 16 deletions
node/src/rpc.rs
node/src/service.rs
+37
-30
37 additions, 30 deletions
node/src/service.rs
with
55 additions
and
46 deletions
node/src/rpc.rs
+
18
−
16
View file @
22fdbdd9
...
@@ -37,6 +37,7 @@ use sp_keystore::KeystorePtr;
...
@@ -37,6 +37,7 @@ use sp_keystore::KeystorePtr;
use
std
::
sync
::
Arc
;
use
std
::
sync
::
Arc
;
/// Extra dependencies for BABE.
/// Extra dependencies for BABE.
#[derive(Clone)]
pub
struct
BabeDeps
{
pub
struct
BabeDeps
{
/// A handle to the BABE worker for issuing requests.
/// A handle to the BABE worker for issuing requests.
pub
babe_worker_handle
:
BabeWorkerHandle
<
Block
>
,
pub
babe_worker_handle
:
BabeWorkerHandle
<
Block
>
,
...
@@ -61,7 +62,7 @@ pub struct FullDeps<C, P, SC> {
...
@@ -61,7 +62,7 @@ pub struct FullDeps<C, P, SC> {
futures
::
channel
::
mpsc
::
Sender
<
sc_consensus_manual_seal
::
EngineCommand
<
sp_core
::
H256
>>
,
futures
::
channel
::
mpsc
::
Sender
<
sc_consensus_manual_seal
::
EngineCommand
<
sp_core
::
H256
>>
,
>
,
>
,
/// BABE specific dependencies.
/// BABE specific dependencies.
pub
babe
:
BabeDeps
,
pub
babe
:
Option
<
BabeDeps
>
,
}
}
/// Instantiate all full RPC extensions.
/// Instantiate all full RPC extensions.
...
@@ -95,13 +96,11 @@ where
...
@@ -95,13 +96,11 @@ where
babe
,
babe
,
}
=
deps
;
}
=
deps
;
if
let
Some
(
babe
)
=
babe
{
let
BabeDeps
{
let
BabeDeps
{
babe_worker_handle
,
babe_worker_handle
,
keystore
,
keystore
,
}
=
babe
;
}
=
babe
;
module
.merge
(
System
::
new
(
client
.clone
(),
pool
,
deny_unsafe
)
.into_rpc
())
?
;
module
.merge
(
TransactionPayment
::
new
(
client
.clone
())
.into_rpc
())
?
;
module
.merge
(
module
.merge
(
Babe
::
new
(
Babe
::
new
(
client
.clone
(),
client
.clone
(),
...
@@ -112,6 +111,9 @@ where
...
@@ -112,6 +111,9 @@ where
)
)
.into_rpc
(),
.into_rpc
(),
)
?
;
)
?
;
}
module
.merge
(
System
::
new
(
client
.clone
(),
pool
,
deny_unsafe
)
.into_rpc
())
?
;
module
.merge
(
TransactionPayment
::
new
(
client
.clone
())
.into_rpc
())
?
;
if
let
Some
(
command_sink
)
=
command_sink_opt
{
if
let
Some
(
command_sink
)
=
command_sink_opt
{
// We provide the rpc handler with the sending end of the channel to allow the rpc
// We provide the rpc handler with the sending end of the channel to allow the rpc
// send EngineCommands to the background block authorship task.
// send EngineCommands to the background block authorship task.
...
...
This diff is collapsed.
Click to expand it.
node/src/service.rs
+
37
−
30
View file @
22fdbdd9
...
@@ -218,7 +218,7 @@ pub fn new_partial<RuntimeApi, Executor>(
...
@@ -218,7 +218,7 @@ pub fn new_partial<RuntimeApi, Executor>(
FullGrandpaBlockImport
<
RuntimeApi
,
Executor
>
,
FullGrandpaBlockImport
<
RuntimeApi
,
Executor
>
,
>
,
>
,
sc_consensus_babe
::
BabeLink
<
Block
>
,
sc_consensus_babe
::
BabeLink
<
Block
>
,
sc_consensus_babe
::
BabeWorkerHandle
<
Block
>
,
Option
<
sc_consensus_babe
::
BabeWorkerHandle
<
Block
>
>
,
sc_consensus_grandpa
::
LinkHalf
<
sc_consensus_grandpa
::
LinkHalf
<
Block
,
Block
,
FullClient
<
RuntimeApi
,
Executor
>
,
FullClient
<
RuntimeApi
,
Executor
>
,
...
@@ -291,8 +291,16 @@ where
...
@@ -291,8 +291,16 @@ where
client
.clone
(),
client
.clone
(),
)
?
;
)
?
;
let
(
import_queue
,
babe_worker_handle
)
=
if
consensus_manual
{
let
import_queue
=
sc_consensus_manual_seal
::
import_queue
(
Box
::
new
(
babe_block_import
.clone
()),
&
task_manager
.spawn_essential_handle
(),
config
.prometheus_registry
(),
);
(
import_queue
,
None
)
}
else
{
let
slot_duration
=
babe_link
.config
()
.slot_duration
();
let
slot_duration
=
babe_link
.config
()
.slot_duration
();
let
(
mut
import_queue
,
babe_worker_
handle
)
=
sc_consensus_babe
::
import_queue
(
let
(
queue
,
handle
)
=
sc_consensus_babe
::
import_queue
(
babe_link
.clone
(),
babe_link
.clone
(),
babe_block_import
.clone
(),
babe_block_import
.clone
(),
Some
(
Box
::
new
(
justification_import
)),
Some
(
Box
::
new
(
justification_import
)),
...
@@ -312,14 +320,8 @@ where
...
@@ -312,14 +320,8 @@ where
config
.prometheus_registry
(),
config
.prometheus_registry
(),
telemetry
.as_ref
()
.map
(|
x
|
x
.handle
()),
telemetry
.as_ref
()
.map
(|
x
|
x
.handle
()),
)
?
;
)
?
;
(
queue
,
Some
(
handle
))
if
consensus_manual
{
};
import_queue
=
sc_consensus_manual_seal
::
import_queue
(
Box
::
new
(
babe_block_import
.clone
()),
&
task_manager
.spawn_essential_handle
(),
config
.prometheus_registry
(),
);
}
Ok
(
sc_service
::
PartialComponents
{
Ok
(
sc_service
::
PartialComponents
{
client
,
client
,
...
@@ -556,6 +558,14 @@ where
...
@@ -556,6 +558,14 @@ where
let
select_chain
=
select_chain
.clone
();
let
select_chain
=
select_chain
.clone
();
let
chain_spec
=
config
.chain_spec
.cloned_box
();
let
chain_spec
=
config
.chain_spec
.cloned_box
();
let
keystore
=
keystore_container
.keystore
()
.clone
();
let
keystore
=
keystore_container
.keystore
()
.clone
();
let
babe_deps
=
if
let
Some
(
babe_worker_handle
)
=
babe_worker_handle
{
Some
(
crate
::
rpc
::
BabeDeps
{
babe_worker_handle
:
babe_worker_handle
.clone
(),
keystore
:
keystore
.clone
(),
})
}
else
{
None
};
Box
::
new
(
move
|
deny_unsafe
,
_
|
{
Box
::
new
(
move
|
deny_unsafe
,
_
|
{
let
deps
=
crate
::
rpc
::
FullDeps
{
let
deps
=
crate
::
rpc
::
FullDeps
{
...
@@ -564,10 +574,7 @@ where
...
@@ -564,10 +574,7 @@ where
select_chain
:
select_chain
.clone
(),
select_chain
:
select_chain
.clone
(),
chain_spec
:
chain_spec
.cloned_box
(),
chain_spec
:
chain_spec
.cloned_box
(),
deny_unsafe
,
deny_unsafe
,
babe
:
crate
::
rpc
::
BabeDeps
{
babe
:
babe_deps
.clone
(),
babe_worker_handle
:
babe_worker_handle
.clone
(),
keystore
:
keystore
.clone
(),
},
command_sink_opt
:
command_sink_opt
.clone
(),
command_sink_opt
:
command_sink_opt
.clone
(),
};
};
...
...
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