Post
Topic
Board Announcements (Altcoins)
Re: [ANN] CRAVE 1st POS Masternodes | Dark Assets | Markets Soon =Embrace The Dark=
by
fusecavator
on 13/04/2015, 17:20:03 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.

I have about 5 seconds to check this out, but vtx[1] is the marker for PoS in crave.

https://github.com/industrialcoinmagic/crave/blob/master/src/main.h#L728

If the rest of your analysis is equally flawed, I'd suggest to the community not to waste to much time worrying about it.

[addendum]

The second paragraph is flawed too. The first points to CBlock and the second to CTransaction.


Yes, vtx[1] is the coinstake transaction, and it looks at it in the IsProofOfStake function, that doesn't contradict anything I said. vtx[0] is where the masternode payment verification code is looking however when the payment is part of that coinstake in vtx[1].