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

Before running TestNode_MiningSpamTransactions the base data needs to be reset #16

Closed cmaahs closed 3 years ago

cmaahs commented 3 years ago

If the tests are run as a whole, and not individually, this test will fail because the accounts will have values from previous tests, rather than the initial setup values.


    node_integration_test.go:618: Andrej balance is incorrect. Expected: 0. Got: 250
    node_integration_test.go:622: BabaYaga balance is incorrect. Expected: 800. Got: 600
    node_integration_test.go:626: Miner balance is incorrect. Expected: 300. Got: 250
    node_integration_test.go:629: Andrej final balance: 250 TBB
    node_integration_test.go:630: BabaYaga final balance: 600 TBB
    node_integration_test.go:631: Miner final balance: 250 TBB
--- FAIL: TestNode_MiningSpamTransactions (480.01s)
FAIL
FAIL    github.com/web3coach/the-blockchain-bar/node    2262.935s
FAIL```
web3coach commented 3 years ago

thx for reporting @cmaahs !

web3coach commented 3 years ago

Fixed https://github.com/web3coach/the-blockchain-bar/commit/4c6888684db23a2f601517fc4537fd420539b23c