Refactor API names to be more clear (h ==> historyDB, ....)
Grouped NewAPI parameters into a struct to avoid having a unreadable function with too many input parameters
Instantiate the coordinator network in the API package
Added related config parameters to run coordinator network both in run --mode cord and serveapi --mode cord
Changed the channel on the coordinators network for a function that acts as a handler, when initializing the API will pass a handler to store received txs to DB
When the HTTP API receives a valid tx it publish it to the coordinator network
Split logic from (HTTP) interface in the POST /transactions-pool in order to reuse the logic for the coordinator network handler (right now the gin related stuff made it hard to use this in the coordinators network)
How to test?
As of now, this requires manual testing:
Enable the coordinator network in the config file
Run the node in coordinator mode
You'll need some friends doing the same
Wait for the log message INFO coordinatornetwork/coordinatornetwork.go:91 X peers connected to the coordinator network where X should be equal or greater than 1, and idealy equal to the number of friends running the experiment
(HTTP) POST a tx to one of the nodes running the experiment
Check if the tx has been propagated to the other nodes
Note that I successfully performed the experiment with @ARR552 node and two nodes run by myself
Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
Closes #1062, #1026, #1023
What does this PR does?
h
==>historyDB
, ....)NewAPI
parameters into a struct to avoid having a unreadable function with too many input parametersrun --mode cord
andserveapi --mode cord
POST /transactions-pool
in order to reuse the logic for the coordinator network handler (right now the gin related stuff made it hard to use this in the coordinators network)How to test?
As of now, this requires manual testing:
INFO coordinatornetwork/coordinatornetwork.go:91 X peers connected to the coordinator network
whereX
should be equal or greater than 1, and idealy equal to the number of friends running the experimentNote that I successfully performed the experiment with @ARR552 node and two nodes run by myself
Checklist
These are the criteria that every PR should meet, please check them off as you review them: