rpcserver: Omit empty getrawtransaction->confirmations.

This commit omits the confirmations field from the getrawtransactions
RPC result when it's 0.

Closes #420.
This commit is contained in:
Dave Collins 2015-05-05 19:35:25 -05:00
parent 788c316879
commit a40058cd0e
2 changed files with 2 additions and 2 deletions

View file

@ -318,7 +318,7 @@ type TxRawResult struct {
Vin []Vin `json:"vin"`
Vout []Vout `json:"vout"`
BlockHash string `json:"blockhash,omitempty"`
Confirmations uint64 `json:"confirmations"`
Confirmations uint64 `json:"confirmations,omitempty"`
Time int64 `json:"time,omitempty"`
Blocktime int64 `json:"blocktime,omitempty"`
}

View file

@ -167,7 +167,7 @@ func TestChainSvrWsNtfns(t *testing.T) {
}
return btcjson.NewTxAcceptedVerboseNtfn(txResult)
},
marshalled: `{"jsonrpc":"1.0","method":"txacceptedverbose","params":[{"hex":"001122","txid":"123","version":1,"locktime":4294967295,"vin":null,"vout":null,"confirmations":0}],"id":null}`,
marshalled: `{"jsonrpc":"1.0","method":"txacceptedverbose","params":[{"hex":"001122","txid":"123","version":1,"locktime":4294967295,"vin":null,"vout":null}],"id":null}`,
unmarshalled: &btcjson.TxAcceptedVerboseNtfn{
RawTx: btcjson.TxRawResult{
Hex: "001122",