Add dpowconfs to z_listreceivedbyaddress
This commit is contained in:
@@ -3796,13 +3796,30 @@ UniValue z_listreceivedbyaddress(const UniValue& params, bool fHelp)
|
|||||||
if (boost::get<libzcash::SproutPaymentAddress>(&zaddr) != nullptr) {
|
if (boost::get<libzcash::SproutPaymentAddress>(&zaddr) != nullptr) {
|
||||||
for (CSproutNotePlaintextEntry & entry : sproutEntries) {
|
for (CSproutNotePlaintextEntry & entry : sproutEntries) {
|
||||||
UniValue obj(UniValue::VOBJ);
|
UniValue obj(UniValue::VOBJ);
|
||||||
|
int nHeight = 0;
|
||||||
|
CTransaction tx;
|
||||||
|
uint256 hashBlock;
|
||||||
|
|
||||||
|
if (GetTransaction(entry.jsop.hash, tx, hashBlock, true)) {
|
||||||
|
BlockMap::const_iterator it = mapBlockIndex.find(hashBlock);
|
||||||
|
if (it != mapBlockIndex.end()) {
|
||||||
|
nHeight = it->second->GetHeight();
|
||||||
|
fprintf(stderr,"blockHash %s height %d\n",hashBlock.ToString().c_str(), nHeight);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr,"block hash %s does not exist!\n", hashBlock.ToString().c_str() );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fprintf(stderr,"tx hash %s does not exist!\n", entry.jsop.hash.ToString().c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
obj.push_back(Pair("txid", entry.jsop.hash.ToString()));
|
obj.push_back(Pair("txid", entry.jsop.hash.ToString()));
|
||||||
obj.push_back(Pair("amount", ValueFromAmount(CAmount(entry.plaintext.value()))));
|
obj.push_back(Pair("amount", ValueFromAmount(CAmount(entry.plaintext.value()))));
|
||||||
std::string data(entry.plaintext.memo().begin(), entry.plaintext.memo().end());
|
std::string data(entry.plaintext.memo().begin(), entry.plaintext.memo().end());
|
||||||
obj.push_back(Pair("memo", HexStr(data)));
|
obj.push_back(Pair("memo", HexStr(data)));
|
||||||
obj.push_back(Pair("jsindex", entry.jsop.js));
|
obj.push_back(Pair("jsindex", entry.jsop.js));
|
||||||
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("rawconfirmations", entry.confirmations));
|
||||||
|
obj.push_back(Pair("confirmations", komodo_dpowconfs(nHeight, entry.confirmations)));
|
||||||
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)));
|
||||||
}
|
}
|
||||||
@@ -3811,11 +3828,27 @@ UniValue z_listreceivedbyaddress(const UniValue& params, bool fHelp)
|
|||||||
} else if (boost::get<libzcash::SaplingPaymentAddress>(&zaddr) != nullptr) {
|
} else if (boost::get<libzcash::SaplingPaymentAddress>(&zaddr) != nullptr) {
|
||||||
for (SaplingNoteEntry & entry : saplingEntries) {
|
for (SaplingNoteEntry & entry : saplingEntries) {
|
||||||
UniValue obj(UniValue::VOBJ);
|
UniValue obj(UniValue::VOBJ);
|
||||||
|
int nHeight = 0;
|
||||||
|
CTransaction tx;
|
||||||
|
uint256 hashBlock;
|
||||||
|
|
||||||
|
if (GetTransaction(entry.op.hash, tx, hashBlock, true)) {
|
||||||
|
BlockMap::const_iterator it = mapBlockIndex.find(hashBlock);
|
||||||
|
if (it != mapBlockIndex.end()) {
|
||||||
|
nHeight = it->second->GetHeight();
|
||||||
|
fprintf(stderr,"blockHash %s height %d\n",hashBlock.ToString().c_str(), nHeight);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr,"block hash %s does not exist!\n", hashBlock.ToString().c_str() );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fprintf(stderr,"tx hash %s does not exist!\n", entry.op.hash.ToString().c_str() );
|
||||||
|
}
|
||||||
obj.push_back(Pair("txid", entry.op.hash.ToString()));
|
obj.push_back(Pair("txid", entry.op.hash.ToString()));
|
||||||
obj.push_back(Pair("amount", ValueFromAmount(CAmount(entry.note.value()))));
|
obj.push_back(Pair("amount", ValueFromAmount(CAmount(entry.note.value()))));
|
||||||
obj.push_back(Pair("memo", HexStr(entry.memo)));
|
obj.push_back(Pair("memo", HexStr(entry.memo)));
|
||||||
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("rawconfirmations", entry.confirmations));
|
||||||
|
obj.push_back(Pair("confirmations", komodo_dpowconfs(nHeight, entry.confirmations)));
|
||||||
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)));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user