@@ -12,11 +12,7 @@ use std::{collections::HashMap, convert::TryInto};
12
12
use template_distribution_sv2:: { NewTemplate , SetNewPrevHash } ;
13
13
use tracing:: debug;
14
14
15
- use stratum_common:: bitcoin:: {
16
- blockdata:: transaction:: { Transaction , TxOut } ,
17
- consensus:: Decodable ,
18
- util:: psbt:: serialize:: Deserialize ,
19
- } ;
15
+ use stratum_common:: bitcoin:: { blockdata:: transaction:: TxOut , consensus:: Decodable } ;
20
16
21
17
#[ derive( Debug ) ]
22
18
pub struct JobsCreators {
@@ -235,45 +231,6 @@ fn new_extended_job(
235
231
Ok ( new_extended_mining_job)
236
232
}
237
233
238
- /// Helper type to strip a segwit data from the coinbase_tx_prefix and coinbase_tx_suffix
239
- /// to ensure miners are hashing with the correct coinbase
240
- pub fn extended_job_to_non_segwit (
241
- job : NewExtendedMiningJob < ' static > ,
242
- full_extranonce_len : usize ,
243
- ) -> Result < NewExtendedMiningJob < ' static > , Error > {
244
- let mut encoded = job. coinbase_tx_prefix . to_vec ( ) ;
245
- // just add empty extranonce space so it can be deserialized. The real extranonce
246
- // should be inserted based on the miner's shares
247
- let extranonce = vec ! [ 0_u8 ; full_extranonce_len] ;
248
- encoded. extend_from_slice ( & extranonce[ ..] ) ;
249
- encoded. extend_from_slice ( job. coinbase_tx_suffix . inner_as_ref ( ) ) ;
250
- let tx = Transaction :: deserialize ( & encoded) . map_err ( |_| Error :: InvalidCoinbase ) ?;
251
-
252
- let coinbase = Coinbase {
253
- tx,
254
- script_sig_prefix_len : job. coinbase_tx_prefix . len ( )
255
- - (
256
- 4 + // version
257
- 1 + // input count
258
- 32 + // outpoint
259
- 4 + // input index
260
- 1
261
- // script length byte
262
- ) ,
263
- } ;
264
-
265
- Ok ( NewExtendedMiningJob {
266
- channel_id : job. channel_id ,
267
- job_id : job. job_id ,
268
- min_ntime : job. min_ntime ,
269
- version : job. version ,
270
- version_rolling_allowed : job. version_rolling_allowed ,
271
- merkle_path : job. merkle_path ,
272
- coinbase_tx_prefix : coinbase. clone ( ) . coinbase_tx_prefix ( ) ?,
273
- coinbase_tx_suffix : coinbase. coinbase_tx_suffix ( ) ?,
274
- } )
275
- }
276
-
277
234
// Test
278
235
#[ cfg( test) ]
279
236
@@ -284,6 +241,9 @@ pub mod tests {
284
241
use binary_sv2:: u256_from_int;
285
242
use quickcheck:: { Arbitrary , Gen } ;
286
243
use std:: { cmp, vec} ;
244
+ use stratum_common:: bitcoin:: {
245
+ blockdata:: transaction:: Transaction , util:: psbt:: serialize:: Deserialize ,
246
+ } ;
287
247
288
248
#[ cfg( feature = "prop_test" ) ]
289
249
use std:: borrow:: BorrowMut ;
0 commit comments