projectpai / paicoin

Official repo of PAI Coin
https://projectpai.com
MIT License
63 stars 35 forks source link

Issue with low price tickets and getblocktemplate #340

Closed pgerzani closed 3 years ago

pgerzani commented 3 years ago

Currently, when constructing a block template, we are not checking the price of a ticket against the required value for the block. As a result, it is theoretically possible for the chain to get in a loop where all getblocktemplate calls fail as it tries including tickets that fail validation.

Please add logic to the code to construct a new block to filter out tickets where the ticket price is too low. This appears to be a check on the Decred side that we didn't port:

        // Skip if the SStx commit value is below the value required by the
        // stake diff.
        if isSStx && (tx.MsgTx().TxOut[0].Value < best.NextStakeDiff) {
            continue
        }

in mining.go

Please verify there aren't any other checks that may have also been overlooked.

sebastianrusu commented 3 years ago

This is solved in https://github.com/projectpai/paicoin/pull/345. I also reviewed the PAIcoin code for similar validations on processing the blocks and they are in place.