rpcserver: searchrawtx - update coinbase output (#299)

This commit is contained in:
Javed Khan 2016-08-10 22:23:00 +05:30 committed by Alex Yocom-Piatt
parent 5f80cf9279
commit 7401db6098
3 changed files with 12 additions and 8 deletions

View File

@ -342,10 +342,12 @@ func (v *VinPrevOut) IsCoinBase() bool {
func (v *VinPrevOut) MarshalJSON() ([]byte, error) {
if v.IsCoinBase() {
coinbaseStruct := struct {
Coinbase string `json:"coinbase"`
Sequence uint32 `json:"sequence"`
Coinbase string `json:"coinbase"`
AmountIn *float64 `json:"amountin,omitempty"`
Sequence uint32 `json:"sequence"`
}{
Coinbase: v.Coinbase,
AmountIn: v.AmountIn,
Sequence: v.Sequence,
}
return json.Marshal(coinbaseStruct)

View File

@ -1394,10 +1394,12 @@ func createVinListPrevOut(s *rpcServer, mtx *wire.MsgTx, chainParams *chaincfg.P
return vinList
}
var vinEntry dcrjson.VinPrevOut
txIn := mtx.TxIn[0]
vinEntry.Coinbase = hex.EncodeToString(txIn.SignatureScript)
vinEntry.Sequence = txIn.Sequence
vinEntry := dcrjson.VinPrevOut{
Coinbase: hex.EncodeToString(txIn.SignatureScript),
AmountIn: dcrjson.Float64(dcrutil.Amount(txIn.ValueIn).ToCoin()),
Sequence: txIn.Sequence,
}
vinList = append(vinList, vinEntry)
return vinList
}

View File

@ -105,10 +105,10 @@ var helpDescsEnUS = map[string]string{
"vinprevout-coinbase": "The hex-encoded bytes of the signature script (coinbase txns only)",
"vinprevout-txid": "The hash of the origin transaction (non-coinbase txns only)",
"vinprevout-vout": "The index of the output being redeemed from the origin transaction (non-coinbase txns only)",
"vinprevout-tree": "The transaction tree of the origin transaction",
"vinprevout-tree": "The transaction tree of the origin transaction (non-coinbase txns only)",
"vinprevout-amountin": "The amount in for this transaction input, in coins",
"vinprevout-blockheight": "The height of the block that includes the origin transaction",
"vinprevout-blockindex": "The merkle tree index of the origin transaction",
"vinprevout-blockheight": "The height of the block that includes the origin transaction (non-coinbase txns only)",
"vinprevout-blockindex": "The merkle tree index of the origin transaction (non-coinbase txns only)",
"vinprevout-scriptSig": "The signature script used to redeem the origin transaction as a JSON object (non-coinbase txns only)",
"vinprevout-prevOut": "Data from the origin transaction output with index vout.",
"vinprevout-sequence": "The script sequence number",