Skip to content

Update interface

David Vorick requested to merge update-interface into master

I'm making this PR now even though the build is failing. I wanted to explain what all the changes are before I continue improving the transaction pool.

The original intent of this PR was to make the transaction pool follow the update interface model of interacting with the state. The idea behind the update interface model is that the modules will spend significantly less time making locking calls to the state. Fewer locking calls also means less room for programmer error with regards to race conditions and deadlocks, of which there currently seem to be a few of each.

This expanded a bit as I decided to try and do the whole transaction pool package "correctly". This meant changing the way that the directories and the ports were chosen. I discovered that if you use ":0", the operating system will find you an open port and give you that one. It didn't work for the gateway tests, but it seems to have worked for all of the other tests.

This also meant changing the way file directories were chosen. Files are now saved to /tmp/SiaTesting or something like that. Each consensus set gets it's own directory. Each module, upon start, is responsible for creating its own directory using MkdirAll. I believe this is in conflict with how it currently works, where the daemon is responsible for creating the directories. I think the daemon should be responsible for choosing the directories, but the modules responsible for creating and populating them.

In some of the modules files (I think all of them with persistence), there's a variable like WalletDir, which just indicates the standard name of the sub-directory that the module uses (this is in the modules package, not any of the subpackages).

Because the transaction pool synchronization mechanism changed, some of the tests broke. Luckily, not many of them broke and a few of them had simple fixes. It'll probably take me a good amount of time to get to the ones that did break, because that's probably going to mean completely updating how that module operates.

I believe that the new method for synchronization is superior. We shouldn't need spin locks while testing any more, or sleeping. We should just be able to wait on a channel until all of the expected updates have been posted.

The transaction pool is under active construction. The structural changes should be more or less complete but I want to review the code and try to reduce the amount of locking that happens, as well as increase the test coverage.

Merge request reports