OSDN Git Service

update master (#487)
[bytom/bytom.git] / blockchain / txbuilder / signature_witness.go
index 0f28216..e0a3fa6 100755 (executable)
@@ -4,6 +4,8 @@ import (
        "context"
        "encoding/json"
 
+       log "github.com/sirupsen/logrus"
+
        "github.com/bytom/crypto/ed25519/chainkd"
        "github.com/bytom/crypto/sha3pool"
        chainjson "github.com/bytom/encoding/json"
@@ -12,6 +14,7 @@ import (
 )
 
 type (
+       // SignatureWitness is a sign struct
        SignatureWitness struct {
                // Quorum is the number of signatures required.
                Quorum int `json:"quorum"`
@@ -35,6 +38,7 @@ type (
        }
 )
 
+// ErrEmptyProgram is a type of error
 var ErrEmptyProgram = errors.New("empty signature program")
 
 // Sign populates sw.Sigs with as many signatures of the predicate in
@@ -93,7 +97,8 @@ func (sw *SignatureWitness) sign(ctx context.Context, tpl *Template, index uint3
                }
                sigBytes, err := signFn(ctx, keyID.XPub, path, h, auth)
                if err != nil {
-                       return errors.WithDetailf(err, "computing signature %d", i)
+                       log.WithField("err", err).Warningf("computing signature %d", i)
+                       return nil
                }
                sw.Sigs[i] = sigBytes
        }
@@ -118,6 +123,7 @@ func (sw SignatureWitness) materialize(args *[][]byte) error {
        return nil
 }
 
+// MarshalJSON convert struct to json
 func (sw SignatureWitness) MarshalJSON() ([]byte, error) {
        obj := struct {
                Type   string               `json:"type"`