File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 3636 use crpc:: v1:: * ;
3737 handler. extend_with ( ChainClient :: new ( & self . client , & self . miner ) . to_delegate ( ) ) ;
3838 handler. extend_with ( DevelClient :: new ( & self . client ) . to_delegate ( ) ) ;
39- handler. extend_with ( MinerClient :: new ( & self . miner ) . to_delegate ( ) ) ;
39+ handler. extend_with ( MinerClient :: new ( & self . client , & self . miner ) . to_delegate ( ) ) ;
4040 handler. extend_with ( NetClient :: new ( & self . network_control ) . to_delegate ( ) ) ;
4141 }
4242}
Original file line number Diff line number Diff line change 1616
1717use std:: sync:: Arc ;
1818
19- use ccore:: { self , MinerService } ;
19+ use ccore:: { self , Client , MinerService } ;
20+ use ctypes:: H256 ;
2021use jsonrpc_core:: Result ;
2122
2223use super :: super :: errors;
2324use super :: super :: traits:: Miner ;
2425use super :: super :: types:: { Bytes , Work } ;
2526
2627pub struct MinerClient {
28+ client : Arc < Client > ,
2729 miner : Arc < ccore:: Miner > ,
2830}
2931
3032impl MinerClient {
31- pub fn new ( miner : & Arc < ccore:: Miner > ) -> Self {
33+ pub fn new ( client : & Arc < Client > , miner : & Arc < ccore:: Miner > ) -> Self {
3234 Self {
35+ client : client. clone ( ) ,
3336 miner : miner. clone ( ) ,
3437 }
3538 }
@@ -44,11 +47,12 @@ impl Miner for MinerClient {
4447 unimplemented ! ( ) ;
4548 }
4649
47- fn submit_work ( & self , _nonce : Bytes , _pow_hash : Bytes ) -> Result < bool > {
50+ fn submit_work ( & self , pow_hash : H256 , seal : Vec < Bytes > ) -> Result < bool > {
4851 if !self . miner . can_produce_work_package ( ) {
4952 cwarn ! ( MINER , "Cannot give work package - engine seals internally." ) ;
5053 return Err ( errors:: no_work_required ( ) )
5154 }
52- unimplemented ! ( ) ;
55+ let seal = seal. iter ( ) . cloned ( ) . map ( Into :: into) . collect ( ) ;
56+ Ok ( self . miner . submit_seal ( & * self . client , pow_hash, seal) . is_ok ( ) )
5357 }
5458}
Original file line number Diff line number Diff line change 1414// You should have received a copy of the GNU Affero General Public License
1515// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
17+ use ctypes:: H256 ;
1718use jsonrpc_core:: Result ;
1819
1920use super :: super :: types:: { Bytes , Work } ;
@@ -24,6 +25,6 @@ build_rpc_trait! {
2425 fn get_work( & self ) -> Result <Work >;
2526
2627 # [ rpc( name = "miner_submitWork" ) ]
27- fn submit_work( & self , Bytes , Bytes ) -> Result <bool >;
28+ fn submit_work( & self , H256 , Vec < Bytes > ) -> Result <bool >;
2829 }
2930}
You can’t perform that action at this time.
0 commit comments