cleanup
This commit is contained in:
@@ -237,12 +237,6 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (isfromzaddr_ && !find_unspent_notes()) {
|
||||
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds, no unspent notes found for zaddr from address.");
|
||||
}
|
||||
*/
|
||||
|
||||
// Lock UTXOs
|
||||
lock_utxos();
|
||||
|
||||
@@ -253,7 +247,6 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
|
||||
CAmount z_inputs_total = 0;
|
||||
for (auto t : saplingNoteInputs_) {
|
||||
//z_inputs_total += t.note.value();
|
||||
z_inputs_total += std::get<1>(t).value();
|
||||
}
|
||||
|
||||
@@ -460,7 +453,6 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
LogPrintf("%s: ops.size=%d witnesses.size=%d\n", __func__, ops.size(), witnesses.size() );
|
||||
|
||||
// Add Sapling spends
|
||||
//TODO: should be using saplingNoteInputs_
|
||||
for (size_t i = 0; i < saplingNoteInputs_.size(); i++) {
|
||||
//LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
@@ -473,14 +465,6 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
if(fZdebug)
|
||||
LogPrintf("%s: Adding Sapling spend\n", __func__);
|
||||
assert(builder_.AddSaplingSpend(expsk, std::get<1>(saplingNoteInputs_[i]), anchor, witnesses[i].get()));
|
||||
|
||||
/*
|
||||
// notes we are currently spending should be locked
|
||||
if(pwalletMain->IsLockedNote(ops[i])) {
|
||||
} else {
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Note we are spending is not locked!" );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// Add Sapling outputs
|
||||
@@ -698,49 +682,6 @@ bool AsyncRPCOperation_sendmany::find_utxos(bool fAcceptCoinbase=false) {
|
||||
return t_inputs_.size() > 0;
|
||||
}
|
||||
|
||||
/*
|
||||
// find unspent notes which are also unlocked
|
||||
bool AsyncRPCOperation_sendmany::find_unspent_notes() {
|
||||
if(fZdebug)
|
||||
LogPrintf("%s: For address %s depth=%d\n", __FUNCTION__, fromaddress_.c_str(), mindepth_);
|
||||
|
||||
std::vector<SaplingNoteEntry> saplingEntries;
|
||||
{
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
// GetFilteredNotes ignores locked notes by default
|
||||
pwalletMain->GetFilteredNotes(saplingEntries, fromaddress_, mindepth_);
|
||||
}
|
||||
|
||||
for (auto entry : saplingEntries) {
|
||||
// locked status of note may have changed since GetFilteredNotes()
|
||||
// returned data, so we check again
|
||||
const bool isLocked = pwalletMain->IsLockedNote(entry.op);
|
||||
if (isLocked) {
|
||||
LogPrintf("%s: skipping locked note %s:%d\n", __func__, entry.op.hash.ToString().substr(0,10).c_str(), entry.op.n);
|
||||
continue;
|
||||
}
|
||||
|
||||
z_sapling_inputs_.push_back(entry);
|
||||
|
||||
std::string data(entry.memo.begin(), entry.memo.end());
|
||||
LogPrint("zrpcunsafe", "%s: found unspent Sapling note (txid=%s, vShieldedSpend=%d, amount=%s, memo=%s)\n",
|
||||
getId(),
|
||||
entry.op.hash.ToString().substr(0, 10),
|
||||
entry.op.n,
|
||||
FormatMoney(entry.note.value()),
|
||||
HexStr(data).substr(0, 10));
|
||||
}
|
||||
|
||||
// sort in descending order, so big notes appear first
|
||||
std::sort(z_sapling_inputs_.begin(), z_sapling_inputs_.end(),
|
||||
[](SaplingNoteEntry i, SaplingNoteEntry j) -> bool {
|
||||
return i.note.value() > j.note.value();
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
void AsyncRPCOperation_sendmany::add_taddr_outputs_to_tx() {
|
||||
|
||||
CMutableTransaction rawTx(tx_);
|
||||
|
||||
Reference in New Issue
Block a user