Commit Graph

15 Commits

Author SHA1 Message Date
Sergi Delgado Segura
f91413ebd8 Properly handles mempool checks
Transactions were included in the mempool as rawtxs but checked as txids, so effectively every time we checked if a transaction was in mempool it returned false
2019-11-20 12:59:29 +00:00
Sergi Delgado Segura
764e513ab9 Replaces asserts for Exceptions in simulator 2019-11-18 16:39:23 +00:00
Sergi Delgado Segura
20f296c9d4 Reformats code to match code guidelines 2019-11-07 15:47:35 +00:00
Sergi Delgado Segura
2bfee7bbcc Fixes simulator forks 2019-11-02 21:18:24 -07:00
Sergi Delgado Segura
7432eb1373 Improves sim with basic fork logic 2019-10-28 14:38:56 -07:00
Sergi Delgado Segura
52f52f57f8 Apply requested changes
- Adds a PRG based on a hardcoded seed to make the tests reproducible (get_random_value_hex)
- Updates all the tests replacing urandom for get_random_value_hex
- Properly places misplaced bitcoin_cli in bitcoin_sim_tests
- Typos
2019-10-23 12:40:25 +01:00
Sergi Delgado Segura
018faa07d1 Fixes change endianness
Porting change_endianness from Python2 to Python3 introduced a bug.
2019-10-22 14:59:09 +01:00
Sergi Delgado Segura
1643a7b887 Multiple simulator improvements
The simulator has been updated to work with real transaction structures instead of transaction hashes. It now supports:
	- Non-SegWit transaction format
	- Generation of blocks event-wise and time-wise

Some small issues have also been fixed.

With the new approach, the simulator can be used in a broader range of tests. Moreover tests can run faster since they do not have to wait for blocks. Instead, the generation of new blocks can be triggered by the test.
2019-10-17 19:00:15 +01:00
Sergi Delgado Segura
95759793ba Fixes bitcoin_cli
bitcoin_cli as a global variable in the main __init__.py was creating issues related to http.client.CannotSendRequest: Request-sent and connection re-usage. Define a new connection per request.
2019-10-17 17:17:52 +01:00
Sergi Delgado Segura
1de226374d Minot simulator updates 2019-10-09 17:34:44 +01:00
Sergi Delgado Segura
c67e41d185 Includes getbestblockhash so it can simulate db loads 2019-10-09 15:58:54 +01:00
Sergi Delgado Segura
e81ccd39a1 Adds API unit tests and modifies bitcoin_sim to be fixture compatible
- Adds unit tests for API
- Updates API to let BlockProcessor deal with block block related JSON-RPC
- Fixes BlockProcessor get_potential_matches return
- Makes bitcoin_sim runnable via function (instead of a main runnable script) to work with pytests fixture
- <3 Fixture
2019-10-08 18:55:27 +01:00
Sergi Delgado Segura
067efcca73 Clean unused imports and more cleanup 2019-10-07 11:58:28 +01:00
Sergi Delgado Segura
5ae210d893 Updates os.urandom to python3
All string generated with urandom(x) were using binascii + os.urandom + encode. In python3 os.urandom has a hex method.
2019-10-07 11:39:10 +01:00
Sergi Delgado Segura
beac88a2c5 Refactors test structure 2019-10-04 17:29:13 +01:00