OSDN Git Service

edit types (#1961)
[bytom/bytom.git] / protocol / bc / types / txinput.go
index bdebc1f..446d418 100644 (file)
@@ -51,15 +51,13 @@ type (
        TypedInput interface {
                InputType() uint8
                AssetID() bc.AssetID
-               readCommitment(*blockchain.Reader) (bc.AssetID, error)
-               readWitness(*blockchain.Reader, bc.AssetID) error
+               readCommitment(*blockchain.Reader) error
+               readWitness(*blockchain.Reader) error
                writeCommitment(io.Writer, uint64) error
                writeWitness(w io.Writer) error
        }
 )
 
-var errBadAssetID = errors.New("asset ID does not match other issuance parameters")
-
 // Amount return the asset amount of the txinput
 func (t *TxInput) Amount() uint64 {
        switch inp := t.TypedInput.(type) {
@@ -127,7 +125,6 @@ func (t *TxInput) readFrom(r *blockchain.Reader) (err error) {
                return err
        }
 
-       var assetID bc.AssetID
        t.CommitmentSuffix, err = blockchain.ReadExtensibleString(r, func(r *blockchain.Reader) error {
                if t.AssetVersion != 1 {
                        return nil
@@ -137,8 +134,7 @@ func (t *TxInput) readFrom(r *blockchain.Reader) (err error) {
                        return err
                }
 
-               assetID, err = t.readCommitment(r)
-               return err
+               return t.readCommitment(r)
        })
        if err != nil {
                return err
@@ -146,7 +142,7 @@ func (t *TxInput) readFrom(r *blockchain.Reader) (err error) {
 
        t.WitnessSuffix, err = blockchain.ReadExtensibleString(r, func(r *blockchain.Reader) error {
                if t.AssetVersion == 1 {
-                       return t.readWitness(r, assetID)
+                       return t.readWitness(r)
                }
 
                return nil