@@ -70,8 +70,8 @@ public static byte[] composeStorageKey(long slot, byte[] address) {
7070 * Run once from {@code Manager.init()} after config is loaded into the store.
7171 */
7272 public static void deployIfMissing (Manager manager ) {
73- if (manager .getChainBaseManager (). getDynamicPropertiesStore ().allowTvmPrague ()
74- && !manager .getChainBaseManager (). getCodeStore ().has (HISTORY_STORAGE_ADDRESS )) {
73+ if (manager .getDynamicPropertiesStore ().allowTvmPrague ()
74+ && !manager .getCodeStore ().has (HISTORY_STORAGE_ADDRESS )) {
7575 deploy (manager );
7676 }
7777 }
@@ -85,28 +85,24 @@ public static void deployIfMissing(Manager manager) {
8585 public static void deploy (Manager manager ) {
8686 byte [] addr = HISTORY_STORAGE_ADDRESS ;
8787
88- if (!manager .getChainBaseManager ().getCodeStore ().has (addr )) {
89- manager .getChainBaseManager ().getCodeStore ()
90- .put (addr , new CodeCapsule (HISTORY_STORAGE_CODE ));
88+ if (!manager .getCodeStore ().has (addr )) {
89+ manager .getCodeStore ().put (addr , new CodeCapsule (HISTORY_STORAGE_CODE ));
9190 }
9291
93- if (!manager .getChainBaseManager (). getContractStore ().has (addr )) {
92+ if (!manager .getContractStore ().has (addr )) {
9493 SmartContract sc = SmartContract .newBuilder ()
9594 .setName (HISTORY_STORAGE_NAME )
9695 .setContractAddress (ByteString .copyFrom (addr ))
9796 .setOriginAddress (ByteString .copyFrom (addr ))
9897 .setConsumeUserResourcePercent (100L )
9998 .setOriginEnergyLimit (0L )
10099 .build ();
101- manager .getChainBaseManager ().getContractStore ()
102- .put (addr , new ContractCapsule (sc ));
100+ manager .getContractStore ().put (addr , new ContractCapsule (sc ));
103101 }
104102
105- if (!manager .getChainBaseManager ().getAccountStore ().has (addr )) {
106- AccountCapsule account = new AccountCapsule (
107- ByteString .copyFrom (addr ),
108- Protocol .AccountType .Contract );
109- manager .getChainBaseManager ().getAccountStore ().put (addr , account );
103+ if (!manager .getAccountStore ().has (addr )) {
104+ manager .getAccountStore ().put (addr ,
105+ new AccountCapsule (ByteString .copyFrom (addr ), Protocol .AccountType .Contract ));
110106 }
111107 }
112108
@@ -123,9 +119,8 @@ public static void write(Manager manager, BlockCapsule block) {
123119 return ;
124120 }
125121 long slot = (block .getNum () - 1 ) % HISTORY_SERVE_WINDOW ;
126- byte [] parentHash = block .getParentHash ().getBytes ();
127122 byte [] storageKey = composeStorageKey (slot , HISTORY_STORAGE_ADDRESS );
128- StorageRowCapsule row = new StorageRowCapsule ( storageKey , parentHash );
129- manager .getChainBaseManager (). getStorageRowStore ().put (storageKey , row );
123+ byte [] parentHash = block . getParentHash (). getBytes ( );
124+ manager .getStorageRowStore ().put (storageKey , new StorageRowCapsule ( storageKey , parentHash ) );
130125 }
131126}
0 commit comments