zack-bitcoin / amoveo

A blockchain for trust-free markets in financial derivatives
Other
466 stars 110 forks source link

Out of Sync Light Wallet and Explorer #95

Closed Mandelhoff closed 6 years ago

Mandelhoff commented 6 years ago

The Explorer and Light Wallet seem out of sync. I clicked the "get more headers" several times, but nothing changed.

My personal node also was sitting at block 2712, so your Light Wallet was somehow at 2714. My node's balance of 1.0 also wasn't showing up on the Explorer/Wallet, which is a little odd too. The screenshot shows I did a sync:start(). and got to the block:height(). at 2714.

This screenshot shows using the Explorer and Light Wallet both from 159.89.106.253.

image

zack-bitcoin commented 6 years ago

It looks like someone made a couple invalid blocks, 2713 and 2714. They still have valid headers.

zack-bitcoin commented 6 years ago

api:height(). tells you how many headers. block:height(). tells you how many blocks.

zack-bitcoin commented 6 years ago

There are 10 spend txs sitting in the mempool, each spending 1/10th of a VEO. I wonder if someone uncovered a bug with all these spend txs. Are we frozen at this height?

Mandelhoff commented 6 years ago

Maybe, I tried to submit a block and got a server 500 error. I don't know how the blocks would be invalid, but I might have done that. I was mining slowly ~90kh/s and had at least one block found. The solution submitted should have been valid for the bhash received.

Those 0.1 spends are probably mine. I was testing remote payments and make several.

zack-bitcoin commented 6 years ago

The header contains a root hash of the txs from the block. The header contains the root has of the accounts tree. For a block to be valid, all the txs need to produce the same root hash as the header, and the resultant account tree needs to have the same root hash as the header says it should.

So for example, if I made a block and gave myself a bunch of VEO out of no-where, the header could still look valid, and if you could use the header to make a merkel proof showing that you have billions of VEO.

But, there is no valid block which could produce such a header, because there is no tx type that produces money out of nowhere.

The Amoveo full node will still sync the valid-looking headers, but it will ignore the invalid blocks.

zack-bitcoin commented 6 years ago

Maybe my server got corrupted somehow, and it thinks that the valid block is actually invalid.

zack-bitcoin commented 6 years ago

https://github.com/zack-bitcoin/amoveo/blob/master/apps/ae_core/src/consensus/chain/block.erl#L295

This is the code for checking if a block is valid.

Mandelhoff commented 6 years ago

My miner was interfacing with the pool to get a bhash challenge. If I created the invalid blocks, I didn't do anything special from the pool or miner's perspective. I submitted all solutions through the pool endpoints on port 8085 too.

zack-bitcoin commented 6 years ago

Maybe my server is using old code, and one of my recent updates made a soft fork that activated at this height. I will update the server, and then after maybe it will work.

Mandelhoff commented 6 years ago

I pulled down a new node and pool about 12 hours ago. Let me know if you think I should upgrade or sync or try whatever else.

zack-bitcoin commented 6 years ago

ok, I synced to 2712 with the new code. Feel free to try sharing your new blocks to see if it will work

Mandelhoff commented 6 years ago

I had to reboot to get my pool working. It wouldn't start with that "node not running!" error. Pool starts after a reboot though.

I mined up one block. You can see my node got the block and says "2713", but then lots of errors happen. The pool crashes hard too. I tried to get most of the crash dump from the pool in the screenshots, but it's very long.

image

image

Mandelhoff commented 6 years ago

This is block and api height my node is showing after the above crash too: image

zack-bitcoin commented 6 years ago

Maybe your database of blocks got corrupted somehow, so now when you try to mine new blocks, they look invalid to everyone else. The server also didn't find out about block 2713.

the mining pool errors are just saying it can't contact the amoveo full node.

The full node log makes it look like 2713 absorbed correctly, and then afterwards it is unable to make 2714 for mining upon.

Mandelhoff commented 6 years ago

Should I log a pool bug over on the pool github repository?

I'll give this the "rm -rf" and clone tomorrow sometime to try again.

zack-bitcoin commented 6 years ago

either repository is fine, but this is almost certainly a problem with the amoveo full node and not the mining pool.

Mandelhoff commented 6 years ago

Closing this. I think your fixes today cover the behavior observed in this issue.