From: oysheng Date: Wed, 23 May 2018 11:49:16 +0000 (+0800) Subject: optmise X-Git-Tag: v1.0.5~11^2~21^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7e83abff9933b4393cd83c10223aace4b0c1b4a9;p=bytom%2Fbytom.git optmise --- diff --git a/api/block_retrieve.go b/api/block_retrieve.go index 192e5794..e9daea1d 100644 --- a/api/block_retrieve.go +++ b/api/block_retrieve.go @@ -31,7 +31,7 @@ type BlockTx struct { Inputs []*query.AnnotatedInput `json:"inputs"` Outputs []*query.AnnotatedOutput `json:"outputs"` StatusFail bool `json:"status_fail"` - SourceID bc.Hash `json:"source_id"` + MuxID bc.Hash `json:"mux_id"` } // BlockReq is used to handle getBlock req @@ -108,13 +108,13 @@ func (a *API) getBlock(ins BlockReq) Response { NewSuccessResponse(resp) } - for id, e := range orig.Entries { - switch e.(type) { - case *bc.Mux: - tx.SourceID = id - default: - continue - } + resOutID := orig.ResultIds[0] + resOut, ok := orig.Entries[*resOutID].(*bc.Output) + if ok { + tx.MuxID = *resOut.Source.Ref + } else { + resRetire, _ := orig.Entries[*resOutID].(*bc.Retirement) + tx.MuxID = *resRetire.Source.Ref } for i := range orig.Inputs {