Skip to content

Commit

Permalink
Remove vjoinsplit from gettransaction
Browse files Browse the repository at this point in the history
This reverts zcash#1493, for two reasons:

- The information is unnecessary for a wallet RPC method, which should be
  showing wallet-contextual information.
- As a side-effect, the information also shows up in e.g. listsinceblock, which
  greatly increases its verbosity for zero benefit.

To obtain the JoinSplit data in this format, users should instead pass the "hex"
field from gettransaction to decoderawtransaction.
  • Loading branch information
str4d committed Feb 16, 2017
1 parent 22facf8 commit e34a33d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 24 deletions.
6 changes: 3 additions & 3 deletions qa/rpc-tests/wallet.py
Expand Up @@ -241,7 +241,7 @@ def run_test (self):
assert_equal(self.nodes[2].z_getbalance(mytaddr), Decimal('10.0'));

mytxdetails = self.nodes[2].gettransaction(mytxid)
myvjoinsplits = mytxdetails["vjoinsplit"]
myvjoinsplits = self.nodes[2].decoderawtransaction(mytxdetails["hex"])["vjoinsplit"]
assert_equal(0, len(myvjoinsplits))

# z_sendmany is expected to fail if tx size breaks limit
Expand Down Expand Up @@ -335,12 +335,12 @@ def run_test (self):
assert_equal(Decimal(resp["total"]), node2utxobalance + zsendmanynotevalue)

# there should be at least one joinsplit
mytxdetails = self.nodes[2].gettransaction(mytxid)
mytxdetails = self.nodes[2].getrawtransaction(mytxid, 1)
myvjoinsplits = mytxdetails["vjoinsplit"]
assert_greater_than(len(myvjoinsplits), 0)

# the first (probably only) joinsplit should take in all the public value
myjoinsplit = self.nodes[2].getrawtransaction(mytxid, 1)["vjoinsplit"][0]
myjoinsplit = myvjoinsplits[0]
assert_equal(myjoinsplit["vpub_old"], zsendmanynotevalue)
assert_equal(myjoinsplit["vpub_new"], 0)
assert("onetimePubKey" in myjoinsplit.keys())
Expand Down
12 changes: 6 additions & 6 deletions src/rpcrawtransaction.cpp
Expand Up @@ -220,9 +220,9 @@ UniValue getrawtransaction(const UniValue& params, bool fHelp)
" ],\n"
" \"vjoinsplit\" : [ (array of json objects, only for version >= 2)\n"
" {\n"
" \"vpub_old\" : x.xxx, (numeric) public input value in ZEC\n"
" \"vpub_new\" : x.xxx, (numeric) public output value in ZEC\n"
" \"anchor\" : \"hex\", (string) the anchor\n"
" \"vpub_old\" : x.xxx (numeric) The amount removed from the transparent value pool\n"
" \"vpub_new\" : x.xxx, (numeric) The amount added to the transparent value pool\n"
" \"anchor\" : \"treestateref\", (string) Merkle root of note commitment tree\n"
" \"nullifiers\" : [ (json array of string)\n"
" \"hex\" (string) input note nullifier\n"
" ,...\n"
Expand Down Expand Up @@ -520,9 +520,9 @@ UniValue decoderawtransaction(const UniValue& params, bool fHelp)
" ],\n"
" \"vjoinsplit\" : [ (array of json objects, only for version >= 2)\n"
" {\n"
" \"vpub_old\" : x.xxx, (numeric) public input value in ZEC\n"
" \"vpub_new\" : x.xxx, (numeric) public output value in ZEC\n"
" \"anchor\" : \"hex\", (string) the anchor\n"
" \"vpub_old\" : x.xxx (numeric) The amount removed from the transparent value pool\n"
" \"vpub_new\" : x.xxx, (numeric) The amount added to the transparent value pool\n"
" \"anchor\" : \"treestateref\", (string) Merkle root of note commitment tree\n"
" \"nullifiers\" : [ (json array of string)\n"
" \"hex\" (string) input note nullifier\n"
" ,...\n"
Expand Down
15 changes: 0 additions & 15 deletions src/wallet/rpcwallet.cpp
Expand Up @@ -39,8 +39,6 @@ using namespace std;

using namespace libzcash;

extern UniValue TxJoinSplitToJSON(const CTransaction& tx);

int64_t nWalletUnlockTime;
static CCriticalSection cs_nWalletUnlockTime;

Expand Down Expand Up @@ -94,8 +92,6 @@ void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry)
entry.push_back(Pair("timereceived", (int64_t)wtx.nTimeReceived));
BOOST_FOREACH(const PAIRTYPE(string,string)& item, wtx.mapValue)
entry.push_back(Pair(item.first, item.second));

entry.push_back(Pair("vjoinsplit", TxJoinSplitToJSON(wtx)));
}

string AccountFromValue(const UniValue& value)
Expand Down Expand Up @@ -1757,17 +1753,6 @@ UniValue gettransaction(const UniValue& params, bool fHelp)
" }\n"
" ,...\n"
" ],\n"
" \"vjoinsplit\" : [\n"
" {\n"
" \"anchor\" : \"treestateref\", (string) Merkle root of note commitment tree\n"
" \"nullifiers\" : [ string, ... ] (string) Nullifiers of input notes\n"
" \"commitments\" : [ string, ... ] (string) Note commitments for note outputs\n"
" \"macs\" : [ string, ... ] (string) Message authentication tags\n"
" \"vpub_old\" : x.xxx (numeric) The amount removed from the transparent value pool\n"
" \"vpub_new\" : x.xxx, (numeric) The amount added to the transparent value pool\n"
" }\n"
" ,...\n"
" ],\n"
" \"hex\" : \"data\" (string) Raw data for transaction\n"
"}\n"

Expand Down

0 comments on commit e34a33d

Please sign in to comment.