fixup: inline retained functions
The retained functions in Types.hs are just small wrappes around IntPSQ functions.
The retained functions in Types.hs are just small wrappes around IntPSQ functions.
Improve comment around deletion of retaind txs.
Code refactoring
Replace the local state tvar with V1's Stateful types.
The first peer that advertised a new txid always got a lease on it. This is a problem since the peer may be at capacity and unable to request the TX. Update the behaviour so that anyone peer that advertise a txid can gain the first claim.
Remove the tracking of advertisers in TxEntry. This change also changing how scoring is used to rank peers. A peers score affects how long time after the TX owners lease expire they can wake up and attempt to claim it. This means that acknowledgement/downloading requires minimal coordination between peers.
We don't need to track the ack state, it can be derived by the time we decide to ack a TX. So txAdvertisers can just be a Set member check.
Avoid copying the map when encountering an existing advertiser.
Instead of traversing all peers only touch the peers that need to wake up.
Add benchmarks for V2
Have the peer update its score during phase change. This makes State's idle calculation quicker since peers will drain back to 0. Mark pacIdlePeerScores as lazy to avoid doing the calculations when it isn't needed.
allow peers that would have submitted a failing tx to the mempool to act as if they had (but without taking a penalty).
Remove shared states that where only written to.
Use sharedGeneration to track if the sharedState really changed and only write to the tvar if it changed. This makes common operations like receiving and acking a txid that is already retained something that only affects the peer local state.
This makes it easier to analyse different runs, since all of them use the same connection four tuples.
./network-mux/demo/ns-setup.sh is a generic script for running client / server applications using traffic shaping. We can reuse it for `tx-submission` demo.