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)
self.generate_and_sync(height+3)
# adjust previous result because now there is one more confirmation
r[0]['confirmations'] += 1
# adjust blockindex as now there are 2 transactions confirmed in the block
# adjust confirmations
r[0]['confirmations'] = 1
# adjust blockindex
r[0]['blockindex'] = 1
# adjust height as we generated blocks
# adjust height
r[0]['blockheight'] = height + 3
# 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;
}
struct trxblock
struct txblock
{
int blockheight = 0;
int blockindex = -1;
int64_t blocktime = 0;
int height = 0;
int index = -1;
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];
if(!wtx.hashBlock.IsNull())
blockheight = mapBlockIndex[wtx.hashBlock]->nHeight;
blockindex = wtx.nIndex;
blocktime = wtx.GetTxTime();
if (!wtx.hashBlock.IsNull())
height = mapBlockIndex[wtx.hashBlock]->nHeight;
index = wtx.nIndex;
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("confirmations", entry.confirmations));
trxblock additional(entry.jsop.hash);
obj.push_back(Pair("blockheight", additional.blockheight));
obj.push_back(Pair("blockindex", additional.blockindex));
obj.push_back(Pair("blocktime", additional.blocktime));
txblock BlockData(entry.jsop.hash);
obj.push_back(Pair("blockheight", BlockData.height));
obj.push_back(Pair("blockindex", BlockData.index));
obj.push_back(Pair("blocktime", BlockData.time));
if (hasSpendingKey) {
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("confirmations", entry.confirmations));
trxblock additional(entry.op.hash);
obj.push_back(Pair("blockheight", additional.blockheight));
obj.push_back(Pair("blockindex", additional.blockindex));
obj.push_back(Pair("blocktime", additional.blocktime));
txblock BlockData(entry.op.hash);
obj.push_back(Pair("blockheight", BlockData.height));
obj.push_back(Pair("blockindex", BlockData.index));
obj.push_back(Pair("blocktime", BlockData.time));
if (hasSpendingKey) {
obj.push_back(Pair("change", pwalletMain->IsNoteSaplingChange(nullifierSet, entry.address, entry.op)));