Skip to content

Conversation

@gladcow
Copy link

@gladcow gladcow commented Aug 8, 2018

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.

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we should serialize mapSporks too to avoid inconsistency, smth like this UdjinM6@75d2d14

@UdjinM6 UdjinM6 added this to the 12.4 milestone Aug 8, 2018
@UdjinM6
Copy link

UdjinM6 commented Aug 9, 2018

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).

@gladcow
Copy link
Author

gladcow commented Aug 9, 2018

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.

@UdjinM6
Copy link

UdjinM6 commented Aug 10, 2018

Needs rebase, pls see #2213


bool CSporkManager::GetSporkByHash(const uint256& hash, CSporkMessage &sporkRet)
{
const auto it = mapSporksByHash.find(hash);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should protect via cs here as well I think.

connect_nodes(self.nodes[0], 1)

def get_test_spork_state(self, node):
info = node.spork('show')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls use spork active instead

self.set_test_spork_state(self.nodes[0], False)
start = time()
sent = False
while True:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

utACK

@UdjinM6 UdjinM6 merged commit 1767e34 into dashpay:develop Aug 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants