Post
Topic
Board Announcements (Altcoins)
Re: [ANN] CRAVE 1st POS Masternodes | Dark Assets | Markets Soon =Embrace The Dark=
by
webprods
on 13/04/2015, 12:15:23 UTC
I pmed the dev about this a few days ago, but haven't received any response, nor has anything been done about these, so I'm posting this here now hoping it'll get some answers. This is not the message I sent, this is reworded for general users who I don't expect to know much about the code.

There are multiple things I've found in the code that seem like problems. In the masternode payment enforcement, the code for checking that masternodes are being paid is checking the wrong transaction. In btc(and pow coins like darkcoin which the code came from) the block reward is in the first transaction (vtx[0]), and in PoS forks like crave is, vtx[0] is always left empty and the block reward is in vtx[1]. It can be seen here https://github.com/industrialcoinmagic/crave/blob/master/src/main.cpp#L2375 and https://github.com/industrialcoinmagic/crave/blob/master/src/main.cpp#L2357 that the code was not updated to look in vtx[1], and continues to look at vtx[0]. It can also be seen a little higher up in the same function that the block verification does check that vtx[0] is empty https://github.com/industrialcoinmagic/crave/blob/master/src/main.cpp#L2302 . Since block verification checks that vtx[0] is empty to even get to masternode payment verification, payment verification will never find an output to a masternode in that loop, and should reject all blocks, except it doesn't deadlock due to the next point.

The hard fork never happened. If you scroll up a little from the previous section, you'll see a flag used for enabling masternode enforcement. https://github.com/industrialcoinmagic/crave/blob/master/src/main.cpp#L2341 Right below it checks it against a timestamp, and sets the flag to true if we're past the fork time. Before we actually use the flag, there's another condition calling the IsSporkActive function https://github.com/industrialcoinmagic/crave/blob/master/src/main.cpp#L2341 which is capable of turning the flag back off. If you follow that function https://github.com/industrialcoinmagic/crave/blob/master/src/spork.cpp#L80 what happens in that call is it doesn't see that flag in the map, so heads into the else block where it copies SPORK_1_MASTERNODE_PAYMENTS_ENFORCEMENT_DEFAULT to r, and then compares r to the current time. If you take a look at the value compared https://github.com/industrialcoinmagic/crave/blob/master/src/spork.h#L28 , and convert that timestamp(2428537599) to normal time ( http://www.epochconverter.com/ ), you'll see that the timestamp used is Dec 16 2046. Clearly this hasn't happened yet, so IsSporkActive returns false, and that causes it to set the flag back to false so the masternode payment enforcement code is skipped over. Until ICM quieted the logging, it could also be seen in the logs that the skipped message was still being logged after the fork supposedly happened.

Lastly at https://github.com/industrialcoinmagic/crave/blob/master/src/main.cpp#L2320 the constant passed to IsSporkActive is the timestamp from before, not a spork ID, which causes the InstantX checks to be skipped.
@industrialcoinmagic
Agree with few points.First.My old wallet before fork update was mine at masternode better.2.My second wallet giving me error ( you must add masternode=1 to conf) but I did that .I check out my conf and everything looks ok but masternode didnt start becauseof this error.I did delete 5 times wallet and now I'm scare that I've lost 500 coins from masternode.However I have backup wallet and also copy of wallet .Waiting until this f,,,wallet finally sync so I can see if I lost 500 coins or have them.
Update ...Finally my second wallet after 5 times deleted  is sync.Have that 500 coins .So it's ok except that I getting this  error when I like to set up second masternode at my second system. Error "you must set masternode=1 in the configuration" Here is my configuration
                                      maxconnections=100
rpcuser=myname
rpcpassword=my password
rpcport=9999
gen=0
server=1
daemon=1
reservebalance=9999999
masternodeaddr=my static ip:9999
masternode=1
masternodeprivkey=masternodeprivkey
rpcallowip=127.0.0.1
WHAT DA HELL IS WRONG WITH THIS CONF?Huh Maybe RPCPORT?Huh Help!!!!!!!!!!!