TeamEmpireCoin / EmpireCoin

EmpireCoin is an experimental cryptocurrency where players vote on outcomes to win coins
http://empirecoin.org
MIT License
2 stars 2 forks source link

Nodes need to reject blocks that include an invalid payout transaction #7

Closed joeyfrich closed 8 years ago

joeyfrich commented 8 years ago

Nodes should reject invalid payout transactions and fork. Currently empirecoind seems to accept payout transactions which violate protocol rules.

I suspect that all new code for checking the validity of a payout transaction needs to be added somewhere like the ConnectBlock() function of main.cpp

xmadisco commented 8 years ago

In a block, how are we to determine what is a payout transaction exactly?

joeyfrich commented 8 years ago

We could treat any transaction with no inputs, but with outputs not equalling 25 coins as a potential voting payout transaction which should be checked for validity based on it's block confirmed & payout amounts. Payout transactions should be around 775 coins (including the normal 25 coin mining reward), but will be slightly less due to the floor function that we're applying.

xmadisco commented 8 years ago

Cool, I realized how we generate them but wanted to get them here for documentation too. I've started adding a method similar to IsCoinbase to the transaction and make a requirement called in CheckBlock. We'll definitely have to reset testnet after this and the last PR #9

joeyfrich commented 8 years ago

A block which should include a voting payout but does not should also be rejected. http://212.71.249.117/explorer/rounds/14

xmadisco commented 8 years ago

Those are votes, not payouts.

joeyfrich commented 8 years ago

Block 140 should include a payout transaction but doesn't.

xmadisco commented 8 years ago

The state is gone, so you're going to have to reproduce this. That was definitely from my old testnet, which was being built as I was developing. I'll add some debugging where it could have happened, and keep an eye out, but not sure how to make it happen (or if it can again).

xmadisco commented 8 years ago

Actually, I think I can reproduce this -- will dig into.

xmadisco commented 8 years ago

It seems to be some kind of timing issue. Not sure. I can reproduce sometimes if I kill the client just after the payout round ends. I have not (yet) been able to reproduce if I leave the client up until I receive the payout.

xmadisco commented 8 years ago

Actually, I can't seem to get a log of it happening. Closing for now, but we need more testing. Have debugging added, but the only rounds I'm seeing are ones where are no winners due to the voting rules.