File tree Expand file tree Collapse file tree 4 files changed +9
-6
lines changed
test/java/org/tron/core/actuator Expand file tree Collapse file tree 4 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ public boolean execute(TransactionResultCapsule ret) throws ContractExeException
6060
6161 private long calculateBandwidth (FreezeBalanceContract freezeBalanceContract ) {
6262
63- return freezeBalanceContract .getFrozenBalance () / 1_000_000L
63+ return freezeBalanceContract .getFrozenBalance ()
6464 * freezeBalanceContract .getFrozenDuration ()
6565 * dbManager .getDynamicPropertiesStore ().getBandwidthPerCoinday ();
6666 }
Original file line number Diff line number Diff line change @@ -151,13 +151,13 @@ private DynamicPropertiesStore(@Qualifier("properties") String dbName) {
151151 try {
152152 this .getBandwidthPerTransaction ();
153153 } catch (IllegalArgumentException e ) {
154- this .saveBandwidthPerTransaction (1 );
154+ this .saveBandwidthPerTransaction (100_000 );
155155 }
156156
157157 try {
158158 this .getBandwidthPerCoinday ();
159159 } catch (IllegalArgumentException e ) {
160- this .saveBandwidthPerCoinday (10 );
160+ this .saveBandwidthPerCoinday (1 );
161161 }
162162
163163 try {
Original file line number Diff line number Diff line change @@ -424,7 +424,6 @@ public synchronized boolean pushTransactions(final TransactionCapsule trx)
424424 if (!trx .validateSignature ()) {
425425 throw new ValidateSignatureException ("trans sig validate failed" );
426426 }
427- consumeBandwidth (trx );
428427
429428 validateTapos (trx );
430429
@@ -435,6 +434,7 @@ public synchronized boolean pushTransactions(final TransactionCapsule trx)
435434 }
436435
437436 try (RevokingStore .Dialog tmpDialog = revokingStore .buildDialog ()) {
437+ consumeBandwidth (trx );
438438 processTransaction (trx );
439439 pendingTransactions .add (trx );
440440 tmpDialog .merge ();
@@ -457,7 +457,10 @@ public void consumeBandwidth(TransactionCapsule trx) throws ValidateBandwidthExc
457457 long bandwidth = accountCapsule .getBandwidth ();
458458 long now = Time .getCurrentMillis ();
459459 long latestOperationTime = accountCapsule .getLatestOperationTime ();
460- if (now - latestOperationTime >= 5 * 60 * 1000 ) {
460+ //5 * 60 * 1000
461+ if (now - latestOperationTime >= 300_000L ) {
462+ accountCapsule .setLatestOperationTime (now );
463+ this .getAccountStore ().put (accountCapsule .createDbKey (), accountCapsule );
461464 return ;
462465 }
463466 long bandwidthPerTransaction = getDynamicPropertiesStore ().getBandwidthPerTransaction ();
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ public void testFreezeBalance() {
114114 Assert .assertEquals (owner .getBalance (), initBalance - frozenBalance
115115 - ChainConstant .TRANSFER_FEE );
116116 Assert .assertEquals (owner .getFrozenBalance (), frozenBalance );
117- Assert .assertEquals (owner .getBandwidth (), frozenBalance / 1_000_000
117+ Assert .assertEquals (owner .getBandwidth (), frozenBalance
118118 * duration
119119 * dbManager .getDynamicPropertiesStore ().getBandwidthPerCoinday ());
120120 } catch (ContractValidateException e ) {
You can’t perform that action at this time.
0 commit comments