minor cleanup style, var names

This commit is contained in:
Alfredo Garcia 2020-03-11 13:43:47 -03:00
parent 0ee0588025
commit b7c8ee64d7
2 changed files with 22 additions and 24 deletions

View File

@ -56,13 +56,11 @@ class ListReceivedTest (BitcoinTestFramework):
# Confirm transaction (1 ZEC from taddr to zaddr1) # Confirm transaction (1 ZEC from taddr to zaddr1)
self.generate_and_sync(height+3) self.generate_and_sync(height+3)
# adjust previous result because now there is one more confirmation # adjust confirmations
r[0]['confirmations'] += 1 r[0]['confirmations'] = 1
# adjust blockindex
# adjust blockindex as now there are 2 transactions confirmed in the block
r[0]['blockindex'] = 1 r[0]['blockindex'] = 1
# adjust height
# adjust height as we generated blocks
r[0]['blockheight'] = height + 3 r[0]['blockheight'] = height + 3
# Require one confirmation, note should be present # Require one confirmation, note should be present

View File

@ -3303,20 +3303,20 @@ CAmount getBalanceZaddr(std::string address, int minDepth = 1, bool ignoreUnspen
return balance; return balance;
} }
struct trxblock struct txblock
{ {
int blockheight = 0; int height = 0;
int blockindex = -1; int index = -1;
int64_t blocktime = 0; int64_t time = 0;
trxblock(uint256 hash) txblock(uint256 hash)
{ {
if (pwalletMain->mapWallet.count(hash)) { if (pwalletMain->mapWallet.count(hash)) {
const CWalletTx& wtx = pwalletMain->mapWallet[hash]; const CWalletTx& wtx = pwalletMain->mapWallet[hash];
if (!wtx.hashBlock.IsNull()) if (!wtx.hashBlock.IsNull())
blockheight = mapBlockIndex[wtx.hashBlock]->nHeight; height = mapBlockIndex[wtx.hashBlock]->nHeight;
blockindex = wtx.nIndex; index = wtx.nIndex;
blocktime = wtx.GetTxTime(); time = wtx.GetTxTime();
} }
} }
}; };
@ -3397,10 +3397,10 @@ UniValue z_listreceivedbyaddress(const UniValue& params, bool fHelp)
obj.push_back(Pair("jsoutindex", entry.jsop.n)); obj.push_back(Pair("jsoutindex", entry.jsop.n));
obj.push_back(Pair("confirmations", entry.confirmations)); obj.push_back(Pair("confirmations", entry.confirmations));
trxblock additional(entry.jsop.hash); txblock BlockData(entry.jsop.hash);
obj.push_back(Pair("blockheight", additional.blockheight)); obj.push_back(Pair("blockheight", BlockData.height));
obj.push_back(Pair("blockindex", additional.blockindex)); obj.push_back(Pair("blockindex", BlockData.index));
obj.push_back(Pair("blocktime", additional.blocktime)); obj.push_back(Pair("blocktime", BlockData.time));
if (hasSpendingKey) { if (hasSpendingKey) {
obj.push_back(Pair("change", pwalletMain->IsNoteSproutChange(nullifierSet, entry.address, entry.jsop))); obj.push_back(Pair("change", pwalletMain->IsNoteSproutChange(nullifierSet, entry.address, entry.jsop)));
@ -3416,10 +3416,10 @@ UniValue z_listreceivedbyaddress(const UniValue& params, bool fHelp)
obj.push_back(Pair("outindex", (int)entry.op.n)); obj.push_back(Pair("outindex", (int)entry.op.n));
obj.push_back(Pair("confirmations", entry.confirmations)); obj.push_back(Pair("confirmations", entry.confirmations));
trxblock additional(entry.op.hash); txblock BlockData(entry.op.hash);
obj.push_back(Pair("blockheight", additional.blockheight)); obj.push_back(Pair("blockheight", BlockData.height));
obj.push_back(Pair("blockindex", additional.blockindex)); obj.push_back(Pair("blockindex", BlockData.index));
obj.push_back(Pair("blocktime", additional.blocktime)); obj.push_back(Pair("blocktime", BlockData.time));
if (hasSpendingKey) { if (hasSpendingKey) {
obj.push_back(Pair("change", pwalletMain->IsNoteSaplingChange(nullifierSet, entry.address, entry.op))); obj.push_back(Pair("change", pwalletMain->IsNoteSaplingChange(nullifierSet, entry.address, entry.op)));