web3coach / the-blockchain-bar

The source-code for: "Build a Blockchain from Scratch in Go" eBook.
https://web3.coach
GNU Lesser General Public License v3.0
499 stars 184 forks source link

Checking for sufficient balance when applying a transaction. #3

Closed edg956 closed 4 years ago

edg956 commented 4 years ago

When substracting the transaction's value (uint) to the sender's balance (uint) the result is also uint and the resulting value never less than 0. This allowed to make transactions from accounts without sufficient balance or previously non-existent.

web3coach commented 4 years ago

Well spotted. A very stupid error done in one of the overnight coding probably. I have fixed this back in December but in a different branch:

Selection_132

I will merge this, thanks for contributing!