Skip to content

Commit

Permalink
rpcserver: Remove version from gettxout result.
Browse files Browse the repository at this point in the history
This removes version from the gettxout result, since upcoming changes
will be modifying utxo entries to no longer store the tx version.
  • Loading branch information
rstaudt2 authored and davecgh committed Dec 24, 2020
1 parent e9a431c commit d05271c
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 10 deletions.
3 changes: 1 addition & 2 deletions docs/json_rpc_api.mediawiki
Expand Up @@ -2078,11 +2078,10 @@ of the best block.
: <code>confirmations</code>: <code>(numeric)</code> The number of confirmations.
: <code>value</code>: <code>(numeric)</code> The transaction amount in DCR.
: <code>scriptpubkey</code>: <code>(json object)</code> The public key script used to pay coins as a JSON object.
: <code>version</code>: <code>(numeric)</code> The transaction version.
: <code>coinbase</code>: <code>(numeric)</code> Whether or not the transaction is a coinbase.
|-
!Example Return
|<code>{"bestblock": "00000000000000001914563fe4f93addae64cd2808a81835ae03b0947034843b","confirmations": 19,"value": 4.63835862,"scriptPubKey": {"asm": "OP_DUP OP_HASH160 f127302adf84741d28fa705a995dc827030077e5 OP_EQUALVERIFY OP_CHECKSIG","hex": "76a914f127302adf84741d28fa705a995dc827030077e588ac","reqSigs": 1,"type": "pubkeyhash","addresses": ["Dsnx1HW62otMif9zFyLzDnQdKuaV9cRNoyr"]},"version": 1,"coinbase": false}</code>
|<code>{"bestblock": "00000000000000001914563fe4f93addae64cd2808a81835ae03b0947034843b","confirmations": 19,"value": 4.63835862,"scriptPubKey": {"asm": "OP_DUP OP_HASH160 f127302adf84741d28fa705a995dc827030077e5 OP_EQUALVERIFY OP_CHECKSIG","hex": "76a914f127302adf84741d28fa705a995dc827030077e588ac","reqSigs": 1,"type": "pubkeyhash","addresses": ["Dsnx1HW62otMif9zFyLzDnQdKuaV9cRNoyr"]},"coinbase": false}</code>
|}

----
Expand Down
8 changes: 2 additions & 6 deletions internal/rpcserver/rpcserver.go
Expand Up @@ -56,8 +56,8 @@ import (

// API version constants
const (
jsonrpcSemverMajor = 6
jsonrpcSemverMinor = 2
jsonrpcSemverMajor = 7
jsonrpcSemverMinor = 0
jsonrpcSemverPatch = 0
)

Expand Down Expand Up @@ -3520,7 +3520,6 @@ func handleGetTxOut(_ context.Context, s *Server, cmd interface{}) (interface{},
// from there, otherwise attempt to fetch from the block database.
var bestBlockHash string
var confirmations int64
var txVersion uint16
var value int64
var scriptVersion uint16
var pkScript []byte
Expand Down Expand Up @@ -3561,7 +3560,6 @@ func handleGetTxOut(_ context.Context, s *Server, cmd interface{}) (interface{},

bestBlockHash = best.Hash.String()
confirmations = 0
txVersion = mtx.Version
value = txOut.Value
scriptVersion = txOut.Version
pkScript = txOut.PkScript
Expand Down Expand Up @@ -3598,7 +3596,6 @@ func handleGetTxOut(_ context.Context, s *Server, cmd interface{}) (interface{},

bestBlockHash = best.Hash.String()
confirmations = 1 + best.Height - entry.BlockHeight()
txVersion = entry.TxVersion()
value = entry.AmountByIndex(c.Vout)
scriptVersion = entry.ScriptVersionByIndex(c.Vout)
pkScript = entry.PkScriptByIndex(c.Vout)
Expand All @@ -3625,7 +3622,6 @@ func handleGetTxOut(_ context.Context, s *Server, cmd interface{}) (interface{},
BestBlock: bestBlockHash,
Confirmations: confirmations,
Value: dcrutil.Amount(value).ToUnit(dcrutil.AmountCoin),
Version: int32(txVersion),
ScriptPubKey: types.ScriptPubKeyResult{
Asm: disbuf,
Hex: hex.EncodeToString(pkScript),
Expand Down
1 change: 0 additions & 1 deletion internal/rpcserver/rpcserverhandlers_test.go
Expand Up @@ -4951,7 +4951,6 @@ func TestHandleGetTxOut(t *testing.T) {
Type: scriptClass.String(),
Addresses: addresses,
},
Version: int32(msgTx.Version),
Coinbase: false,
}
txOutResultChain := txOutResultMempool
Expand Down
1 change: 0 additions & 1 deletion rpc/jsonrpc/types/chainsvrresults.go
Expand Up @@ -374,7 +374,6 @@ type GetTxOutResult struct {
Confirmations int64 `json:"confirmations"`
Value float64 `json:"value"`
ScriptPubKey ScriptPubKeyResult `json:"scriptPubKey"`
Version int32 `json:"version"`
Coinbase bool `json:"coinbase"`
}

Expand Down

0 comments on commit d05271c

Please sign in to comment.