From bfe4e517a5bdf8a08ec5e81f938c8b067df079ef Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 19 Jul 2017 07:36:31 -0400 Subject: [PATCH] Reverse endianness of asset field in gettxout to match everywhere else --- qa/rpc-tests/confidential_transactions.py | 12 +++++++++++- src/rpc/blockchain.cpp | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/qa/rpc-tests/confidential_transactions.py b/qa/rpc-tests/confidential_transactions.py index fbfed65f76..4ae928c8f2 100755 --- a/qa/rpc-tests/confidential_transactions.py +++ b/qa/rpc-tests/confidential_transactions.py @@ -161,12 +161,22 @@ class CTTest (BitcoinTestFramework): {unconfidential_address: value4, change_address: unspent[0]["amount"] - value4 - fee, "fee":fee}); tx = self.nodes[0].blindrawtransaction(tx) - tx_signed = self.nodes[0].signrawtransaction(tx) txid = self.nodes[0].sendrawtransaction(tx_signed['hex']) + decodedtx = self.nodes[0].decoderawtransaction(tx_signed["hex"]) self.nodes[0].generate(101) self.sync_all() + txout0 = self.nodes[0].gettxout(txid, 0) + txout1 = self.nodes[0].gettxout(txid, 1) + + if "asset" in txout0: + assert_equal(txout0["asset"], decodedtx["vout"][0]["asset"]) + elif "asset" in txout1: + assert_equal(txout1["asset"], decodedtx["vout"][1]["asset"]) + else: + raise Exception("No unconfidential output detected when one should exist") + node0 -= value4 node2 += value4 assert_equal(self.nodes[0].getbalance()["bitcoin"], node0) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 9427f68a3b..7951c058f5 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -965,7 +965,7 @@ UniValue gettxout(const JSONRPCRequest& request) ret.push_back(Pair("amountcommitment", HexStr(coins.vout[n].nValue.vchCommitment))); } if (coins.vout[n].nAsset.IsExplicit()) { - ret.push_back(Pair("asset", HexStr(coins.vout[n].nAsset.vchCommitment))); + ret.push_back(Pair("asset", coins.vout[n].nAsset.GetAsset().GetHex())); } else { ret.push_back(Pair("assetcommitment", HexStr(coins.vout[n].nAsset.vchCommitment))); }