VeriBlock / vbk-ri-btc

Bitcoin Core integration/staging tree
https://bitcoincore.org/en/download
Other
4 stars 6 forks source link

Mining older blocks causing issues #165

Closed Leonardiae closed 4 years ago

Leonardiae commented 4 years ago

Mining an old block, causes the operation to stay in the SUBMIT_POP_TRANSACTION state

I think because of this: 2020-06-10 10:07:42 pop-tasks- WARN ApmTaskService - Error submitting proof of proof: Failed to perform request to the API: invalid pop tx script (VTB is invalid)

Maybe a check can be added to prevent mining too old blocks.

Warchant commented 4 years ago

On vBTC side there's a check that you can't mine a pop tx which contains endorsement of a block more than 50 blocks behind a block that contains this pop tx.

Leonardiae commented 4 years ago

OK, but on the APM side I think I can start an operation which then tries to submit the PoP but is denied until the threshold is reached and only then is marked as failed.

Maybe vBTC can accept the PoP (but pay no reward) and the APM wont start operations with a block less than x from the tip?

Warchant commented 4 years ago

@Leonardiae it is not as easy as it sounds. Technically, if current tip is 100, and block 50 is endorsed, you're saying that APM should not allow sending such pop tx. But if reorg occurs, and suddently tip becomes 99, this pop tx might be added into blockchain in block 100.

Leonardiae commented 4 years ago

OK, I see your point. And what about accepting the PoP and not pay a reward if it's too old?

BernatCarbo commented 4 years ago

If there is a check that condemns an operation to fail, I think that we should prevent such operations to be started on the apm side, or at least try to reduce the chance to happen

PCasafont commented 4 years ago

https://github.com/VeriBlock/nodecore/commit/c09cd8d74ec86ef4260c0bf98424b3afe5785c3b