Golang implemented sidechain for Bytom
Revision | e282f43ba31da597b375c3d7d2e61b3f2fbcbd98 (tree) |
---|---|
Time | 2019-06-03 16:09:52 |
Author | mars <mars@byto...> |
Commiter | mars |
modify list transaction
@@ -53,6 +53,7 @@ type AnnotatedOutput struct { | ||
53 | 53 | AccountAlias string `json:"account_alias,omitempty"` |
54 | 54 | ControlProgram chainjson.HexBytes `json:"control_program"` |
55 | 55 | Address string `json:"address,omitempty"` |
56 | + Vote chainjson.HexBytes `json:"vote,omitempty"` | |
56 | 57 | } |
57 | 58 | |
58 | 59 | //AnnotatedAccount means an annotated account. |
@@ -16,7 +16,6 @@ import ( | ||
16 | 16 | dbm "github.com/vapor/database/leveldb" |
17 | 17 | "github.com/vapor/protocol/bc" |
18 | 18 | "github.com/vapor/protocol/bc/types" |
19 | - "github.com/vapor/protocol/vm/vmutil" | |
20 | 19 | ) |
21 | 20 | |
22 | 21 | // annotateTxs adds asset data to transactions |
@@ -248,10 +247,15 @@ func (w *Wallet) BuildAnnotatedOutput(tx *types.Tx, idx int) *query.AnnotatedOut | ||
248 | 247 | Address: w.getAddressFromControlProgram(orig.ControlProgram()), |
249 | 248 | } |
250 | 249 | |
251 | - if vmutil.IsUnspendable(out.ControlProgram) { | |
252 | - out.Type = "retire" | |
253 | - } else { | |
250 | + switch e := tx.Entries[*outid].(type) { | |
251 | + case *bc.IntraChainOutput: | |
254 | 252 | out.Type = "control" |
253 | + case *bc.CrossChainOutput: | |
254 | + out.Type = "cross_Output" | |
255 | + case *bc.VoteOutput: | |
256 | + out.Type = "vote" | |
257 | + out.Vote = e.Vote | |
255 | 258 | } |
259 | + | |
256 | 260 | return out |
257 | 261 | } |