MattF42 / PePe-core

PePe-Core Rebooted in July/August 2023
MIT License
13 stars 9 forks source link

SPORK_8 doesn't do what it should do #17

Open MattF42 opened 1 year ago

MattF42 commented 1 year ago

So prior to 2.3.1.2 we had "SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT": true,

I disabled it in 2.3.1.2 because:

If an incorrect blocks get generated without the masternode payment enforcement in place, the network SHOULD reject these and orphan, them, but it doesn't.

What actually seems to happen is that the voting MNs self partition off with an invalid chain. The correctly reject the block as per https://github.com/MattF42/PePe-core/blob/6decb6e1879ffa939a421ac15e5cc9b3de1f3685/src/masternode-payments.cpp#L202-L205

But then spiral off into a death spiral of InvalidChainFound, Invalid masternode payment detected and fairly quickly stop syncing.

I think this happens because only the voting MNs participate in in the IsTransactionValid() / IsBlockPayeeValid() checks, but honestly I'm rather out of my depth here.....

So, we shouldn't get MNs sulking and stopping getting paid (hurrah) - but we CAN have invalid blocks (with not MN reward) which the network will not correctly reject :(

Can someone please take a look and work out how we can re-enable SPORK8 without causing MN breakage?

Block 483396 was an example of such a block:

~/bin/PEPEPOW-cli getrawtransaction a133ae7f74523db8cd389196f8eb6480990a233eff694b96b44cf7db5fedb6f7 1 { "hex": "02000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1f0344600704b896ff64088100d3b9030304027a657267706f6f6c2e636f6d00000000000100a89c13460200001976a9140ddc16715823d16442abc7bf0538c2cd46ea2c1988ac00000000", "txid": "a133ae7f74523db8cd389196f8eb6480990a233eff694b96b44cf7db5fedb6f7", "size": 116, "version": 2, "locktime": 0, "vin": [ { "coinbase": "0344600704b896ff64088100d3b9030304027a657267706f6f6c2e636f6d00", "sequence": 0 } ], "vout": [ { "value": 25000.00000000, "valueSat": 2500000000000, "n": 0, "scriptPubKey": { "asm": "OP_DUP OP_HASH160 0ddc16715823d16442abc7bf0538c2cd46ea2c19 OP_EQUALVERIFY OP_CHECKSIG", "hex": "76a9140ddc16715823d16442abc7bf0538c2cd46ea2c1988ac", "reqSigs": 1, "type": "pubkeyhash", "addresses": [ "P9rTbRfgkXLmvquRHRKY5Nq7ewA1bFoUZv" ] } } ], "blockhash": "00000000001ccca9511293f1cd73be38089b36b6e6b5a74c9a8709e92d220559", "height": 483396, "confirmations": 36166, "time": 1694471865, "blocktime": 1694471865 }

MattF42 commented 1 year ago

Hopefully this is fixed by c6366d58f60aa0ac4ab9efd8d694079263be4e43 leaving open until confirmed