Miner facility, using the current chain state to build on top of.
This commit is contained in:
@@ -76,14 +76,14 @@ impl Cuckoo {
|
||||
/// Generates a node in the cuckoo graph generated from our seed. A node is
|
||||
/// simply materialized as a u64 from a nonce and an offset (generally 0 or
|
||||
/// 1).
|
||||
pub fn new_node(&self, nonce: u64, uorv: u64) -> u64 {
|
||||
fn new_node(&self, nonce: u64, uorv: u64) -> u64 {
|
||||
return ((siphash24(self.v, 2 * nonce + uorv) & self.mask) << 1) | uorv;
|
||||
}
|
||||
|
||||
/// Creates a new edge in the cuckoo graph generated by our seed from a
|
||||
/// nonce. Generates two node coordinates from the nonce and links them
|
||||
/// together.
|
||||
pub fn new_edge(&self, nonce: u64) -> Edge {
|
||||
fn new_edge(&self, nonce: u64) -> Edge {
|
||||
Edge {
|
||||
u: self.new_node(nonce, 0),
|
||||
v: self.new_node(nonce, 1),
|
||||
|
||||
+3
-3
@@ -23,7 +23,7 @@
|
||||
//! reference. It's not optimized for speed.
|
||||
|
||||
mod siphash;
|
||||
mod cuckoo;
|
||||
pub mod cuckoo;
|
||||
|
||||
use time;
|
||||
|
||||
@@ -41,7 +41,7 @@ use ser::{Writeable, Writer};
|
||||
/// difficulty (yet unknown). We also add the count of every variable length
|
||||
/// elements in a header to make lying on those much harder.
|
||||
#[derive(Debug)]
|
||||
struct PowHeader {
|
||||
pub struct PowHeader {
|
||||
pub nonce: u64,
|
||||
pub height: u64,
|
||||
pub previous: Hash,
|
||||
@@ -71,7 +71,7 @@ impl Writeable for PowHeader {
|
||||
}
|
||||
|
||||
impl PowHeader {
|
||||
fn from_block(b: &Block) -> PowHeader {
|
||||
pub fn from_block(b: &Block) -> PowHeader {
|
||||
let ref h = b.header;
|
||||
PowHeader {
|
||||
nonce: h.nonce,
|
||||
|
||||
Reference in New Issue
Block a user