-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix V2 simulation and make test pass
TxSubmissionV2 test wasn't passing, due to various reasons. The first ones were due to the use of the partial `(!)` Map lookup function, in `orderByDeltaQ`. This function was assuming keep alive would fill the map with the `GSV`s, however this simulation only runs tx submission. The fix involved returning a default empty value. The second reason was due to the fact that the `decisionLogicThread` would try create a policy for each active peer and then write to all their MVars. At startup all these MVars will be empty since there aren't any policies, so any attempt to use `modifyMVar` is going to block. The fix was to write a custom `modifyMVarWithDefault` function to write the new policy if the MVar is empty. The third reason was due to the fact that there was a race condition between the `decisionLogicThread` producing the right policy and inbound server picking up the most up to date policy. This would lead to the inbound side issuing a blocking request when the client was awaiting for a non-blocking request. This blocking request isn't wrong considering the policy it was used, it is a legit decision that's made which leads to the inbound server issuing a blocking request but because we have received a txid in the meantime and didn't manage to read it soon enough we didn't create a more important decision. The fix involved being aware of how many requests for txs we have in flight and not generate "low priority" policies. The fourth reason was due to the simple fact that the check for if the peer is above the `maxUnacknowledgedTxIds` value was `<` instead of `<=`.
- Loading branch information
Showing
6 changed files
with
173 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.