OSDN Git Service

submit tx protocol verify (#447)
authorPaladz <yzhu101@uottawa.ca>
Mon, 25 Nov 2019 03:04:00 +0000 (11:04 +0800)
committerGitHub <noreply@github.com>
Mon, 25 Nov 2019 03:04:00 +0000 (11:04 +0800)
protocol/tx.go

index bdd3516..5c3af6a 100644 (file)
@@ -49,6 +49,14 @@ func (c *Chain) validateTx(tx *types.Tx, bh *types.BlockHeader) (bool, error) {
                return false, err
        }
 
+       txVerifyResult := &bc.TxVerifyResult{StatusFail: err != nil}
+       for _, p := range c.subProtocols {
+               if err := p.ValidateTx(tx, txVerifyResult); err != nil {
+                       c.txPool.AddErrCache(&tx.ID, err)
+                       return false, err
+               }
+       }
+
        if err != nil {
                log.WithFields(log.Fields{"module": logModule, "tx_id": tx.Tx.ID.String(), "error": err}).Info("transaction status fail")
        }