Fix payment availability: sender.balance >= tx.value + tx.gas

This commit is contained in:
Roman Mandeleil 2015-01-08 20:26:24 +02:00
parent 18ed198750
commit 620f365205
1 changed files with 2 additions and 2 deletions

View File

@ -122,7 +122,8 @@ public class TransactionExecutor {
// the purchased gas will be available for // the purchased gas will be available for
// the contract in the execution state, // the contract in the execution state,
// it can be retrieved using GAS op // it can be retrieved using GAS op
if (track.getBalance(senderAddress).compareTo(gasDebit) == -1) { BigInteger txValue = new BigInteger(1, tx.getValue());
if (track.getBalance(senderAddress).compareTo(gasDebit.add(txValue)) == -1) {
logger.debug("No gas to start the execution: sender={}", logger.debug("No gas to start the execution: sender={}",
Hex.toHexString(senderAddress)); Hex.toHexString(senderAddress));
@ -133,7 +134,6 @@ public class TransactionExecutor {
// THE SIMPLE VALUE/BALANCE CHANGE // THE SIMPLE VALUE/BALANCE CHANGE
BigInteger txValue = new BigInteger(1, tx.getValue());
if (track.getBalance(senderAddress).compareTo(txValue) >= 0) { if (track.getBalance(senderAddress).compareTo(txValue) >= 0) {
track.addBalance(receiverAddress, txValue); // balance will be read again below track.addBalance(receiverAddress, txValue); // balance will be read again below