From e282f43ba31da597b375c3d7d2e61b3f2fbcbd98 Mon Sep 17 00:00:00 2001 From: mars Date: Mon, 3 Jun 2019 15:09:52 +0800 Subject: [PATCH] modify list transaction --- blockchain/query/annotated.go | 1 + wallet/annotated.go | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/blockchain/query/annotated.go b/blockchain/query/annotated.go index 1696b0e9..2b1894a1 100644 --- a/blockchain/query/annotated.go +++ b/blockchain/query/annotated.go @@ -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. diff --git a/wallet/annotated.go b/wallet/annotated.go index 5696e349..e4a49762 100644 --- a/wallet/annotated.go +++ b/wallet/annotated.go @@ -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 } -- 2.11.0