-2

I've been working on a PIVX fork for some time, to better understand blockchain infrastructure and coding in general. I have been able to modify all parameters, remove checkpoints, set up a new genesis block for blockchain and both enable PoW & disable PoW/switch to PoS and masternode succesfully.

I am somewhat stuck however, on this last piece of the puzzle - spork synchronization. After setting up a seed node, I can continue synchronization from 12% to 25%, yet it will never go past that instance.

The feeling I have is that it has to do with spork activation times (in spork.h), yet changing these values around have not worked in getting the synchronization to complete. I am aware that I may not understand how those sporks are supposed to synchronize well enough, so I hope someone can point me in the right direction.

Any help is much appreciated.

I've been working on a PIVX fork for some time, to better understand blockchain infrastructure and coding in general. I have been able to modify all parameters, remove checkpoints, set up a new genesis block for blockchain and both enable PoW & disable PoW/switch to PoS and masternode succesfully.

I am somewhat stuck however, on this last piece of the puzzle - spork synchronization. After setting up a seed node, I can continue synchronization from 12% to 25%, yet it will never go past that instance.

The feeling I have is that it has to do with spork activation times (in spork.h), yet changing these values around have not worked in getting the synchronization to complete. I am aware that I may not understand how those sporks are supposed to synchronize well enough, so I hope someone can point me in the right direction.

Any help is much appreciated.


Looking through masternode-sync.cpp, I find these instances:

    case (MASTERNODE_SYNC_SPORKS):
    RequestedMasternodeAssets = MASTERNODE_SYNC_LIST; 
    break;
[....]
    BOOST_FOREACH (CNode* pnode, vNodes) {
    pnode->ClearFulfilledRequest("getspork");
[....]
    if (mnodeman.CountEnabled() == 0 ) {
        if(syncCount < 2){
            Reset();
            syncCount++;
        }
    } else
        return;
[....]
    if (RequestedMasternodeAssets == MASTERNODE_SYNC_SPORKS) {
        if (pnode->HasFulfilledRequest("getspork")) continue;
        pnode->FulfilledRequest("getspork");

        pnode->PushMessage("getsporks"); //get current network sporks
        if (RequestedMasternodeAttempt >= 2) GetNextAsset();
        RequestedMasternodeAttempt++;

        return;
[....]
        //set to synced
    if (RequestedMasternodeAssets == MASTERNODE_SYNC_SPORKS) {
        if (pnode->HasFulfilledRequest("getspork")) continue;
        pnode->FulfilledRequest("getspork");

        pnode->PushMessage("getsporks"); //get current network sporks
        if (RequestedMasternodeAttempt >= 2) GetNextAsset();
        RequestedMasternodeAttempt++;

        return;
    }

They seem to corrobarate that is indeed a lack of nodes; it seems at least 2 nodes needed in order to complete syncing the sporks?

  • 1
    Downvoted. I don't think "please help me create my own cryptocurrency" are useful questions, as they only benefit the question asker and not a wider audience. Even when such projects are intended as learning experience, all you'll learn is how to make changes to make the codebase distinct. Contributing to existing projects is far more valuable. – Pieter Wuille Nov 17 '18 at 22:25
  • That is not the question, Pieter. I need to understand what is going wrong, in order to be able to fix it. As I said, 'I am aware that I may not understand how sporks are supposed to work'. I know they are soft forks integrated into the source code which can be easily turned on/off in order to prevent having to do a hard fork, or optimize the wallet, but the synchronization part of that does not seem to work. Instead of giving a negative remark and help noone, you could consider pointing in the right direction instead of a 'fix it'-answer - that is, if you know how - which would be appreciated – WG91 Nov 19 '18 at 6:47
  • I do not see how I can contribute to other projects if I can't understand all parts of the code and how they function once integrated. I have tried making several forks, of several different projects, and each time I am succesful up until this point. Therefore I'm assuming it's something small but significant that I do not get right, regarding sporks. There is not enough documentation out there for me to get it to work - or I can't find it - so pointing towards documentation would also be appreciated. – WG91 Nov 19 '18 at 6:49
  • My feeling is it might be due to lack of seed nodes? I tried editing a qt-wallet from a different coin (with protocol version bump) and that also gets stuck at synchronizing sporks. However I don't see why it would not be able to get past that sync. point without seed nodes.. – WG91 Nov 19 '18 at 7:10
  • @PieterWuille I decided to search through masternode-sync.cpp and came up with the parts of code (added to original post). This seems to indicate a lack of seed nodes is indeed the issue, am I right? – WG91 Nov 19 '18 at 19:04
0

This is not so much a spork-related question, as it is consensus-related. Peers can synchronize the blocks on the blockchain from a single peer, however other parameters (such as sporks) require consensus to be reached by multiple peers.

Setting up a minimum of 3 peer nodes and connecting to those will let consensus be reached and thus allow synchronization of all other blockchain parameters.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.