Skip to content

Commit

Permalink
use current block time stamp as current time.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaohong committed May 9, 2018
1 parent 2e5d519 commit 3861ecf
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.google.protobuf.ByteString;
import com.google.protobuf.InvalidProtocolBufferException;
import lombok.extern.slf4j.Slf4j;
import org.joda.time.DateTime;
import org.tron.common.utils.ByteArray;
import org.tron.core.Wallet;
import org.tron.core.capsule.AccountCapsule;
Expand Down Expand Up @@ -147,12 +146,12 @@ public boolean validate() throws ContractValidateException {
}
//Whether the exchange can be processed: to see if the exchange can be the exact int
long cost = participateAssetIssueContract.getAmount();

DateTime now = DateTime.now();
if (now.getMillis() >= assetIssueCapsule.getEndTime() || now.getMillis() < assetIssueCapsule
long now = dbManager.getDynamicPropertiesStore().getLatestBlockHeaderTimestamp();
if (now >= assetIssueCapsule.getEndTime() || now < assetIssueCapsule
.getStartTime()) {
throw new ContractValidateException("No longer valid period!");
}

int trxNum = assetIssueCapsule.getTrxNum();
int num = assetIssueCapsule.getNum();
long exchangeAmount = Math.multiplyExact(cost, num);
Expand Down

0 comments on commit 3861ecf

Please sign in to comment.