@@ -123,11 +123,13 @@ pub struct TestMiner {
123
123
pub nonce : u64 ,
124
124
pub spent_at_nonce : HashMap < u64 , u128 > , // how much uSTX this miner paid in a given tx's nonce
125
125
pub test_with_tx_fees : bool , // set to true to make certain helper methods attach a pre-defined tx fee
126
+ pub chain_id : u32 ,
126
127
}
127
128
128
129
pub struct TestMinerFactory {
129
130
pub key_seed : [ u8 ; 32 ] ,
130
131
pub next_miner_id : usize ,
132
+ pub chain_id : u32 ,
131
133
}
132
134
133
135
impl TestMiner {
@@ -136,6 +138,7 @@ impl TestMiner {
136
138
privks : & Vec < StacksPrivateKey > ,
137
139
num_sigs : u16 ,
138
140
hash_mode : & AddressHashMode ,
141
+ chain_id : u32 ,
139
142
) -> TestMiner {
140
143
TestMiner {
141
144
burnchain : burnchain. clone ( ) ,
@@ -150,6 +153,7 @@ impl TestMiner {
150
153
nonce : 0 ,
151
154
spent_at_nonce : HashMap :: new ( ) ,
152
155
test_with_tx_fees : true ,
156
+ chain_id,
153
157
}
154
158
}
155
159
@@ -314,15 +318,7 @@ impl TestMinerFactory {
314
318
TestMinerFactory {
315
319
key_seed : [ 0u8 ; 32 ] ,
316
320
next_miner_id : 1 ,
317
- }
318
- }
319
-
320
- pub fn from_u16 ( seed : u16 ) -> TestMinerFactory {
321
- let mut bytes = [ 0u8 ; 32 ] ;
322
- ( & mut bytes[ 0 ..2 ] ) . copy_from_slice ( & seed. to_be_bytes ( ) ) ;
323
- TestMinerFactory {
324
- key_seed : bytes,
325
- next_miner_id : seed as usize ,
321
+ chain_id : CHAIN_ID_TESTNET ,
326
322
}
327
323
}
328
324
@@ -346,7 +342,7 @@ impl TestMinerFactory {
346
342
}
347
343
348
344
test_debug ! ( "New miner: {:?} {}:{:?}" , & hash_mode, num_sigs, & keys) ;
349
- let mut m = TestMiner :: new ( burnchain, & keys, num_sigs, & hash_mode) ;
345
+ let mut m = TestMiner :: new ( burnchain, & keys, num_sigs, & hash_mode, self . chain_id ) ;
350
346
m. id = self . next_miner_id ;
351
347
self . next_miner_id += 1 ;
352
348
m
0 commit comments