commit
c71dff04c5
@ -348,7 +348,7 @@ impl Client {
|
|||||||
imported
|
imported
|
||||||
}
|
}
|
||||||
|
|
||||||
fn commit_block<B>(&self, block: B, hash: &H256, block_data: &Bytes) -> ImportRoute where B: IsBlock + Drain {
|
fn commit_block<B>(&self, block: B, hash: &H256, block_data: &[u8]) -> ImportRoute where B: IsBlock + Drain {
|
||||||
let number = block.header().number();
|
let number = block.header().number();
|
||||||
// Are we committing an era?
|
// Are we committing an era?
|
||||||
let ancient = if number >= HISTORY {
|
let ancient = if number >= HISTORY {
|
||||||
|
@ -52,10 +52,10 @@ impl WorkPoster {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn create_client() -> Client<PostHandler> {
|
fn create_client() -> Client<PostHandler> {
|
||||||
let client = Client::<PostHandler>::configure()
|
Client::<PostHandler>::configure()
|
||||||
.keep_alive(true)
|
.keep_alive(true)
|
||||||
.build().expect("Error creating HTTP client") as Client<PostHandler>;
|
.build()
|
||||||
client
|
.expect("Error creating HTTP client")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn notify(&self, pow_hash: H256, difficulty: U256, number: u64) {
|
pub fn notify(&self, pow_hash: H256, difficulty: U256, number: u64) {
|
||||||
@ -63,8 +63,10 @@ impl WorkPoster {
|
|||||||
let target = Ethash::difficulty_to_boundary(&difficulty);
|
let target = Ethash::difficulty_to_boundary(&difficulty);
|
||||||
let seed_hash = &self.seed_compute.lock().unwrap().get_seedhash(number);
|
let seed_hash = &self.seed_compute.lock().unwrap().get_seedhash(number);
|
||||||
let seed_hash = H256::from_slice(&seed_hash[..]);
|
let seed_hash = H256::from_slice(&seed_hash[..]);
|
||||||
let body = format!(r#"{{ "result": ["0x{}","0x{}","0x{}","0x{:x}"] }}"#,
|
let body = format!(
|
||||||
pow_hash.hex(), seed_hash.hex(), target.hex(), number);
|
r#"{{ "result": ["0x{}","0x{}","0x{}","0x{:x}"] }}"#,
|
||||||
|
pow_hash.hex(), seed_hash.hex(), target.hex(), number
|
||||||
|
);
|
||||||
let mut client = self.client.lock().unwrap();
|
let mut client = self.client.lock().unwrap();
|
||||||
for u in &self.urls {
|
for u in &self.urls {
|
||||||
if let Err(e) = client.request(u.clone(), PostHandler { body: body.clone() }) {
|
if let Err(e) = client.request(u.clone(), PostHandler { body: body.clone() }) {
|
||||||
|
@ -43,7 +43,7 @@ use std::cmp;
|
|||||||
|
|
||||||
use std::str::{FromStr};
|
use std::str::{FromStr};
|
||||||
use std::convert::From;
|
use std::convert::From;
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::Hash;
|
||||||
use std::ops::*;
|
use std::ops::*;
|
||||||
use std::cmp::*;
|
use std::cmp::*;
|
||||||
|
|
||||||
|
@ -539,7 +539,7 @@ impl<Message> Host<Message> where Message: Send + Sync + Clone {
|
|||||||
self.info.write().unwrap().public_endpoint = Some(public_endpoint.clone());
|
self.info.write().unwrap().public_endpoint = Some(public_endpoint.clone());
|
||||||
|
|
||||||
if self.first_time.load(AtomicOrdering::Relaxed) {
|
if self.first_time.load(AtomicOrdering::Relaxed) {
|
||||||
info!("Public node URL: {}", paint(White.bold(), format!("{}", self.external_url().unwrap())));
|
info!("Public node URL: {}", paint(White.bold(), self.external_url().unwrap()));
|
||||||
self.first_time.store(false, AtomicOrdering::Relaxed);
|
self.first_time.store(false, AtomicOrdering::Relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user