rewrite mkStdTx for readability & future maintenance
- split functions out so that they read better and will likely be re-used for implementing other parts of the transaction layer.
- avoid unnecessary identifiers declaration. Too many identifiers in a single small context don’t make things more readable.
- changed a few types to avoid repeating the same unwrapping operation
- named some in-place calculation (like realFee)
- used forM + pattern-matching instead of mapM and pointfree style. Pointfree is usually not readable when it’s in a context with more than one line
StartupSpec: Fix the tests
Two things seem to make the tests flaky:
After the withPipe action finishes the file handles are closed. This causes hGetChar to throw an exception. It messes up the test result when the left-hand side of the withShutdownHandler race is still finishing.
If a hClose action is still in progress, it seems like it can end up executing the syscall after the next test case has started. The fd numbers are re-used, so it messes up the pipe for the next test case.
Make the clean shutdown handler simpler
This modifies the clean shutdown handler to use a FD from the command line, rather than taking stdin.
It also makes the logic even simpler, as shown in input-output-hk/cardano-node#767
The command-line arguments are changed from —shutdown-handler to —shutdown-ipc FD so that they are identical to cardano-node.