<p>Below is the code that checks that the inputs consumed are greater than the output</p>

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

<p>You can find it <a href="https://github.com/bitcoin/bitcoin/blob/master/src/consensus/tx_verify.cpp#L187" rel="nofollow noreferrer">here</a>. </p>

CC BY-SA 4.0
2019-04-28T14:57:02.093Z
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
CC BY-SA 4.0
2019-04-28T15:25:32.177Z
This is the transaction checking function which sees that the value in > value out.
Ugam Kamat
CC BY-SA 4.0
2019-04-28T15:31:27.737Z
This function is then called in validation and mempool files https://github.com/bitcoin/bitcoin/search?q=checktxinputs&unscoped_q=checktxinputs
Ugam Kamat
CC BY-SA 4.0
2019-04-28T14:54:52.003Z
2019-04-28T14:54:52.003Z
Ugam Kamat
<p>Simple question but I can’t find the answer again.<br>
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) ?</p>

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

CC BY-SA 4.0
2019-04-28T14:41:50.970Z
Grepping in all files of the projects and all charsets for `\".*Balance` and `insufficient` is no help !
user2284570
<bitcoin-core><full-node><c++>
Where is the code which rejects transactions with insuffisent balance?
user2284570
# Where is the code which rejects transactions with insuffisent balance?

(Asked by: username_0 on 2019-04-28)

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 ?

**Tags:** bitcoin-core, full-node, c++

> **Comments:**
> **username_0**: Grepping in all files of the projects and all charsets for `\".*Balance` and `insufficient` is no help !  

---

## 1 answers

### Answer by username_1 on 2019-04-28. Score: 1 | Accepted answer

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](https://github.com/bitcoin/bitcoin/blob/master/src/consensus/tx_verify.cpp#L187).

> **Comments:**
> **username_0**: 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.  
> **username_1**: This is the transaction checking function which sees that the value in > value out.  
> **username_1**: This function is then called in validation and mempool files https://github.com/bitcoin/bitcoin/search?q=checktxinputs&unscoped_q=checktxinputs  

---

