[logging] BCLog::ZRPC and ZRPCUNSAFE, gArgs
This commit is contained in:
parent
8073709070
commit
f113e2d4e6
|
@ -121,6 +121,8 @@ const CLogCategoryDesc LogCategories[] =
|
||||||
{BCLog::LEVELDB, "leveldb"},
|
{BCLog::LEVELDB, "leveldb"},
|
||||||
{BCLog::EQUIHASH, "equihash"},
|
{BCLog::EQUIHASH, "equihash"},
|
||||||
{BCLog::PAYMENTDISCLOSURE, "paymentdisclosure"},
|
{BCLog::PAYMENTDISCLOSURE, "paymentdisclosure"},
|
||||||
|
{BCLog::ZRPC, "zrpc"},
|
||||||
|
{BCLog::ZRPCUNSAFE, "zrpcunsafe"},
|
||||||
{BCLog::ALL, "1"},
|
{BCLog::ALL, "1"},
|
||||||
{BCLog::ALL, "all"},
|
{BCLog::ALL, "all"},
|
||||||
};
|
};
|
||||||
|
|
|
@ -55,6 +55,8 @@ namespace BCLog {
|
||||||
LEVELDB = (1 << 20),
|
LEVELDB = (1 << 20),
|
||||||
EQUIHASH = (1 << 21),
|
EQUIHASH = (1 << 21),
|
||||||
PAYMENTDISCLOSURE = (1 << 22),
|
PAYMENTDISCLOSURE = (1 << 22),
|
||||||
|
ZRPC = (1 << 23),
|
||||||
|
ZRPCUNSAFE = (1 << 24),
|
||||||
ALL = ~(uint32_t)0,
|
ALL = ~(uint32_t)0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <miner.h>
|
#include <miner.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <netbase.h>
|
#include <netbase.h>
|
||||||
|
#include <paymentdisclosuredb.h>
|
||||||
#include <rpc/protocol.h>
|
#include <rpc/protocol.h>
|
||||||
#include <rpc/server.h>
|
#include <rpc/server.h>
|
||||||
#include <script/interpreter.h>
|
#include <script/interpreter.h>
|
||||||
|
@ -91,10 +92,10 @@ AsyncRPCOperation_mergetoaddress::AsyncRPCOperation_mergetoaddress(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log the context info i.e. the call parameters to z_mergetoaddress
|
// Log the context info i.e. the call parameters to z_mergetoaddress
|
||||||
if (LogAcceptCategory("zrpcunsafe")) {
|
if (LogAcceptCategory(BCLog::ZRPCUNSAFE)) {
|
||||||
LogPrint("zrpcunsafe", "%s: z_mergetoaddress initialized (params=%s)\n", getId(), contextInfo.write());
|
LogPrint(BCLog::ZRPCUNSAFE, "%s: z_mergetoaddress initialized (params=%s)\n", getId(), contextInfo.write());
|
||||||
} else {
|
} else {
|
||||||
LogPrint("zrpc", "%s: z_mergetoaddress initialized\n", getId());
|
LogPrint(BCLog::ZRPC, "%s: z_mergetoaddress initialized\n", getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lock UTXOs
|
// Lock UTXOs
|
||||||
|
@ -102,7 +103,7 @@ AsyncRPCOperation_mergetoaddress::AsyncRPCOperation_mergetoaddress(
|
||||||
lock_notes();
|
lock_notes();
|
||||||
|
|
||||||
// Enable payment disclosure if requested
|
// Enable payment disclosure if requested
|
||||||
paymentDisclosureMode = fExperimentalMode && GetBoolArg("-paymentdisclosure", false);
|
paymentDisclosureMode = fExperimentalMode && gArgs.GetBoolArg("-paymentdisclosure", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncRPCOperation_mergetoaddress::~AsyncRPCOperation_mergetoaddress()
|
AsyncRPCOperation_mergetoaddress::~AsyncRPCOperation_mergetoaddress()
|
||||||
|
@ -185,9 +186,9 @@ void AsyncRPCOperation_mergetoaddress::main()
|
||||||
for (PaymentDisclosureKeyInfo p : paymentDisclosureData_) {
|
for (PaymentDisclosureKeyInfo p : paymentDisclosureData_) {
|
||||||
p.first.hash = txidhash;
|
p.first.hash = txidhash;
|
||||||
if (!db->Put(p.first, p.second)) {
|
if (!db->Put(p.first, p.second)) {
|
||||||
LogPrint("paymentdisclosure", "%s: Payment Disclosure: Error writing entry to database for key %s\n", getId(), p.first.ToString());
|
LogPrint(BCLog::PAYMENTDISCLOSURE, "%s: Payment Disclosure: Error writing entry to database for key %s\n", getId(), p.first.ToString());
|
||||||
} else {
|
} else {
|
||||||
LogPrint("paymentdisclosure", "%s: Payment Disclosure: Successfully added entry to database for key %s\n", getId(), p.first.ToString());
|
LogPrint(BCLog::PAYMENTDISCLOSURE, "%s: Payment Disclosure: Successfully added entry to database for key %s\n", getId(), p.first.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,7 +208,7 @@ bool AsyncRPCOperation_mergetoaddress::main_impl()
|
||||||
size_t numInputs = utxoInputs_.size();
|
size_t numInputs = utxoInputs_.size();
|
||||||
|
|
||||||
// Check mempooltxinputlimit to avoid creating a transaction which the local mempool rejects
|
// Check mempooltxinputlimit to avoid creating a transaction which the local mempool rejects
|
||||||
size_t limit = (size_t)GetArg("-mempooltxinputlimit", 0);
|
size_t limit = (size_t)gArgs.GetArg("-mempooltxinputlimit", 0);
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
if (NetworkUpgradeActive(chainActive.Height() + 1, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
|
if (NetworkUpgradeActive(chainActive.Height() + 1, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
|
||||||
|
@ -253,16 +254,16 @@ bool AsyncRPCOperation_mergetoaddress::main_impl()
|
||||||
}
|
}
|
||||||
tx_ = CTransaction(rawTx);
|
tx_ = CTransaction(rawTx);
|
||||||
|
|
||||||
LogPrint(isPureTaddrOnlyTx ? "zrpc" : "zrpcunsafe", "%s: spending %s to send %s with fee %s\n",
|
LogPrint(isPureTaddrOnlyTx ? BCLog::ZRPC : BCLog::ZRPCUNSAFE, "%s: spending %s to send %s with fee %s\n",
|
||||||
getId(), FormatMoney(targetAmount), FormatMoney(sendAmount), FormatMoney(minersFee));
|
getId(), FormatMoney(targetAmount), FormatMoney(sendAmount), FormatMoney(minersFee));
|
||||||
LogPrint("zrpc", "%s: transparent input: %s\n", getId(), FormatMoney(t_inputs_total));
|
LogPrint(BCLog::ZRPC, "%s: transparent input: %s\n", getId(), FormatMoney(t_inputs_total));
|
||||||
LogPrint("zrpcunsafe", "%s: private input: %s\n", getId(), FormatMoney(z_inputs_total));
|
LogPrint(BCLog::ZRPCUNSAFE, "%s: private input: %s\n", getId(), FormatMoney(z_inputs_total));
|
||||||
if (isToTaddr_) {
|
if (isToTaddr_) {
|
||||||
LogPrint("zrpc", "%s: transparent output: %s\n", getId(), FormatMoney(sendAmount));
|
LogPrint(BCLog::ZRPC, "%s: transparent output: %s\n", getId(), FormatMoney(sendAmount));
|
||||||
} else {
|
} else {
|
||||||
LogPrint("zrpcunsafe", "%s: private output: %s\n", getId(), FormatMoney(sendAmount));
|
LogPrint(BCLog::ZRPCUNSAFE, "%s: private output: %s\n", getId(), FormatMoney(sendAmount));
|
||||||
}
|
}
|
||||||
LogPrint("zrpc", "%s: fee: %s\n", getId(), FormatMoney(minersFee));
|
LogPrint(BCLog::ZRPC, "%s: fee: %s\n", getId(), FormatMoney(minersFee));
|
||||||
|
|
||||||
// Grab the current consensus branch ID
|
// Grab the current consensus branch ID
|
||||||
{
|
{
|
||||||
|
@ -469,7 +470,7 @@ bool AsyncRPCOperation_mergetoaddress::main_impl()
|
||||||
|
|
||||||
jsInputValue += plaintext.value;
|
jsInputValue += plaintext.value;
|
||||||
|
|
||||||
LogPrint("zrpcunsafe", "%s: spending change (amount=%s)\n",
|
LogPrint(BCLog::ZRPCUNSAFE, "%s: spending change (amount=%s)\n",
|
||||||
getId(),
|
getId(),
|
||||||
FormatMoney(plaintext.value));
|
FormatMoney(plaintext.value));
|
||||||
|
|
||||||
|
@ -522,7 +523,7 @@ bool AsyncRPCOperation_mergetoaddress::main_impl()
|
||||||
wtxHeight = mapBlockIndex[wtx.hashBlock]->nHeight;
|
wtxHeight = mapBlockIndex[wtx.hashBlock]->nHeight;
|
||||||
wtxDepth = wtx.GetDepthInMainChain();
|
wtxDepth = wtx.GetDepthInMainChain();
|
||||||
}
|
}
|
||||||
LogPrint("zrpcunsafe", "%s: spending note (txid=%s, vjoinsplit=%d, ciphertext=%d, amount=%s, height=%d, confirmations=%d)\n",
|
LogPrint(BCLog::ZRPCUNSAFE, "%s: spending note (txid=%s, vjoinsplit=%d, ciphertext=%d, amount=%s, height=%d, confirmations=%d)\n",
|
||||||
getId(),
|
getId(),
|
||||||
jso.hash.ToString().substr(0, 10),
|
jso.hash.ToString().substr(0, 10),
|
||||||
jso.js,
|
jso.js,
|
||||||
|
@ -599,7 +600,7 @@ bool AsyncRPCOperation_mergetoaddress::main_impl()
|
||||||
}
|
}
|
||||||
info.vjsout.push_back(jso);
|
info.vjsout.push_back(jso);
|
||||||
|
|
||||||
LogPrint("zrpcunsafe", "%s: generating note for %s (amount=%s)\n",
|
LogPrint(BCLog::ZRPCUNSAFE, "%s: generating note for %s (amount=%s)\n",
|
||||||
getId(),
|
getId(),
|
||||||
outputType,
|
outputType,
|
||||||
FormatMoney(jsChange));
|
FormatMoney(jsChange));
|
||||||
|
@ -750,7 +751,7 @@ UniValue AsyncRPCOperation_mergetoaddress::perform_joinsplit(
|
||||||
|
|
||||||
CMutableTransaction mtx(tx_);
|
CMutableTransaction mtx(tx_);
|
||||||
|
|
||||||
LogPrint("zrpcunsafe", "%s: creating joinsplit at index %d (vpub_old=%s, vpub_new=%s, in[0]=%s, in[1]=%s, out[0]=%s, out[1]=%s)\n",
|
LogPrint(BCLog::ZRPCUNSAFE, "%s: creating joinsplit at index %d (vpub_old=%s, vpub_new=%s, in[0]=%s, in[1]=%s, out[0]=%s, out[1]=%s)\n",
|
||||||
getId(),
|
getId(),
|
||||||
tx_.vjoinsplit.size(),
|
tx_.vjoinsplit.size(),
|
||||||
FormatMoney(info.vpub_old), FormatMoney(info.vpub_new),
|
FormatMoney(info.vpub_old), FormatMoney(info.vpub_new),
|
||||||
|
@ -859,7 +860,7 @@ UniValue AsyncRPCOperation_mergetoaddress::perform_joinsplit(
|
||||||
paymentDisclosureData_.push_back(PaymentDisclosureKeyInfo(pdKey, pdInfo));
|
paymentDisclosureData_.push_back(PaymentDisclosureKeyInfo(pdKey, pdInfo));
|
||||||
|
|
||||||
CZCPaymentAddress address(zaddr);
|
CZCPaymentAddress address(zaddr);
|
||||||
LogPrint("paymentdisclosure", "%s: Payment Disclosure: js=%d, n=%d, zaddr=%s\n", getId(), js_index, int(mapped_index), address.ToString());
|
LogPrint(BCLog::PAYMENTDISCLOSURE, "%s: Payment Disclosure: js=%d, n=%d, zaddr=%s\n", getId(), js_index, int(mapped_index), address.ToString());
|
||||||
}
|
}
|
||||||
// !!! Payment disclosure END
|
// !!! Payment disclosure END
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include <init.h>
|
#include <init.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <netbase.h>
|
#include <netbase.h>
|
||||||
|
#include <paymentdisclosure.h>
|
||||||
|
#include <paymentdisclosuredb.h>
|
||||||
#include <rpc/server.h>
|
#include <rpc/server.h>
|
||||||
#include <timedata.h>
|
#include <timedata.h>
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
|
@ -29,8 +31,6 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <paymentdisclosuredb.h>
|
|
||||||
|
|
||||||
using namespace libzcash;
|
using namespace libzcash;
|
||||||
|
|
||||||
int find_output(UniValue obj, int n) {
|
int find_output(UniValue obj, int n) {
|
||||||
|
@ -102,10 +102,10 @@ AsyncRPCOperation_sendmany::AsyncRPCOperation_sendmany(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log the context info i.e. the call parameters to z_sendmany
|
// Log the context info i.e. the call parameters to z_sendmany
|
||||||
if (LogAcceptCategory("zrpcunsafe")) {
|
if (LogAcceptCategory(BCLog::ZRPCUNSAFE)) {
|
||||||
LogPrint("zrpcunsafe", "%s: z_sendmany initialized (params=%s)\n", getId(), contextInfo.write());
|
LogPrint(BCLog::ZRPCUNSAFE, "%s: z_sendmany initialized (params=%s)\n", getId(), contextInfo.write());
|
||||||
} else {
|
} else {
|
||||||
LogPrint("zrpc", "%s: z_sendmany initialized\n", getId());
|
LogPrint(BCLog::ZRPC, "%s: z_sendmany initialized\n", getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -185,9 +185,9 @@ void AsyncRPCOperation_sendmany::main() {
|
||||||
for (PaymentDisclosureKeyInfo p : paymentDisclosureData_) {
|
for (PaymentDisclosureKeyInfo p : paymentDisclosureData_) {
|
||||||
p.first.hash = txidhash;
|
p.first.hash = txidhash;
|
||||||
if (!db->Put(p.first, p.second)) {
|
if (!db->Put(p.first, p.second)) {
|
||||||
LogPrint("paymentdisclosure", "%s: Payment Disclosure: Error writing entry to database for key %s\n", getId(), p.first.ToString());
|
LogPrint(BCLog::PAYMENTDISCLOSURE, "%s: Payment Disclosure: Error writing entry to database for key %s\n", getId(), p.first.ToString());
|
||||||
} else {
|
} else {
|
||||||
LogPrint("paymentdisclosure", "%s: Payment Disclosure: Successfully added entry to database for key %s\n", getId(), p.first.ToString());
|
LogPrint(BCLog::PAYMENTDISCLOSURE, "%s: Payment Disclosure: Successfully added entry to database for key %s\n", getId(), p.first.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||||
t_inputs_total = selectedUTXOAmount;
|
t_inputs_total = selectedUTXOAmount;
|
||||||
|
|
||||||
// Check mempooltxinputlimit to avoid creating a transaction which the local mempool rejects
|
// Check mempooltxinputlimit to avoid creating a transaction which the local mempool rejects
|
||||||
size_t limit = (size_t)GetArg("-mempooltxinputlimit", 0);
|
size_t limit = (size_t)gArgs.GetArg("-mempooltxinputlimit", 0);
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
if (NetworkUpgradeActive(chainActive.Height() + 1, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
|
if (NetworkUpgradeActive(chainActive.Height() + 1, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
|
||||||
|
@ -335,13 +335,13 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||||
tx_ = CTransaction(rawTx);
|
tx_ = CTransaction(rawTx);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogPrint((isfromtaddr_) ? "zrpc" : "zrpcunsafe", "%s: spending %s to send %s with fee %s\n",
|
LogPrint((isfromtaddr_) ? BCLog::ZRPC : BCLog::ZRPCUNSAFE, "%s: spending %s to send %s with fee %s\n",
|
||||||
getId(), FormatMoney(targetAmount), FormatMoney(sendAmount), FormatMoney(minersFee));
|
getId(), FormatMoney(targetAmount), FormatMoney(sendAmount), FormatMoney(minersFee));
|
||||||
LogPrint("zrpc", "%s: transparent input: %s (to choose from)\n", getId(), FormatMoney(t_inputs_total));
|
LogPrint(BCLog::ZRPC, "%s: transparent input: %s (to choose from)\n", getId(), FormatMoney(t_inputs_total));
|
||||||
LogPrint("zrpcunsafe", "%s: private input: %s (to choose from)\n", getId(), FormatMoney(z_inputs_total));
|
LogPrint(BCLog::ZRPCUNSAFE, "%s: private input: %s (to choose from)\n", getId(), FormatMoney(z_inputs_total));
|
||||||
LogPrint("zrpc", "%s: transparent output: %s\n", getId(), FormatMoney(t_outputs_total));
|
LogPrint(BCLog::ZRPC, "%s: transparent output: %s\n", getId(), FormatMoney(t_outputs_total));
|
||||||
LogPrint("zrpcunsafe", "%s: private output: %s\n", getId(), FormatMoney(z_outputs_total));
|
LogPrint(BCLog::ZRPCUNSAFE, "%s: private output: %s\n", getId(), FormatMoney(z_outputs_total));
|
||||||
LogPrint("zrpc", "%s: fee: %s\n", getId(), FormatMoney(minersFee));
|
LogPrint(BCLog::ZRPC, "%s: fee: %s\n", getId(), FormatMoney(minersFee));
|
||||||
|
|
||||||
// Grab the current consensus branch ID
|
// Grab the current consensus branch ID
|
||||||
{
|
{
|
||||||
|
@ -366,7 +366,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||||
if (change > 0) {
|
if (change > 0) {
|
||||||
add_taddr_change_output_to_tx(change);
|
add_taddr_change_output_to_tx(change);
|
||||||
|
|
||||||
LogPrint("zrpc", "%s: transparent change in transaction output (amount=%s)\n",
|
LogPrint(BCLog::ZRPC, "%s: transparent change in transaction output (amount=%s)\n",
|
||||||
getId(),
|
getId(),
|
||||||
FormatMoney(change)
|
FormatMoney(change)
|
||||||
);
|
);
|
||||||
|
@ -446,7 +446,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||||
"in z_sendmany.", FormatMoney(change)));
|
"in z_sendmany.", FormatMoney(change)));
|
||||||
} else {
|
} else {
|
||||||
add_taddr_change_output_to_tx(change);
|
add_taddr_change_output_to_tx(change);
|
||||||
LogPrint("zrpc", "%s: transparent change in transaction output (amount=%s)\n",
|
LogPrint(BCLog::ZRPC, "%s: transparent change in transaction output (amount=%s)\n",
|
||||||
getId(),
|
getId(),
|
||||||
FormatMoney(change)
|
FormatMoney(change)
|
||||||
);
|
);
|
||||||
|
@ -583,7 +583,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||||
|
|
||||||
jsInputValue += plaintext.value;
|
jsInputValue += plaintext.value;
|
||||||
|
|
||||||
LogPrint("zrpcunsafe", "%s: spending change (amount=%s)\n",
|
LogPrint(BCLog::ZRPCUNSAFE, "%s: spending change (amount=%s)\n",
|
||||||
getId(),
|
getId(),
|
||||||
FormatMoney(plaintext.value)
|
FormatMoney(plaintext.value)
|
||||||
);
|
);
|
||||||
|
@ -634,7 +634,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||||
wtxHeight = mapBlockIndex[wtx.hashBlock]->nHeight;
|
wtxHeight = mapBlockIndex[wtx.hashBlock]->nHeight;
|
||||||
wtxDepth = wtx.GetDepthInMainChain();
|
wtxDepth = wtx.GetDepthInMainChain();
|
||||||
}
|
}
|
||||||
LogPrint("zrpcunsafe", "%s: spending note (txid=%s, vjoinsplit=%d, ciphertext=%d, amount=%s, height=%d, confirmations=%d)\n",
|
LogPrint(BCLog::ZRPCUNSAFE, "%s: spending note (txid=%s, vjoinsplit=%d, ciphertext=%d, amount=%s, height=%d, confirmations=%d)\n",
|
||||||
getId(),
|
getId(),
|
||||||
jso.hash.ToString().substr(0, 10),
|
jso.hash.ToString().substr(0, 10),
|
||||||
jso.js,
|
jso.js,
|
||||||
|
@ -738,7 +738,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||||
if (jsChange>0) {
|
if (jsChange>0) {
|
||||||
info.vjsout.push_back(JSOutput(frompaymentaddress_, jsChange));
|
info.vjsout.push_back(JSOutput(frompaymentaddress_, jsChange));
|
||||||
|
|
||||||
LogPrint("zrpcunsafe", "%s: generating note for change (amount=%s)\n",
|
LogPrint(BCLog::ZRPCUNSAFE, "%s: generating note for change (amount=%s)\n",
|
||||||
getId(),
|
getId(),
|
||||||
FormatMoney(jsChange)
|
FormatMoney(jsChange)
|
||||||
);
|
);
|
||||||
|
@ -886,7 +886,7 @@ bool AsyncRPCOperation_sendmany::find_unspent_notes() {
|
||||||
for (CNotePlaintextEntry & entry : entries) {
|
for (CNotePlaintextEntry & entry : entries) {
|
||||||
z_inputs_.push_back(SendManyInputJSOP(entry.jsop, entry.plaintext.note(frompaymentaddress_), CAmount(entry.plaintext.value)));
|
z_inputs_.push_back(SendManyInputJSOP(entry.jsop, entry.plaintext.note(frompaymentaddress_), 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());
|
||||||
LogPrint("zrpcunsafe", "%s: found unspent note (txid=%s, vjoinsplit=%d, ciphertext=%d, amount=%s, memo=%s)\n",
|
LogPrint(BCLog::ZRPCUNSAFE, "%s: found unspent note (txid=%s, vjoinsplit=%d, ciphertext=%d, amount=%s, memo=%s)\n",
|
||||||
getId(),
|
getId(),
|
||||||
entry.jsop.hash.ToString().substr(0, 10),
|
entry.jsop.hash.ToString().substr(0, 10),
|
||||||
entry.jsop.js,
|
entry.jsop.js,
|
||||||
|
@ -964,7 +964,7 @@ UniValue AsyncRPCOperation_sendmany::perform_joinsplit(
|
||||||
|
|
||||||
CMutableTransaction mtx(tx_);
|
CMutableTransaction mtx(tx_);
|
||||||
|
|
||||||
LogPrint("zrpcunsafe", "%s: creating joinsplit at index %d (vpub_old=%s, vpub_new=%s, in[0]=%s, in[1]=%s, out[0]=%s, out[1]=%s)\n",
|
LogPrint(BCLog::ZRPCUNSAFE, "%s: creating joinsplit at index %d (vpub_old=%s, vpub_new=%s, in[0]=%s, in[1]=%s, out[0]=%s, out[1]=%s)\n",
|
||||||
getId(),
|
getId(),
|
||||||
tx_.vjoinsplit.size(),
|
tx_.vjoinsplit.size(),
|
||||||
FormatMoney(info.vpub_old), FormatMoney(info.vpub_new),
|
FormatMoney(info.vpub_old), FormatMoney(info.vpub_new),
|
||||||
|
@ -1080,7 +1080,7 @@ UniValue AsyncRPCOperation_sendmany::perform_joinsplit(
|
||||||
paymentDisclosureData_.push_back(PaymentDisclosureKeyInfo(pdKey, pdInfo));
|
paymentDisclosureData_.push_back(PaymentDisclosureKeyInfo(pdKey, pdInfo));
|
||||||
|
|
||||||
CZCPaymentAddress address(zaddr);
|
CZCPaymentAddress address(zaddr);
|
||||||
LogPrint("paymentdisclosure", "%s: Payment Disclosure: js=%d, n=%d, zaddr=%s\n", getId(), js_index, int(mapped_index), address.ToString());
|
LogPrint(BCLog::PAYMENTDISCLOSURE, "%s: Payment Disclosure: js=%d, n=%d, zaddr=%s\n", getId(), js_index, int(mapped_index), address.ToString());
|
||||||
}
|
}
|
||||||
// !!! Payment disclosure END
|
// !!! Payment disclosure END
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include <main.h>
|
#include <main.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <netbase.h>
|
#include <netbase.h>
|
||||||
|
#include <paymentdisclosure.h>
|
||||||
|
#include <paymentdisclosuredb.h>
|
||||||
#include <rpcserver.h>
|
#include <rpcserver.h>
|
||||||
#include <timedata.h>
|
#include <timedata.h>
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
|
@ -18,7 +20,7 @@
|
||||||
#include <walletdb.h>
|
#include <walletdb.h>
|
||||||
#include <script/interpreter.h>
|
#include <script/interpreter.h>
|
||||||
#include <utiltime.h>
|
#include <utiltime.h>
|
||||||
#include <rpcprotocol.h>
|
#include <rpc/protocol.h>
|
||||||
#include <zcash/IncrementalMerkleTree.hpp>
|
#include <zcash/IncrementalMerkleTree.hpp>
|
||||||
#include <sodium.h>
|
#include <sodium.h>
|
||||||
#include <miner.h>
|
#include <miner.h>
|
||||||
|
@ -30,8 +32,6 @@
|
||||||
|
|
||||||
#include <wallet/asyncrpcoperation_shieldcoinbase.h>
|
#include <wallet/asyncrpcoperation_shieldcoinbase.h>
|
||||||
|
|
||||||
#include <wallet/paymentdisclosure.h>
|
|
||||||
#include <wallet/paymentdisclosuredb.h>
|
|
||||||
|
|
||||||
using namespace libzcash;
|
using namespace libzcash;
|
||||||
|
|
||||||
|
@ -79,10 +79,10 @@ AsyncRPCOperation_shieldcoinbase::AsyncRPCOperation_shieldcoinbase(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log the context info
|
// Log the context info
|
||||||
if (LogAcceptCategory("zrpcunsafe")) {
|
if (LogAcceptCategory(BCLog::ZRPCUNSAFE)) {
|
||||||
LogPrint("zrpcunsafe", "%s: z_shieldcoinbase initialized (context=%s)\n", getId(), contextInfo.write());
|
LogPrint(BCLog::ZRPCUNSAFE, "%s: z_shieldcoinbase initialized (context=%s)\n", getId(), contextInfo.write());
|
||||||
} else {
|
} else {
|
||||||
LogPrint("zrpc", "%s: z_shieldcoinbase initialized\n", getId());
|
LogPrint(BCLog::ZRPC, "%s: z_shieldcoinbase initialized\n", getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lock UTXOs
|
// Lock UTXOs
|
||||||
|
@ -168,9 +168,9 @@ void AsyncRPCOperation_shieldcoinbase::main() {
|
||||||
for (PaymentDisclosureKeyInfo p : paymentDisclosureData_) {
|
for (PaymentDisclosureKeyInfo p : paymentDisclosureData_) {
|
||||||
p.first.hash = txidhash;
|
p.first.hash = txidhash;
|
||||||
if (!db->Put(p.first, p.second)) {
|
if (!db->Put(p.first, p.second)) {
|
||||||
LogPrint("paymentdisclosure", "%s: Payment Disclosure: Error writing entry to database for key %s\n", getId(), p.first.ToString());
|
LogPrint(BCLog::PAYMENTDISCLOSURE, "%s: Payment Disclosure: Error writing entry to database for key %s\n", getId(), p.first.ToString());
|
||||||
} else {
|
} else {
|
||||||
LogPrint("paymentdisclosure", "%s: Payment Disclosure: Successfully added entry to database for key %s\n", getId(), p.first.ToString());
|
LogPrint(BCLog::PAYMENTDISCLOSURE, "%s: Payment Disclosure: Successfully added entry to database for key %s\n", getId(), p.first.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ bool AsyncRPCOperation_shieldcoinbase::main_impl() {
|
||||||
size_t numInputs = inputs_.size();
|
size_t numInputs = inputs_.size();
|
||||||
|
|
||||||
// Check mempooltxinputlimit to avoid creating a transaction which the local mempool rejects
|
// Check mempooltxinputlimit to avoid creating a transaction which the local mempool rejects
|
||||||
size_t limit = (size_t)GetArg("-mempooltxinputlimit", 0);
|
size_t limit = (size_t)gArgs.GetArg("-mempooltxinputlimit", 0);
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
if (NetworkUpgradeActive(chainActive.Height() + 1, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
|
if (NetworkUpgradeActive(chainActive.Height() + 1, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
|
||||||
|
@ -210,7 +210,7 @@ bool AsyncRPCOperation_shieldcoinbase::main_impl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
CAmount sendAmount = targetAmount - minersFee;
|
CAmount sendAmount = targetAmount - minersFee;
|
||||||
LogPrint("zrpc", "%s: spending %s to shield %s with fee %s\n",
|
LogPrint(BCLog::ZRPC, "%s: spending %s to shield %s with fee %s\n",
|
||||||
getId(), FormatMoney(targetAmount), FormatMoney(sendAmount), FormatMoney(minersFee));
|
getId(), FormatMoney(targetAmount), FormatMoney(sendAmount), FormatMoney(minersFee));
|
||||||
|
|
||||||
// update the transaction with these inputs
|
// update the transaction with these inputs
|
||||||
|
@ -337,7 +337,7 @@ UniValue AsyncRPCOperation_shieldcoinbase::perform_joinsplit(ShieldCoinbaseJSInf
|
||||||
|
|
||||||
CMutableTransaction mtx(tx_);
|
CMutableTransaction mtx(tx_);
|
||||||
|
|
||||||
LogPrint("zrpcunsafe", "%s: creating joinsplit at index %d (vpub_old=%s, vpub_new=%s, in[0]=%s, in[1]=%s, out[0]=%s, out[1]=%s)\n",
|
LogPrint(BCLog::ZRPCUNSAFE, "%s: creating joinsplit at index %d (vpub_old=%s, vpub_new=%s, in[0]=%s, in[1]=%s, out[0]=%s, out[1]=%s)\n",
|
||||||
getId(),
|
getId(),
|
||||||
tx_.vjoinsplit.size(),
|
tx_.vjoinsplit.size(),
|
||||||
FormatMoney(info.vpub_old), FormatMoney(info.vpub_new),
|
FormatMoney(info.vpub_old), FormatMoney(info.vpub_new),
|
||||||
|
@ -452,7 +452,7 @@ UniValue AsyncRPCOperation_shieldcoinbase::perform_joinsplit(ShieldCoinbaseJSInf
|
||||||
paymentDisclosureData_.push_back(PaymentDisclosureKeyInfo(pdKey, pdInfo));
|
paymentDisclosureData_.push_back(PaymentDisclosureKeyInfo(pdKey, pdInfo));
|
||||||
|
|
||||||
CZCPaymentAddress address(zaddr);
|
CZCPaymentAddress address(zaddr);
|
||||||
LogPrint("paymentdisclosure", "%s: Payment Disclosure: js=%d, n=%d, zaddr=%s\n", getId(), js_index, int(mapped_index), address.ToString());
|
LogPrint(BCLog::PAYMENTDISCLOSURE, "%s: Payment Disclosure: js=%d, n=%d, zaddr=%s\n", getId(), js_index, int(mapped_index), address.ToString());
|
||||||
}
|
}
|
||||||
// !!! Payment disclosure END
|
// !!! Payment disclosure END
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue