ledgerloops / strategy-pit

Testing ground for LedgerLoop strategies
Apache License 2.0
0 stars 0 forks source link

Giraffe code readability #16

Closed michielbdejong closed 2 months ago

michielbdejong commented 3 months ago

There are many things going on in the Node and Giraffe code:

Maybe I can make it nicer if I use some sub objects:

michielbdejong commented 3 months ago

The refactor is going quite well so far, with Giraffe as a base class. One main thing to work out is how to update the message forwarder. I think it makes sense if the tests instantiate a NetworkSimulator, and adds NetworkNodes with names to it.

A NetworkNode has a process method, and it emits message(to, msgStr) events

michielbdejong commented 3 months ago

The TraceManager needs to read Probe info when a Trace comes in. I vaguely remember you can do this with events, but in https://nodejs.org/api/events.html I only see reference to catching an error from a listener, not to getting a return value.

I'll pass an anonymous function to the event handler. Might refactor this later if I have a better idea.