use of com.hedera.services.exceptions.InsufficientFundsException in project hedera-services by hashgraph.
the class CryptoCreateTransitionLogic method doStateTransition.
@Override
public void doStateTransition() {
try {
TransactionBody cryptoCreateTxn = txnCtx.accessor().getTxn();
AccountID sponsor = cryptoCreateTxn.getTransactionID().getAccountID();
CryptoCreateTransactionBody op = cryptoCreateTxn.getCryptoCreateAccount();
long balance = op.getInitialBalance();
final var created = ledger.create(sponsor, balance, asCustomizer(op));
sigImpactHistorian.markEntityChanged(created.getAccountNum());
txnCtx.setCreated(created);
txnCtx.setStatus(SUCCESS);
} catch (InsufficientFundsException ife) {
txnCtx.setStatus(INSUFFICIENT_PAYER_BALANCE);
} catch (Exception e) {
log.warn("Avoidable exception!", e);
txnCtx.setStatus(FAIL_INVALID);
}
}
Aggregations