@@ -51,9 +51,9 @@ export class DatabaseService implements Contracts.Database.DatabaseService {
5151 }
5252
5353 public async init ( ) : Promise < void > {
54- app . get < Contracts . State . StateService > ( Container . Identifiers . StateService )
55- . getStore ( )
56- . setGenesisBlock ( Blocks . BlockFactory . fromJson ( Managers . configManager . get ( "genesisBlock" ) ) ) ;
54+ app . get < Contracts . State . StateStore > ( Container . Identifiers . StateStore ) . setGenesisBlock (
55+ Blocks . BlockFactory . fromJson ( Managers . configManager . get ( "genesisBlock" ) ) ,
56+ ) ;
5757
5858 if ( process . env . CORE_RESET_DATABASE ) {
5959 await this . reset ( ) ;
@@ -228,8 +228,7 @@ export class DatabaseService implements Contracts.Database.DatabaseService {
228228 const end : number = offset + limit - 1 ;
229229
230230 let blocks : Interfaces . IBlockData [ ] = app
231- . get < Contracts . State . StateService > ( Container . Identifiers . StateService )
232- . getStore ( )
231+ . get < Contracts . State . StateStore > ( Container . Identifiers . StateStore )
233232 . getLastBlocksByHeight ( start , end , headersOnly ) ;
234233
235234 if ( blocks . length !== limit ) {
@@ -292,8 +291,7 @@ export class DatabaseService implements Contracts.Database.DatabaseService {
292291
293292 for ( const [ i , height ] of heights . entries ( ) ) {
294293 const stateBlocks = app
295- . get < Contracts . State . StateService > ( Container . Identifiers . StateService )
296- . getStore ( )
294+ . get < Contracts . State . StateStore > ( Container . Identifiers . StateStore )
297295 . getLastBlocksByHeight ( height , height , true ) ;
298296
299297 if ( Array . isArray ( stateBlocks ) && stateBlocks . length > 0 ) {
@@ -320,8 +318,7 @@ export class DatabaseService implements Contracts.Database.DatabaseService {
320318
321319 public async getBlocksForRound ( roundInfo ?: Contracts . Shared . RoundInfo ) : Promise < Interfaces . IBlock [ ] > {
322320 let lastBlock : Interfaces . IBlock = app
323- . get < Contracts . State . StateService > ( Container . Identifiers . StateService )
324- . getStore ( )
321+ . get < Contracts . State . StateStore > ( Container . Identifiers . StateStore )
325322 . getLastBlock ( ) ;
326323
327324 if ( ! lastBlock ) {
@@ -372,8 +369,7 @@ export class DatabaseService implements Contracts.Database.DatabaseService {
372369
373370 public async getCommonBlocks ( ids : string [ ] ) : Promise < Interfaces . IBlockData [ ] > {
374371 let commonBlocks : Interfaces . IBlockData [ ] = app
375- . get < Contracts . State . StateService > ( Container . Identifiers . StateService )
376- . getStore ( )
372+ . get < Contracts . State . StateStore > ( Container . Identifiers . StateStore )
377373 . getCommonBlocks ( ids ) ;
378374
379375 if ( commonBlocks . length < ids . length ) {
@@ -385,8 +381,7 @@ export class DatabaseService implements Contracts.Database.DatabaseService {
385381
386382 public async getRecentBlockIds ( ) : Promise < string [ ] > {
387383 let blocks : any [ ] = app
388- . get < Contracts . State . StateService > ( Container . Identifiers . StateService )
389- . getStore ( )
384+ . get < Contracts . State . StateStore > ( Container . Identifiers . StateStore )
390385 . getLastBlockIds ( )
391386 . reverse ( )
392387 . slice ( 0 , 10 ) ;
@@ -653,8 +648,7 @@ export class DatabaseService implements Contracts.Database.DatabaseService {
653648
654649 private async createGenesisBlock ( ) : Promise < Interfaces . IBlock > {
655650 const genesisBlock : Interfaces . IBlock = app
656- . get < Contracts . State . StateService > ( Container . Identifiers . StateService )
657- . getStore ( )
651+ . get < Contracts . State . StateStore > ( Container . Identifiers . StateStore )
658652 . getGenesisBlock ( ) ;
659653
660654 await this . saveBlock ( genesisBlock ) ;
@@ -663,17 +657,13 @@ export class DatabaseService implements Contracts.Database.DatabaseService {
663657 }
664658
665659 private configureState ( lastBlock : Interfaces . IBlock ) : void {
666- const state : Contracts . State . StateService = app . get < Contracts . State . StateService > (
667- Container . Identifiers . StateService ,
668- ) ;
669-
670- state . getStore ( ) . setLastBlock ( lastBlock ) ;
660+ app . get < Contracts . State . StateStore > ( Container . Identifiers . StateStore ) . setLastBlock ( lastBlock ) ;
671661
672662 const { blocktime, block } = Managers . configManager . getMilestone ( ) ;
673663
674664 const blocksPerDay : number = Math . ceil ( 86400 / blocktime ) ;
675- state . getBlocks ( ) . resize ( blocksPerDay ) ;
676- state . getTransactions ( ) . resize ( blocksPerDay * block . maxTransactions ) ;
665+ app . get < any > ( Container . Identifiers . StateBlockStore ) . resize ( blocksPerDay ) ;
666+ app . get < any > ( Container . Identifiers . StateTransactionStore ) . resize ( blocksPerDay * block . maxTransactions ) ;
677667 }
678668
679669 private async initializeActiveDelegates ( height : number ) : Promise < void > {
0 commit comments