Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
UnidenifiedUser committed Oct 5, 2023
1 parent 6fe3132 commit 08ec2c0
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 30 deletions.
1 change: 1 addition & 0 deletions protocols/v2/binary-sv2/binary-sv2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ mod test {

let val = vec![u256_1, u256_2, u256_3];
let s = Seq064K::new(val).unwrap();

let test = Test { a: s };

#[cfg(not(feature = "with_serde"))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ impl ChannelFactory {
bits,
nonce: m.get_nonce(),
};
let hash_ = dbg!(header).block_hash();
let hash_ = header.block_hash();
let hash = hash_.as_hash().into_inner();

if tracing::level_enabled!(tracing::Level::DEBUG)
Expand All @@ -783,7 +783,7 @@ impl ChannelFactory {
hash.reverse();
debug!("Hash: {:?}", hash.to_vec().to_hex());
}
let hash: Target = dbg!(hash.into());
let hash: Target = hash.into();

if hash <= bitcoin_target {
let mut print_hash = hash_.as_hash().into_inner();
Expand Down Expand Up @@ -1092,20 +1092,18 @@ impl PoolChannelFactory {
if self.negotiated_jobs.contains_key(&m.channel_id) {
let referenced_job = self.negotiated_jobs.get(&m.channel_id).unwrap();
let merkle_path = referenced_job.merkle_path.to_vec();
let coinbase_outputs = self.pool_coinbase_outputs.clone();
let pool_signature = self.pool_signature.clone();
let extended_job = job_creator::extended_job_from_custom_job(
referenced_job,
coinbase_outputs,
pool_signature,
32,
)
.unwrap();
let prev_blockhash = crate::utils::u256_to_block_hash(referenced_job.prev_hash.clone());
let bits = referenced_job.nbits;
self.inner.check_target(
dbg!(Share::Extended(m.into_static())),
dbg!(target),
Share::Extended(m.into_static()),
target,
None,
0,
merkle_path,
Expand Down Expand Up @@ -1138,8 +1136,8 @@ impl PoolChannelFactory {
.0
.nbits;
self.inner.check_target(
dbg!(Share::Extended(m.into_static())),
dbg!(target),
Share::Extended(m.into_static()),
target,
Some(template_id),
0,
merkle_path,
Expand Down
7 changes: 2 additions & 5 deletions protocols/v2/roles-logic-sv2/src/job_creator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,10 @@ impl JobsCreators {

pub fn extended_job_from_custom_job(
referenced_job: &mining_sv2::SetCustomMiningJob,
mut pool_coinbase_outputs: Vec<TxOut>,
pool_signature: String,
extranonce_len: u8,
) -> Result<NewExtendedMiningJob<'static>, Error> {
let outputs = tx_outputs_to_costum_scripts(referenced_job.coinbase_tx_outputs.clone().as_ref());
let mut outputs = tx_outputs_to_costum_scripts(referenced_job.coinbase_tx_outputs.clone().as_ref());
let mut template = NewTemplate {
template_id: 0,
future_template: false,
Expand All @@ -155,11 +154,9 @@ pub fn extended_job_from_custom_job(
coinbase_tx_locktime: referenced_job.coinbase_tx_locktime,
merkle_path: referenced_job.merkle_path.clone(),
};
//let mut outputs = tx_outputs_to_costum_scripts(&server_tx_outputs);
//pool_coinbase_outputs.append(&mut outputs);
new_extended_job(
&mut template,
&mut pool_coinbase_outputs,
&mut outputs,
pool_signature,
0,
true,
Expand Down
1 change: 0 additions & 1 deletion roles/jd-client/src/proxy_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ pub struct Upstream {
pub authority_pubkey: EncodedEd25519PublicKey,
pub pool_address: String,
pub jd_address: String,
pub tp_address: String,
pub pool_signature: String, // string be included in coinbase tx input scriptsig
}

Expand Down
2 changes: 1 addition & 1 deletion roles/mining-proxy/src/lib/upstream_mining.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ impl UpstreamMiningNode {
let has_connection = self_mutex
.safe_lock(|self_| self_.connection.is_some())
.unwrap();
match dbg!(has_connection) {
match has_connection {
true => Ok(()),
false => {
let (address, authority_public_key) = self_mutex
Expand Down
3 changes: 1 addition & 2 deletions roles/pool/src/lib/mining_pool/message_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl ParseDownstreamMiningMessages<(), NullDownstreamMiningSelector, NoRouting>
&mut self,
m: SubmitSharesExtended,
) -> Result<SendTo<()>, Error> {
info!("Handling submit share extended {:?}", m);
debug!("Handling submit share extended {:?}", m);
let res = self
.channel_factory
.safe_lock(|cf| cf.on_submit_shares_extended(m.clone()))
Expand Down Expand Up @@ -200,7 +200,6 @@ impl ParseDownstreamMiningMessages<(), NullDownstreamMiningSelector, NoRouting>
}

fn handle_set_custom_mining_job(&mut self, m: SetCustomMiningJob) -> Result<SendTo<()>, Error> {
info!("New set custom mining job");
let m = SetCustomMiningJobSuccess {
channel_id: m.channel_id,
request_id: m.request_id,
Expand Down
3 changes: 1 addition & 2 deletions roles/pool/src/lib/template_receiver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,8 @@ impl TemplateRx {

async fn on_new_solution(self_: Arc<Mutex<Self>>, rx: Receiver<SubmitSolution<'static>>) {
let status_tx = self_.safe_lock(|s| s.status_tx.clone()).unwrap();
while let Ok(mut solution) = rx.recv().await {
while let Ok(solution) = rx.recv().await {
info!("Sending Solution to TP: {:?}", &solution);
solution.header_nonce = 93;
let sv2_frame_res: Result<StdFrame, _> =
PoolMessages::TemplateDistribution(TemplateDistribution::SubmitSolution(solution))
.try_into();
Expand Down
6 changes: 3 additions & 3 deletions test/config/interop-jd-change-upstream/jdc-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ retry = 10

tp_address = "75.119.150.111:8442"

# Pool signature (string to be included in coinbase tx)
# e.g. "Foundry USA", "Antpool", "/ViaBTC/Mined by gitgab19", etc
pool_signature = "Stratum v2 SRI Pool - gitgab19"


coinbase_outputs = [
{ output_script_type = "P2PKH", output_script_value = "02e13cef1348924c49dd1f708bf38eb79ae4648c16f0301085f37547d1d25e33e0" },
Expand All @@ -41,8 +39,10 @@ value = 1
authority_pubkey = "2di19GHYQnAZJmEpoUeP7C3Eg9TCcksHr23rZCC83dvUiZgiDL"
pool_address = "127.0.0.1:44254"
jd_address = "127.0.0.1:34264"
pool_signature = "Stratum v2 SRI Pool - gitgab19"

[[upstreams]]
authority_pubkey = "2di19GHYQnAZJmEpoUeP7C3Eg9TCcksHr23rZCC83dvUiZgiDL"
pool_address = "127.0.0.1:44255"
jd_address = "127.0.0.1:34264"
pool_signature = "Stratum v2 SRI Pool - gitgab19"
9 changes: 1 addition & 8 deletions test/config/interop-jd-change-upstream/jds-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,7 @@ coinbase_outputs = [
{ output_script_type = "P2PKH", output_script_value = "02e13cef1348924c49dd1f708bf38eb79ae4648c16f0301085f37547d1d25e33e0" },
]

# Template Provider config
# local TP (this is pointing to localhost so you must run a TP locally for this configuration to work)
# tp_address = "127.0.0.1:8442"
# hosted testnet TP
# tp_address = "89.116.25.191:8442"
# hosted regtest TP
#tp_address = "75.119.150.111:8442"
tp_address = "127.0.0.1:8442"
tp_address = "75.119.150.111:8442"

# SRI Pool JD config
listen_jd_address = "127.0.0.1:34264"
1 change: 1 addition & 0 deletions test/config/interop-jd-translator/jdc-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ value = 1
authority_pubkey = "2di19GHYQnAZJmEpoUeP7C3Eg9TCcksHr23rZCC83dvUiZgiDL"
pool_address = "127.0.0.1:34254"
jd_address = "127.0.0.1:34264"
pool_signature = "Stratum v2 SRI Pool - gitgab19"

0 comments on commit 08ec2c0

Please sign in to comment.