OSDN Git Service

decode-raw-transaction API add tx_id and txinput add input_id (#1130)
authoroysheng <33340252+oysheng@users.noreply.github.com>
Wed, 11 Jul 2018 02:31:37 +0000 (10:31 +0800)
committerPaladz <yzhu101@uottawa.ca>
Wed, 11 Jul 2018 02:31:37 +0000 (10:31 +0800)
api/query.go
blockchain/query/annotated.go
wallet/annotated.go

index 632e83b..1db5929 100644 (file)
@@ -188,6 +188,7 @@ func (a *API) listUnconfirmedTxs(ctx context.Context) Response {
 
 // RawTx is the tx struct for getRawTransaction
 type RawTx struct {
+       ID        bc.Hash                  `json:"tx_id"`
        Version   uint64                   `json:"version"`
        Size      uint64                   `json:"size"`
        TimeRange uint64                   `json:"time_range"`
@@ -201,6 +202,7 @@ func (a *API) decodeRawTransaction(ctx context.Context, ins struct {
        Tx types.Tx `json:"raw_transaction"`
 }) Response {
        tx := &RawTx{
+               ID:        ins.Tx.ID,
                Version:   ins.Tx.Version,
                Size:      ins.Tx.SerializedSize,
                TimeRange: ins.Tx.TimeRange,
index 6e94c21..c4a54ad 100644 (file)
@@ -36,6 +36,7 @@ type AnnotatedInput struct {
        AccountID       string             `json:"account_id,omitempty"`
        AccountAlias    string             `json:"account_alias,omitempty"`
        Arbitrary       chainjson.HexBytes `json:"arbitrary,omitempty"`
+       InputID         bc.Hash            `json:"input_id"`
 }
 
 //AnnotatedOutput means an annotated transaction output.
index 27c3bfe..aca87a1 100644 (file)
@@ -204,6 +204,7 @@ func (w *Wallet) BuildAnnotatedInput(tx *types.Tx, i uint32) *query.AnnotatedInp
        }
 
        id := tx.Tx.InputIDs[i]
+       in.InputID = id
        e := tx.Entries[id]
        switch e := e.(type) {
        case *bc.Spend: