scala-network / scala-v7

A cryptocurrency aiming to use blockchain technologies to globally distribute wealth.
Other
83 stars 27 forks source link

daemon refuses to accept block sometimes #5

Closed sebseb7 closed 6 years ago

sebseb7 commented 6 years ago

pool log:

2018-02-27 20:13:38 (Thread 3) Error submitting block at height 53856 from Se2..................................a@::ffff:70.xx.xx.xx, share type: "valid" - {"code":-7,"message":"Block not accepted"}

this is deamon log at the same time:

2018-02-27 19:13:38.461 [RPC1]  INFO    global  src/cryptonote_core/blockchain.cpp:1427 .[1;34m----- BLOCK ADDED AS ALTERNATIVE ON HEIGHT 53856
id:     <e630822f0ff0ada2e06d79ad86cfb5c1be2d4225eb2956c4c5478660a9df8aab>
PoW:    <7c41d4fc26ec6aa4d78fcdce2df15d5425e9da82e0787897b064cf5808000000>
difficulty:     337541675.[0m

sometimes quite often:

2018-02-26 15:20:02.890 [RPC0]  INFO    global  src/cryptonote_core/blockchain.cpp:1427 ----- BLOCK ADDED AS ALTERNATIVE ON HEIGHT 52408
2018-02-26 15:21:08.205 [RPC1]  INFO    global  src/cryptonote_core/blockchain.cpp:1427 ----- BLOCK ADDED AS ALTERNATIVE ON HEIGHT 52406
2018-02-26 15:22:09.181 [RPC0]  INFO    global  src/cryptonote_core/blockchain.cpp:1427 ----- BLOCK ADDED AS ALTERNATIVE ON HEIGHT 52417
2018-02-26 15:22:24.165 [RPC0]  INFO    global  src/cryptonote_core/blockchain.cpp:1427 ----- BLOCK ADDED AS ALTERNATIVE ON HEIGHT 52419
2018-02-26 15:26:43.746 [RPC0]  INFO    global  src/cryptonote_core/blockchain.cpp:1427 ----- BLOCK ADDED AS ALTERNATIVE ON HEIGHT 52435
2018-02-27 01:59:23.120 [RPC1]  INFO    global  src/cryptonote_core/blockchain.cpp:1427 ----- BLOCK ADDED AS ALTERNATIVE ON HEIGHT 52722
2018-02-27 10:18:54.598 [RPC0]  INFO    global  src/cryptonote_core/blockchain.cpp:1427 ----- BLOCK ADDED AS ALTERNATIVE ON HEIGHT 53291
2018-02-27 18:19:29.944 [RPC1]  INFO    global  src/cryptonote_core/blockchain.cpp:1427 ----- BLOCK ADDED AS ALTERNATIVE ON HEIGHT 53752
2018-02-27 18:23:08.460 [RPC1]  INFO    global  src/cryptonote_core/blockchain.cpp:1427 ----- BLOCK ADDED AS ALTERNATIVE ON HEIGHT 53766
2018-02-27 19:13:38.461 [RPC1]  INFO    global  src/cryptonote_core/blockchain.cpp:1427 ----- BLOCK ADDED AS ALTERNATIVE ON HEIGHT 53856
scala-network commented 6 years ago

It's a block reorganizing issue, here's a great explanation of it by bigreddmachine on r/monero

"Reorgs happen when there is temporarily a disagreement about what the longest chain is. It happens in every Cryptocurrency, and the shorter the block time, the more frequent it happens. Basically, picture a guy in the Philippines and a guy in Spain each mining what they say is block 780000 at almost exactly the same time. Half the network sees the one guys block first and accepts it, while rejecting the other guys block. The other half the network does the opposite. It's actually not that uncommon for this to happen, but usually someone mining on one of those two chains finds another block and adds it on, and then everyone goes "oh look, that chain is longer" and ditches the other one. BUT, sometimes, the near tie in finding blocks can happen two or three or four times in a row. Eventually, one side wins out, and anyone on the wrong chain has to reorganize.

This is why merchants are recommended to wait for a few confirmations before fully crediting a payment for big ticket items. The more confirmations (or the more blocks that get added on top of the one your transaction is in), the harder it is to happen on a reorg.

The whole problem is caused by a slight delay in sending signals to all corners of the earth that a miner found a block. The total lag is pretty much ~15 seconds or so. The shorter the block time, the larger an effect that lag has. i.e. for a 1 minute block, that lag is 1/4th the block time, but for a 2 minute block, it is 1/8th the block time. In bitcoin's case, it is 1/40th the block time. The smaller that fraction gets, the less likely a reorg is to occur."

sebseb7 commented 6 years ago

but why it sais "error submitting" ?

if there is a new block already known to the daemon, why getblocktemplate isn't telling?

scala-network commented 6 years ago

I believe the reorganized block is 53856 and the pool submitted block is also 53856, so it causes the error because it already is present beforehand, so it is the verification that fails, after a slight delay once the chain is reorganized it sends out new block template