OSDN Git Service

Merge branch 'dev' into dev-verify
[bytom/bytom.git] / mining / mining.go
index 8d06d3d..e85326e 100644 (file)
@@ -50,6 +50,12 @@ func createCoinbaseTx(accountManager *account.Manager, amount uint64, blockHeigh
                return
        }
 
+       byteData, err := txData.MarshalText()
+       if err != nil {
+               return
+       }
+       txData.SerializedSize = uint64(len(byteData))
+
        tx = &types.Tx{
                TxData: *txData,
                Tx:     types.MapTx(txData),
@@ -102,7 +108,7 @@ func NewBlockTemplate(c *protocol.Chain, txPool *protocol.TxPool, accountManager
 
                gasStatus, err := validation.ValidateTx(tx, bcBlock)
                if err != nil {
-                       if !gasStatus.GasVaild {
+                       if !gasStatus.GasValid {
                                log.WithField("error", err).Error("mining block generate skip tx due to")
                                txPool.RemoveTransaction(&tx.ID)
                                continue