OSDN Git Service

fix the tx size bug (#563)
authorPaladz <yzhu101@uottawa.ca>
Tue, 10 Apr 2018 02:48:36 +0000 (10:48 +0800)
committerGitHub <noreply@github.com>
Tue, 10 Apr 2018 02:48:36 +0000 (10:48 +0800)
* fix the tx size bug

* fix small garmmar

blockchain/txbuilder/finalize.go

index 3928fe0..65b01c2 100644 (file)
@@ -27,18 +27,16 @@ func FinalizeTx(ctx context.Context, c *protocol.Chain, tx *types.Tx) error {
                return err
        }
 
-       // This paret is use for prevent tx size  is 0
-       if tx.SerializedSize == 0 {
-               data, err := tx.TxData.MarshalText()
-               if err != nil {
-                       return err
-               }
-               if err := tx.UnmarshalText(data); err != nil {
-                       return err
-               }
+       // This part is use for prevent tx size  is 0
+       data, err := tx.TxData.MarshalText()
+       if err != nil {
+               return err
+       }
+       if err := tx.UnmarshalText(data); err != nil {
+               return err
        }
 
-       _, err := c.ValidateTx(tx)
+       _, err = c.ValidateTx(tx)
        if errors.Root(err) == protocol.ErrBadTx {
                return errors.Sub(ErrRejected, err)
        }