Where is the code which rejects transactions with insuffisent balance?

0

Simple question but I can’t find the answer again.
Where is the code which rejects transactions when the value of inputs is below the value of outputs (because I think to recall that check works like this) ?

And what’s the exact error message which is sent to the log in that case ?

user2284570

Posted 2019-04-28T14:40:49.800

Reputation: 189

Grepping in all files of the projects and all charsets for \".*Balance and insufficient is no help !user2284570 2019-04-28T14:41:50.970

Answers

1

Below is the code that checks that the inputs consumed are greater than the output

const CAmount value_out = tx.GetValueOut();
if (nValueIn < value_out) {
    return state.DoS(100, false, REJECT_INVALID, "bad-txns-in-belowout", false,
        strprintf("value in (%s) < value out (%s)", FormatMoney(nValueIn), FormatMoney(value_out)))

You can find it here.

Ugam Kamat

Posted 2019-04-28T14:40:49.800

Reputation: 5 180

And is this really the error message which state the balance is not enough on a third party transaction ? I think to recall the check is also in other functions.user2284570 2019-04-28T14:57:02.093

This is the transaction checking function which sees that the value in > value out.Ugam Kamat 2019-04-28T15:25:32.177

This function is then called in validation and mempool files https://github.com/bitcoin/bitcoin/search?q=checktxinputs&amp;unscoped_q=checktxinputs

Ugam Kamat 2019-04-28T15:31:27.737