Browse Source

Logging and copyrights

pull/61/head
Duke Leto 4 years ago
parent
commit
7609fe8bbb
  1. 2
      src/main.cpp
  2. 2
      src/main.h
  3. 8
      src/wallet/asyncrpcoperation_sendmany.cpp
  4. 4
      src/wallet/rpcwallet.cpp

2
src/main.cpp

@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin Core developers
// Copyright (c) 2019 The Hush developers
// Copyright (c) 2019-2020 The Hush developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

2
src/main.h

@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin Core developers
// Copyright (c) 2019 The Hush developers
// Copyright (c) 2019-2020 The Hush developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

8
src/wallet/asyncrpcoperation_sendmany.cpp

@ -1,4 +1,5 @@
// Copyright (c) 2016 The Zcash developers
// Copyright (c) 2019-2020 The Hush developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -463,6 +464,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
}
// Select Sapling notes
LogPrintf("%s: Selecting Sapling notes\n", __FUNCTION__);
std::vector<SaplingOutPoint> ops;
std::vector<SaplingNote> notes;
CAmount sum = 0;
@ -476,6 +478,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
}
// Fetch Sapling anchor and witnesses
LogPrintf("%s: Gathering anchors and witnesses\n", __FUNCTION__);
uint256 anchor;
std::vector<boost::optional<SaplingWitness>> witnesses;
{
@ -492,6 +495,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
}
// Add Sapling outputs
LogPrintf("%s: Adding Sapling outputs\n", __FUNCTION__);
for (auto r : z_outputs_) {
auto address = std::get<0>(r);
auto value = std::get<1>(r);
@ -523,6 +527,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
throw JSONRPCError(RPC_WALLET_ERROR, "Failed to build transaction.");
}
tx_ = maybe_tx.get();
LogPrintf("%s: Raw transaction created\n", __FUNCTION__);
// Send the transaction
// TODO: Use CWallet::CommitTransaction instead of sendrawtransaction
@ -530,6 +535,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
if (!testmode) {
UniValue params = UniValue(UniValue::VARR);
params.push_back(signedtxn);
LogPrintf("%s: Sending raw xtn\n", __FUNCTION__);
UniValue sendResultValue = sendrawtransaction(params, false, CPubKey());
if (sendResultValue.isNull()) {
throw JSONRPCError(RPC_WALLET_ERROR, "sendrawtransaction did not return an error or a txid.");
@ -644,7 +650,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
* taddr -> taddrs
* -> zaddrs
*
* Note: Consensus rule states that coinbase utxos can only be sent to a zaddr.
* Note: Consensus rule states that coinbase utxos can only be sent to a zaddr. TODO: Do they?
* Local wallet rule does not allow any change when sending coinbase utxos
* since there is currently no way to specify a change address and we don't
* want users accidentally sending excess funds to a recipient.

4
src/wallet/rpcwallet.cpp

@ -4620,7 +4620,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Minimum number of confirmations cannot be less than 0");
}
// Fee in Zatoshis, not currency format)
// Fee in Puposhis, not currency format
CAmount nFee = ASYNC_RPC_OPERATION_DEFAULT_MINERS_FEE;
CAmount nDefaultFee = nFee;
@ -4653,6 +4653,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
o.push_back(Pair("minconf", nMinDepth));
o.push_back(Pair("fee", std::stod(FormatMoney(nFee))));
UniValue contextInfo = o;
LogPrintf("%s: Building the transaction\n", __FUNCTION__);
// Builder (used if Sapling addresses are involved)
boost::optional<TransactionBuilder> builder;
@ -4672,6 +4673,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
std::shared_ptr<AsyncRPCQueue> q = getAsyncRPCQueue();
std::shared_ptr<AsyncRPCOperation> operation( new AsyncRPCOperation_sendmany(builder, contextualTx, fromaddress, taddrRecipients, zaddrRecipients, nMinDepth, nFee, contextInfo) );
q->addOperation(operation);
LogPrintf("%s: Submitted to queue\n", __FUNCTION__);
AsyncRPCOperationId operationId = operation->getId();
return operationId;
}

Loading…
Cancel
Save