44import java .util .Iterator ;
55import java .util .Map ;
66import java .util .Map .Entry ;
7+ import lombok .extern .slf4j .Slf4j ;
78import org .tron .core .capsule .AccountCapsule ;
89import org .tron .core .capsule .AssetIssueCapsule ;
910import org .tron .core .capsule .ExchangeCapsule ;
1011import org .tron .core .db .Manager ;
1112
12-
13+ @ Slf4j
1314public class AssetUpdateHelper {
1415
1516 private Manager dbManager ;
@@ -21,11 +22,13 @@ public AssetUpdateHelper(Manager dbManager) {
2122 }
2223
2324 public void doWork () {
25+ logger .info ("Start to update the asset" );
2426 init ();
2527 updateAsset ();
2628 updateExchange ();
2729 updateAccount ();
2830 finish ();
31+ logger .info ("Complete the asset update" );
2932 }
3033
3134 public void init () {
@@ -47,6 +50,8 @@ public void updateAsset() {
4750 tokenIdNum ++;
4851 }
4952
53+ logger .info ("Complete the asset store update" );
54+
5055 }
5156
5257 public void updateExchange () {
@@ -59,10 +64,14 @@ public void updateExchange() {
5964 dbManager .getExchangeV2Store ().put (exchangeCapsule .createDbKey (), exchangeCapsule );
6065 }
6166
67+ logger .info ("Complete the exchange store update" );
68+
6269 }
6370
6471 public void updateAccount () {
6572
73+ long count = 0 ;
74+
6675 Iterator <Entry <byte [], AccountCapsule >> iterator = dbManager .getAccountStore ().iterator ();
6776 while (iterator .hasNext ()) {
6877 AccountCapsule accountCapsule = iterator .next ().getValue ();
@@ -75,8 +84,14 @@ public void updateAccount() {
7584 accountCapsule .addAssetV2Map (assetV2Map );
7685 dbManager .getAccountStore ().put (accountCapsule .createDbKey (), accountCapsule );
7786
87+ if (count % 50000 == 0 ) {
88+ logger .info ("The number of accounts that have completed the update :{}" , count );
89+ }
90+ count ++;
7891 }
7992
93+ logger .info ("Complete the account store update" );
94+
8095 }
8196
8297 public void finish () {
0 commit comments