Conversation
There was a problem hiding this comment.
IMO we should serialize mapSporks too to avoid inconsistency, smth like this UdjinM6@75d2d14
|
Oooops, looks like I messed up in my own suggestion 🙈 pls see the fix UdjinM6@926e37b This reminds me however that it would be nice to have rpc tests here 😉 Test scenario could be smth like: start 2 connected nodes, send spork from one of them and make sure it propagated to another one, stop them, start one of them again and also the 3rd (clean) node, make sure 3rd node has correct sporks too (i.e. old node loaded sporks and propagated them on sync request from the 3rd one). |
|
Sorry, I've tried to check it in debugger in testnet, but have had a sync issues and didn't test it in details, it's my bad.( You are right, I should add the tests to this PR. |
|
Needs rebase, pls see #2213 |
|
|
||
| bool CSporkManager::GetSporkByHash(const uint256& hash, CSporkMessage &sporkRet) | ||
| { | ||
| const auto it = mapSporksByHash.find(hash); |
There was a problem hiding this comment.
Should protect via cs here as well I think.
qa/rpc-tests/sporks.py
Outdated
| connect_nodes(self.nodes[0], 1) | ||
|
|
||
| def get_test_spork_state(self, node): | ||
| info = node.spork('show') |
| self.set_test_spork_state(self.nodes[0], False) | ||
| start = time() | ||
| sent = False | ||
| while True: |
There was a problem hiding this comment.
pls add a small timeout between rpc calls in while True loops e.g. sleep(0.1)
| connect_nodes(self.nodes[1], 2) | ||
| start = time() | ||
| sent = False | ||
| while True: |
Save/load sporks set with their states in cache file (sporks.dat) to reload them after dashd restart, just like we already do for masternodes, governance, instantsend etc.