OSDN Git Service

Optimize log printing (#1590)
[bytom/bytom.git] / blockchain / txbuilder / signature_witness.go
index 2d3de8f..233b772 100644 (file)
@@ -86,10 +86,15 @@ func (sw *SignatureWitness) sign(ctx context.Context, tpl *Template, index uint3
                }
                sigBytes, err := signFn(ctx, keyID.XPub, path, h, auth)
                if err != nil {
-                       log.WithField("err", err).Warningf("computing signature %d", i)
+                       log.WithFields(log.Fields{"module": logModule, "err": err}).Warningf("computing signature %d", i)
                        continue
                }
+
+               // This break is ordered to avoid signing transaction successfully only once for a multiple-sign account
+               // that consist of different keys by the same password. Exit immediately when the signature is success,
+               // it means that only one signature will be successful in the loop for this multiple-sign account.
                sw.Sigs[i] = sigBytes
+               break
        }
        return nil
 }