mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 23:02:16 +00:00
CallTx to address with no code fails and costs gas
This commit is contained in:
parent
7b1fc780aa
commit
bda9a38544
@ -403,11 +403,16 @@ func ExecTx(blockCache *BlockCache, tx_ types.Tx, runCall bool, evc events.Firea
|
|||||||
// Maybe create a new callee account if
|
// Maybe create a new callee account if
|
||||||
// this transaction is creating a new contract.
|
// this transaction is creating a new contract.
|
||||||
if !createAccount {
|
if !createAccount {
|
||||||
if outAcc == nil {
|
if outAcc == nil || len(outAcc.Code) == 0 {
|
||||||
// take fees (sorry pal)
|
// if you call an account that doesn't exist
|
||||||
|
// or an account with no code then we take fees (sorry pal)
|
||||||
inAcc.Balance -= tx.Fee
|
inAcc.Balance -= tx.Fee
|
||||||
blockCache.UpdateAccount(inAcc)
|
blockCache.UpdateAccount(inAcc)
|
||||||
|
if outAcc == nil {
|
||||||
log.Debug(Fmt("Cannot find destination address %X. Deducting fee from caller", tx.Address))
|
log.Debug(Fmt("Cannot find destination address %X. Deducting fee from caller", tx.Address))
|
||||||
|
} else {
|
||||||
|
log.Debug(Fmt("Attempting to call an account (%X) with no code. Deducting fee from caller", tx.Address))
|
||||||
|
}
|
||||||
return types.ErrTxInvalidAddress
|
return types.ErrTxInvalidAddress
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user