Make z_anonsettxdelta work on a tx that is not in our wallet and fix calculation
This commit is contained in:
@@ -3724,17 +3724,17 @@ UniValue z_anonsettxdelta(const UniValue& params, bool fHelp, const CPubKey& myp
|
|||||||
+ HelpExampleRpc("z_anonsettxdelta txid", "123")
|
+ HelpExampleRpc("z_anonsettxdelta txid", "123")
|
||||||
);
|
);
|
||||||
|
|
||||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
|
||||||
|
|
||||||
uint256 txid;
|
uint256 txid,hashBlock;
|
||||||
|
CTransaction tx;
|
||||||
txid.SetHex(params[0].get_str());
|
txid.SetHex(params[0].get_str());
|
||||||
|
|
||||||
if (!pwalletMain->mapWallet.count(txid))
|
LOCK(cs_main);
|
||||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid or non-wallet transaction id!");
|
if (!GetTransaction(txid, tx, hashBlock, true))
|
||||||
const CWalletTx& wtx = pwalletMain->mapWallet[txid];
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "No information available about transaction");
|
||||||
|
|
||||||
// delta = shielded outputs - shielded inputs
|
// delta = shielded outputs - shielded inputs
|
||||||
int delta = wtx.vShieldedSpend.size() - wtx.vShieldedOutput.size();
|
int delta = tx.vShieldedOutput.size() - tx.vShieldedSpend.size();
|
||||||
return delta;
|
return delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user