@@ -2,7 +2,6 @@ import { Listr } from 'listr2';
22import  {  Observable  }  from  'rxjs' ; 
33import  DashCoreLib  from  '@dashevo/dashcore-lib' ; 
44import  waitForNodesToHaveTheSameHeight  from  '../../../../core/waitForNodesToHaveTheSameHeight.js' ; 
5- import  waitForNodesToHaveTheSameSporks  from  '../../../../core/waitForNodesToHaveTheSameSporks.js' ; 
65
76import  {  NETWORK_LOCAL ,  HPMN_COLLATERAL_AMOUNT  }  from  '../../../../constants.js' ; 
87
@@ -93,9 +92,40 @@ export default function configureCoreTaskFactory(
9392              } , 
9493            } , 
9594            { 
96-               title : 'Activating DIP3' , 
95+               title : 'Create wallet' , 
96+               task : async  ( )  =>  { 
97+                 const  disablePrivateKeys  =  false ; 
98+                 const  createBlankWallet  =  false ; 
99+                 const  walletPassphrase  =  '' ; 
100+                 const  avoidReuse  =  false ; 
101+                 const  loadOnStartup  =  true ; 
102+                 const  descriptors  =  false ; 
103+ 
104+                 await  ctx . coreService . getRpcClient ( ) . createWallet ( 
105+                   'main' , 
106+                   disablePrivateKeys , 
107+                   createBlankWallet , 
108+                   walletPassphrase , 
109+                   avoidReuse , 
110+                   descriptors , 
111+                   loadOnStartup , 
112+                 ) ; 
113+               } , 
114+             } , 
115+             { 
116+               title : 'Generating funds to use as a collateral for masternodes' , 
117+               task : ( )  =>  { 
118+                 const  amount  =  HPMN_COLLATERAL_AMOUNT  *  configGroup . length ; 
119+                 return  generateToAddressTask ( 
120+                   configGroup . find ( ( c )  =>  c . getName ( )  ===  'local_seed' ) , 
121+                   amount , 
122+                 ) ; 
123+               } , 
124+             } , 
125+             { 
126+               title : 'Activating v19 and v20' , 
97127              task : ( )  =>  new  Observable ( async  ( observer )  =>  { 
98-                 const  dip3ActivationHeight  =  1000 ; 
128+                 const  dip3ActivationHeight  =  901 ; 
99129                const  blocksToGenerateInOneStep  =  10 ; 
100130
101131                let  blocksGenerated  =  0 ; 
@@ -126,37 +156,6 @@ export default function configureCoreTaskFactory(
126156                return  this ; 
127157              } ) , 
128158            } , 
129-             { 
130-               title : 'Create wallet' , 
131-               task : async  ( )  =>  { 
132-                 const  disablePrivateKeys  =  false ; 
133-                 const  createBlankWallet  =  false ; 
134-                 const  walletPassphrase  =  '' ; 
135-                 const  avoidReuse  =  false ; 
136-                 const  loadOnStartup  =  true ; 
137-                 const  descriptors  =  false ; 
138- 
139-                 await  ctx . coreService . getRpcClient ( ) . createWallet ( 
140-                   'main' , 
141-                   disablePrivateKeys , 
142-                   createBlankWallet , 
143-                   walletPassphrase , 
144-                   avoidReuse , 
145-                   descriptors , 
146-                   loadOnStartup , 
147-                 ) ; 
148-               } , 
149-             } , 
150-             { 
151-               title : 'Generating funds to use as a collateral for masternodes' , 
152-               task : ( )  =>  { 
153-                 const  amount  =  HPMN_COLLATERAL_AMOUNT  *  configGroup . length ; 
154-                 return  generateToAddressTask ( 
155-                   configGroup . find ( ( c )  =>  c . getName ( )  ===  'local_seed' ) , 
156-                   amount , 
157-                 ) ; 
158-               } , 
159-             } , 
160159            { 
161160              title : 'Register masternodes' , 
162161              task : async  ( )  =>  { 
@@ -276,51 +275,6 @@ export default function configureCoreTaskFactory(
276275                ) ; 
277276              } , 
278277            } , 
279-             { 
280-               title : 'Wait for nodes to have the same sporks' , 
281-               task : ( )  =>  waitForNodesToHaveTheSameSporks ( ctx . coreServices ) , 
282-             } , 
283-             { 
284-               title : 'Activating DIP8 to enable ChainLocks' , 
285-               task : ( )  =>  new  Observable ( async  ( observer )  =>  { 
286-                 let  isDip8Activated  =  false ; 
287-                 let  blockchainInfo ; 
288- 
289-                 let  blocksGenerated  =  0 ; 
290- 
291-                 const  blocksToGenerateInOneStep  =  10 ; 
292- 
293-                 do  { 
294-                   ( { 
295-                     result : blockchainInfo , 
296-                   }  =  await  ctx . seedCoreService . getRpcClient ( ) . getBlockchainInfo ( ) ) ; 
297- 
298-                   isDip8Activated  =  blockchainInfo . softforks . dip0008 . active ; 
299- 
300-                   if  ( isDip8Activated )  { 
301-                     break ; 
302-                   } 
303- 
304-                   await  generateBlocks ( 
305-                     ctx . seedCoreService , 
306-                     blocksToGenerateInOneStep , 
307-                     NETWORK_LOCAL , 
308-                     // eslint-disable-next-line no-loop-func 
309-                     ( blocks )  =>  { 
310-                       blocksGenerated  +=  blocks ; 
311- 
312-                       observer . next ( `${ blocksGenerated }  ) ; 
313-                     } , 
314-                   ) ; 
315-                 }  while  ( ! isDip8Activated ) ; 
316- 
317-                 observer . next ( `DIP8 has been activated at height ${ blockchainInfo . softforks . dip0008 . height }  ) ; 
318- 
319-                 observer . complete ( ) ; 
320- 
321-                 return  this ; 
322-               } ) , 
323-             } , 
324278            { 
325279              title : 'Wait for nodes to have the same height' , 
326280              task : ( )  =>  waitForNodesToHaveTheSameHeight ( 
@@ -347,47 +301,6 @@ export default function configureCoreTaskFactory(
347301              title : 'Wait for quorums to be enabled' , 
348302              task : ( )  =>  enableCoreQuorumsTask ( ) , 
349303            } , 
350-             { 
351-               title : 'Activating V20 fork' , 
352-               task : ( )  =>  new  Observable ( async  ( observer )  =>  { 
353-                 let  isV20Activated  =  false ; 
354-                 let  blockchainInfo ; 
355- 
356-                 let  blocksGenerated  =  0 ; 
357- 
358-                 const  blocksToGenerateInOneStep  =  10 ; 
359- 
360-                 do  { 
361-                   ( { 
362-                     result : blockchainInfo , 
363-                   }  =  await  ctx . seedCoreService . getRpcClient ( ) . getBlockchainInfo ( ) ) ; 
364- 
365-                   isV20Activated  =  blockchainInfo . softforks  &&  blockchainInfo . softforks . v20 
366-                     &&  blockchainInfo . softforks . v20 . active ; 
367-                   if  ( isV20Activated )  { 
368-                     break ; 
369-                   } 
370- 
371-                   await  generateBlocks ( 
372-                     ctx . seedCoreService , 
373-                     blocksToGenerateInOneStep , 
374-                     NETWORK_LOCAL , 
375-                     // eslint-disable-next-line no-loop-func 
376-                     ( blocks )  =>  { 
377-                       blocksGenerated  +=  blocks ; 
378- 
379-                       observer . next ( `${ blocksGenerated }  ) ; 
380-                     } , 
381-                   ) ; 
382-                 }  while  ( ! isV20Activated ) ; 
383- 
384-                 observer . next ( `V20 fork has been activated at height ${ blockchainInfo . softforks . v20 . height }  ) ; 
385- 
386-                 observer . complete ( ) ; 
387- 
388-                 return  this ; 
389-               } ) , 
390-             } , 
391304            { 
392305              title : 'Wait for nodes to have the same height' , 
393306              task : ( )  =>  waitForNodesToHaveTheSameHeight ( 
@@ -396,41 +309,23 @@ export default function configureCoreTaskFactory(
396309              ) , 
397310            } , 
398311            { 
399-               title : 'Enable EHF spork' , 
400-               task : async  ( )  =>  new  Observable ( async  ( observer )  =>  { 
401-                 const  seedRpcClient  =  ctx . seedCoreService . getRpcClient ( ) ; 
402-                 const  { 
403-                   result : initialCoreChainLockedHeight , 
404-                 }  =  await  seedRpcClient . getBlockCount ( ) ; 
405- 
406-                 await  activateCoreSpork ( 
407-                   seedRpcClient , 
408-                   'SPORK_24_TEST_EHF' , 
409-                   initialCoreChainLockedHeight , 
410-                 ) ; 
411- 
412-                 let  isEhfActivated  =  false ; 
413-                 let  blockchainInfo ; 
312+               title : 'Activating v21 fork' , 
313+               task : ( )  =>  new  Observable ( async  ( observer )  =>  { 
314+                 const  dip3ActivationHeight  =  1001 ; 
315+                 const  blocksToGenerateInOneStep  =  10 ; 
414316
415317                let  blocksGenerated  =  0 ; 
416- 
417-                 const  blocksToGenerateInOneStep  =  48 ; 
318+                 let  { 
319+                   result : currentBlockHeight , 
320+                 }  =  await  ctx . coreService . getRpcClient ( ) . getBlockCount ( ) ; 
418321
419322                do  { 
420323                  ( { 
421-                     result : blockchainInfo , 
422-                   }  =  await  ctx . seedCoreService . getRpcClient ( ) . getBlockchainInfo ( ) ) ; 
423- 
424-                   isEhfActivated  =  blockchainInfo . softforks  &&  blockchainInfo . softforks . mn_rr 
425-                     &&  blockchainInfo . softforks . mn_rr . active ; 
426-                   if  ( isEhfActivated )  { 
427-                     break ; 
428-                   } 
429- 
430-                   await  ctx . bumpMockTime ( blocksToGenerateInOneStep ) ; 
324+                     result : currentBlockHeight , 
325+                   }  =  await  ctx . coreService . getRpcClient ( ) . getBlockCount ( ) ) ; 
431326
432327                  await  generateBlocks ( 
433-                     ctx . seedCoreService , 
328+                     ctx . coreService , 
434329                    blocksToGenerateInOneStep , 
435330                    NETWORK_LOCAL , 
436331                    // eslint-disable-next-line no-loop-func 
@@ -440,9 +335,7 @@ export default function configureCoreTaskFactory(
440335                      observer . next ( `${ blocksGenerated }  ) ; 
441336                    } , 
442337                  ) ; 
443-                 }  while  ( ! isEhfActivated ) ; 
444- 
445-                 observer . next ( `EHF has been activated at height ${ blockchainInfo . softforks . mn_rr . height }  ) ; 
338+                 }  while  ( dip3ActivationHeight  >  currentBlockHeight ) ; 
446339
447340                observer . complete ( ) ; 
448341
0 commit comments