OSDN Git Service

fix get-unconfirmed-transaction mux_id 0 bug (#1358)
authorPaladz <yzhu101@uottawa.ca>
Sat, 29 Sep 2018 01:53:57 +0000 (09:53 +0800)
committerGitHub <noreply@github.com>
Sat, 29 Sep 2018 01:53:57 +0000 (09:53 +0800)
api/query.go

index 96a708b..721ebfb 100644 (file)
@@ -167,7 +167,16 @@ func (a *API) getUnconfirmedTx(ctx context.Context, filter struct {
                TimeRange:  txDesc.Tx.TimeRange,
                Inputs:     []*query.AnnotatedInput{},
                Outputs:    []*query.AnnotatedOutput{},
-               StatusFail: false,
+               StatusFail: txDesc.StatusFail,
+       }
+
+       resOutID := txDesc.Tx.ResultIds[0]
+       resOut := txDesc.Tx.Entries[*resOutID]
+       switch out := resOut.(type) {
+       case *bc.Output:
+               tx.MuxID = *out.Source.Ref
+       case *bc.Retirement:
+               tx.MuxID = *out.Source.Ref
        }
 
        for i := range txDesc.Tx.Inputs {