You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
extranonce_prefix: extranonce.try_into().expect("Internal error: On initialization we make sure that extranonce + coinbase script additional data are not > then 32 bytes"),
471
481
group_channel_id: hom_group_id,
472
482
},
473
483
));
@@ -521,21 +531,21 @@ impl ChannelFactory {
521
531
self.standard_channels_for_non_hom_downstreams
522
532
.insert(complete_id, standard_channel);
523
533
524
-
let extranonce = match additional_coinbase_script_data {
534
+
let extranonce:Vec<u8> = match additional_coinbase_script_data {
525
535
Some(data) => {
526
536
letmut data = data.to_vec();
527
537
data.extend_from_slice(extranonce.as_ref());
528
-
extranonce
538
+
data
529
539
}
530
-
None => extranonce,
540
+
None => extranonce.into(),
531
541
};
532
542
// First message to be sent is OpenStandardMiningChannelSuccess
let out = TxOut{value:BLOCK_REWARD,script_pubkey:decode_hex("4104c6d0969c2d98a5c19ba7c36c7937c5edbd60ff2a01397c4afe54f16cd641667ea0049ba6f9e1796ba3c8e49e1b504c532ebbaaa1010c3f7d9b83a8ea7fd800e2ac").unwrap().into()};
2334
+
let creator = JobsCreators::new(7);
2335
+
let share_per_min = 1.0;
2336
+
let extranonces = ExtendedExtranonce::new(0..0,0..0,0..7);
2337
+
2338
+
let ids = Arc::new(Mutex::new(GroupId::new()));
2339
+
let channel_kind = ExtendedChannelKind::Pool;
2340
+
letmut channel = PoolChannelFactory::new(
2341
+
ids,
2342
+
extranonces,
2343
+
creator,
2344
+
share_per_min,
2345
+
channel_kind,
2346
+
vec![out],
2347
+
extranonce_prefix1.clone().into(),
2348
+
)
2349
+
.unwrap();
2350
+
2351
+
// Build a NewTemplate
2352
+
let new_template = NewTemplate{
2353
+
template_id:10,
2354
+
future_template:true,
2355
+
version:VERSION,
2356
+
coinbase_tx_version:1,
2357
+
coinbase_prefix: prefix.try_into().unwrap(),
2358
+
coinbase_tx_input_sequence: u32::MAX,
2359
+
coinbase_tx_value_remaining:5_000_000_000,
2360
+
coinbase_tx_outputs_count:0,
2361
+
coinbase_tx_outputs:get_coinbase_outputs(),
2362
+
coinbase_tx_locktime:0,
2363
+
merkle_path:get_merkle_path(),
2364
+
};
2365
+
2366
+
// "Send" the NewTemplate to the channel
2367
+
let _ = channel.on_new_template(&mut(new_template.clone()));
2368
+
2369
+
// Build a PrevHash
2370
+
letmut p_hash = decode_hex(PREV_HASH).unwrap();
2371
+
p_hash.reverse();
2372
+
let prev_hash = SetNewPrevHashFromTp{
2373
+
template_id:10,
2374
+
prev_hash: p_hash.try_into().unwrap(),
2375
+
header_timestamp:PREV_HEADER_TIMESTAMP,
2376
+
n_bits:PREV_HEADER_NBITS,
2377
+
target:nbit_to_target(PREV_HEADER_NBITS),
2378
+
};
2379
+
2380
+
// "Send" the SetNewPrevHash to channel
2381
+
let _ = channel.on_new_prev_hash_from_tp(&prev_hash);
let out = TxOut{value:BLOCK_REWARD,script_pubkey:decode_hex("4104c6d0969c2d98a5c19ba7c36c7937c5edbd60ff2a01397c4afe54f16cd641667ea0049ba6f9e1796ba3c8e49e1b504c532ebbaaa1010c3f7d9b83a8ea7fd800e2ac").unwrap().into()};
2400
+
let creator = JobsCreators::new(16);
2401
+
let share_per_min = 1.0;
2402
+
let extranonces = ExtendedExtranonce::new(0..0,0..8,8..16);
2403
+
2404
+
let ids = Arc::new(Mutex::new(GroupId::new()));
2405
+
let channel_kind = ExtendedChannelKind::Pool;
2406
+
letmut channel = PoolChannelFactory::new(
2407
+
ids,
2408
+
extranonces,
2409
+
creator,
2410
+
share_per_min,
2411
+
channel_kind,
2412
+
vec![out],
2413
+
extranonce_prefix1.clone().into(),
2414
+
)
2415
+
.unwrap();
2416
+
2417
+
// Build a NewTemplate
2418
+
let new_template = NewTemplate{
2419
+
template_id:10,
2420
+
future_template:true,
2421
+
version:VERSION,
2422
+
coinbase_tx_version:1,
2423
+
coinbase_prefix: prefix.try_into().unwrap(),
2424
+
coinbase_tx_input_sequence: u32::MAX,
2425
+
coinbase_tx_value_remaining:5_000_000_000,
2426
+
coinbase_tx_outputs_count:0,
2427
+
coinbase_tx_outputs:get_coinbase_outputs(),
2428
+
coinbase_tx_locktime:0,
2429
+
merkle_path:get_merkle_path(),
2430
+
};
2431
+
2432
+
// "Send" the NewTemplate to the channel
2433
+
let _ = channel.on_new_template(&mut(new_template.clone()));
2434
+
2435
+
// Build a PrevHash
2436
+
letmut p_hash = decode_hex(PREV_HASH).unwrap();
2437
+
p_hash.reverse();
2438
+
let prev_hash = SetNewPrevHashFromTp{
2439
+
template_id:10,
2440
+
prev_hash: p_hash.try_into().unwrap(),
2441
+
header_timestamp:PREV_HEADER_TIMESTAMP,
2442
+
n_bits:PREV_HEADER_NBITS,
2443
+
target:nbit_to_target(PREV_HEADER_NBITS),
2444
+
};
2445
+
2446
+
let _ = channel.on_new_prev_hash_from_tp(&prev_hash);
0 commit comments