pub struct ProxyExtendedChannelFactory { /* private fields */ }
Expand description
Used by proxies that want to open extended channls with upstream. If the proxy has job declaration capabilities, we set the job creator and the coinbase outs.
Implementations§
source§impl ProxyExtendedChannelFactory
impl ProxyExtendedChannelFactory
pub fn new( ids: Arc<Mutex<GroupId>>, extranonces: ExtendedExtranonce, job_creator: Option<JobsCreators>, share_per_min: f32, kind: ExtendedChannelKind, pool_coinbase_outputs: Option<Vec<TxOut>>, pool_signature: String, extended_channel_id: u32, ) -> Self
sourcepub fn add_standard_channel(
&mut self,
request_id: u32,
downstream_hash_rate: f32,
id_header_only: bool,
id: u32,
) -> Result<Vec<Mining<'_>>, Error>
pub fn add_standard_channel( &mut self, request_id: u32, downstream_hash_rate: f32, id_header_only: bool, id: u32, ) -> Result<Vec<Mining<'_>>, Error>
Calls [ChannelFactory::add_standard_channel
]
sourcepub fn new_extended_channel(
&mut self,
request_id: u32,
hash_rate: f32,
min_extranonce_size: u16,
) -> Result<Vec<Mining<'_>>, Error>
pub fn new_extended_channel( &mut self, request_id: u32, hash_rate: f32, min_extranonce_size: u16, ) -> Result<Vec<Mining<'_>>, Error>
Calls [ChannelFactory::new_extended_channel
]
sourcepub fn on_new_prev_hash_from_tp(
&mut self,
m: &SetNewPrevHashFromTp<'static>,
) -> Result<Option<(PartialSetCustomMiningJob, u32)>, Error>
pub fn on_new_prev_hash_from_tp( &mut self, m: &SetNewPrevHashFromTp<'static>, ) -> Result<Option<(PartialSetCustomMiningJob, u32)>, Error>
Called only when a new prev hash is received by a Template Provider when job declaration is used.
It matches the message with a job_id
, creates a new custom job, and calls [ChannelFactory::on_new_prev_hash
]
sourcepub fn on_new_template(
&mut self,
m: &mut NewTemplate<'static>,
) -> Result<(HashMap<u32, Mining<'static>, BuildNoHashHasher<u32>>, Option<PartialSetCustomMiningJob>, u32), Error>
pub fn on_new_template( &mut self, m: &mut NewTemplate<'static>, ) -> Result<(HashMap<u32, Mining<'static>, BuildNoHashHasher<u32>>, Option<PartialSetCustomMiningJob>, u32), Error>
Called only when a new template is received by a Template Provider when job declaration is used.
It creates a new custom job and calls [ChannelFactory::on_new_extended_mining_job
]
Called when a SubmitSharesStandard
message is received from the downstream. We check the shares
against the channel’s respective target and return OnNewShare
to let us know if and where the the
shares should be relayed
Called when a SubmitSharesStandard
message is received from the Downstream. We check the shares
against the channel’s respective target and return OnNewShare
to let us know if and where the shares should
be relayed
sourcepub fn on_new_prev_hash(
&mut self,
m: SetNewPrevHash<'static>,
) -> Result<(), Error>
pub fn on_new_prev_hash( &mut self, m: SetNewPrevHash<'static>, ) -> Result<(), Error>
Calls [ChannelFactory::on_new_prev_hash
]
sourcepub fn on_new_extended_mining_job(
&mut self,
m: NewExtendedMiningJob<'static>,
) -> Result<HashMap<u32, Mining<'static>, BuildNoHashHasher<u32>>, Error>
pub fn on_new_extended_mining_job( &mut self, m: NewExtendedMiningJob<'static>, ) -> Result<HashMap<u32, Mining<'static>, BuildNoHashHasher<u32>>, Error>
Calls [ChannelFactory::on_new_extended_mining_job
]
pub fn set_target(&mut self, new_target: &mut Target)
pub fn last_valid_job_version(&self) -> Option<u32>
sourcepub fn extranonce_from_downstream_extranonce(
&self,
ext: Extranonce,
) -> Option<Extranonce>
pub fn extranonce_from_downstream_extranonce( &self, ext: Extranonce, ) -> Option<Extranonce>
Returns the full extranonce, extranonce1 (static for channel) + extranonce2 (miner nonce space)
sourcepub fn last_prev_hash(&self) -> Option<U256<'static>>
pub fn last_prev_hash(&self) -> Option<U256<'static>>
Returns the most recent prev hash
pub fn last_min_ntime(&self) -> Option<u32>
pub fn last_nbits(&self) -> Option<u32>
pub fn extranonce_size(&self) -> usize
pub fn channel_extranonce2_size(&self) -> usize
pub fn update_pool_outputs(&mut self, outs: Vec<TxOut>)
pub fn get_this_channel_id(&self) -> u32
sourcepub fn get_upstream_extranonce1_len(&self) -> usize
pub fn get_upstream_extranonce1_len(&self) -> usize
returns the extranonce1 len of the upstream. For a proxy, this would be the extranonce_prefix len