mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-14 09:08:11 +00:00
Fixed keva amount in wallet.
This commit is contained in:
parent
af0a8efb0a
commit
7d80f78f4e
@ -1697,6 +1697,8 @@ void ListTransactions(CWallet* const pwallet, const CWalletTx& wtx, const std::s
|
||||
}
|
||||
entry.push_back(Pair("account", strSentAccount));
|
||||
MaybePushAddress(entry, s.destination);
|
||||
if(!s.kevaOp.empty())
|
||||
entry.push_back(Pair("keva", s.kevaOp));
|
||||
entry.push_back(Pair("category", "send"));
|
||||
entry.push_back(Pair("amount", ValueFromAmount(-s.amount)));
|
||||
if (pwallet->mapAddressBook.count(s.destination)) {
|
||||
@ -1728,6 +1730,8 @@ void ListTransactions(CWallet* const pwallet, const CWalletTx& wtx, const std::s
|
||||
}
|
||||
entry.push_back(Pair("account", account));
|
||||
MaybePushAddress(entry, r.destination);
|
||||
if(!r.kevaOp.empty())
|
||||
entry.push_back(Pair("keva", r.kevaOp));
|
||||
if (wtx.IsCoinBase())
|
||||
{
|
||||
if (wtx.GetDepthInMainChain() < 1)
|
||||
|
@ -1536,13 +1536,14 @@ void CWalletTx::GetAmounts(std::list<COutputEntry>& listReceived,
|
||||
{
|
||||
const CTxOut& txout = tx->vout[i];
|
||||
isminetype fIsMine = pwallet->IsMine(txout);
|
||||
const CKevaScript kevaOp(txout.scriptPubKey);
|
||||
// Only need to handle txouts if AT LEAST one of these is true:
|
||||
// 1) they debit from us (sent)
|
||||
// 2) the output is to us (received)
|
||||
if (nDebit > 0)
|
||||
{
|
||||
// Don't report 'change' txouts
|
||||
if (pwallet->IsChange(txout))
|
||||
if (pwallet->IsChange(txout) && !kevaOp.isKevaOp())
|
||||
continue;
|
||||
}
|
||||
else if (!(fIsMine & filter))
|
||||
@ -1558,14 +1559,26 @@ void CWalletTx::GetAmounts(std::list<COutputEntry>& listReceived,
|
||||
address = CNoDestination();
|
||||
}
|
||||
|
||||
COutputEntry output = {address, txout.nValue, (int)i};
|
||||
COutputEntry output = {address, "", txout.nValue, (int)i};
|
||||
|
||||
// If we have a keva script, set the "keva" parameter.
|
||||
if (kevaOp.isKevaOp())
|
||||
{
|
||||
if (kevaOp.isAnyUpdate())
|
||||
output.kevaOp = "update: " + ValtypeToString(kevaOp.getOpNamespace());
|
||||
else
|
||||
output.kevaOp = "new: " + ValtypeToString(kevaOp.getOpNamespace());
|
||||
output.amount = 0;
|
||||
}
|
||||
|
||||
|
||||
// If we are debited by the transaction, add the output as a "sent" entry
|
||||
if (nDebit > 0)
|
||||
listSent.push_back(output);
|
||||
|
||||
// If we are receiving the output, add it as a "received" entry
|
||||
if (fIsMine & filter)
|
||||
if ((fIsMine & filter)
|
||||
&& (!kevaOp.isKevaOp() || !(nDebit > 0)))
|
||||
listReceived.push_back(output);
|
||||
}
|
||||
|
||||
|
@ -193,6 +193,7 @@ static inline void WriteOrderPos(const int64_t& nOrderPos, mapValue_t& mapValue)
|
||||
struct COutputEntry
|
||||
{
|
||||
CTxDestination destination;
|
||||
std::string kevaOp;
|
||||
CAmount amount;
|
||||
int vout;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user