From 8b0ebae271c23a6f743dcbc0afac4df9698c047c Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Thu, 8 Nov 2018 10:09:24 -0500 Subject: [PATCH] fix endianness of getrawtransaction issuance entropy, add basic test --- qa/rpc-tests/confidential_transactions.py | 6 ++++++ src/rpc/rawtransaction.cpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/qa/rpc-tests/confidential_transactions.py b/qa/rpc-tests/confidential_transactions.py index 4ee2dd30a3..f45e36d402 100755 --- a/qa/rpc-tests/confidential_transactions.py +++ b/qa/rpc-tests/confidential_transactions.py @@ -222,6 +222,12 @@ def run_test(self): # Quick unblinded reissuance check, making 2*COIN total self.nodes[0].reissueasset(issued["asset"], 1) + # Compare resulting fields with getrawtransaction + raw_details = self.nodes[0].getrawtransaction(issued["txid"], 1) + assert_equal(issued["entropy"], raw_details["vin"][issued["vin"]]["issuance"]["assetEntropy"]) + assert_equal(issued["asset"], raw_details["vin"][issued["vin"]]["issuance"]["asset"]) + assert_equal(issued["token"], raw_details["vin"][issued["vin"]]["issuance"]["token"]) + testAssetHex = issued["asset"] self.nodes[0].generate(1) self.sync_all() diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index b9490377c3..f821938738 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -155,7 +155,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry) uint256 entropy; if (issuance.assetBlindingNonce.IsNull()) { GenerateAssetEntropy(entropy, txin.prevout, issuance.assetEntropy); - issue.push_back(Pair("assetEntropy", HexStr(entropy))); + issue.push_back(Pair("assetEntropy", entropy.GetHex())); CalculateAsset(asset, entropy); CalculateReissuanceToken(token, entropy, issuance.nAmount.IsCommitment()); issue.push_back(Pair("isreissuance", false));