OSDN Git Service

modify list transaction v0.1_vote_list_transaction
authormars <mars@bytom.io>
Mon, 3 Jun 2019 07:09:52 +0000 (15:09 +0800)
committermars <mars@bytom.io>
Mon, 3 Jun 2019 07:09:52 +0000 (15:09 +0800)
blockchain/query/annotated.go
wallet/annotated.go

index 1696b0e..2b1894a 100644 (file)
@@ -53,6 +53,7 @@ type AnnotatedOutput struct {
        AccountAlias    string             `json:"account_alias,omitempty"`
        ControlProgram  chainjson.HexBytes `json:"control_program"`
        Address         string             `json:"address,omitempty"`
+       Vote            chainjson.HexBytes `json:"vote,omitempty"`
 }
 
 //AnnotatedAccount means an annotated account.
index 5696e34..e4a4976 100644 (file)
@@ -16,7 +16,6 @@ import (
        dbm "github.com/vapor/database/leveldb"
        "github.com/vapor/protocol/bc"
        "github.com/vapor/protocol/bc/types"
-       "github.com/vapor/protocol/vm/vmutil"
 )
 
 // annotateTxs adds asset data to transactions
@@ -248,10 +247,15 @@ func (w *Wallet) BuildAnnotatedOutput(tx *types.Tx, idx int) *query.AnnotatedOut
                Address:         w.getAddressFromControlProgram(orig.ControlProgram()),
        }
 
-       if vmutil.IsUnspendable(out.ControlProgram) {
-               out.Type = "retire"
-       } else {
+       switch e := tx.Entries[*outid].(type) {
+       case *bc.IntraChainOutput:
                out.Type = "control"
+       case *bc.CrossChainOutput:
+               out.Type = "cross_Output"
+       case *bc.VoteOutput:
+               out.Type = "vote"
+               out.Vote = e.Vote
        }
+
        return out
 }