mirror of
https://github.com/wownero/wownero.git
synced 2026-12-03 14:34:01 +01:00
wallet: remove output blackballing
This commit is contained in:
@@ -2604,88 +2604,6 @@ bool WalletImpl::useForkRules(uint8_t version, int64_t early_blocks) const
|
||||
return m_wallet->use_fork_rules(version,early_blocks);
|
||||
}
|
||||
|
||||
bool WalletImpl::blackballOutputs(const std::vector<std::string> &outputs, bool add)
|
||||
{
|
||||
std::vector<std::pair<uint64_t, uint64_t>> raw_outputs;
|
||||
raw_outputs.reserve(outputs.size());
|
||||
uint64_t amount = std::numeric_limits<uint64_t>::max(), offset, num_offsets;
|
||||
for (const std::string &str: outputs)
|
||||
{
|
||||
if (sscanf(str.c_str(), "@%" PRIu64, &amount) == 1)
|
||||
continue;
|
||||
if (amount == std::numeric_limits<uint64_t>::max())
|
||||
{
|
||||
setStatusError("First line is not an amount");
|
||||
return true;
|
||||
}
|
||||
if (sscanf(str.c_str(), "%" PRIu64 "*%" PRIu64, &offset, &num_offsets) == 2 && num_offsets <= std::numeric_limits<uint64_t>::max() - offset)
|
||||
{
|
||||
while (num_offsets--)
|
||||
raw_outputs.push_back(std::make_pair(amount, offset++));
|
||||
}
|
||||
else if (sscanf(str.c_str(), "%" PRIu64, &offset) == 1)
|
||||
{
|
||||
raw_outputs.push_back(std::make_pair(amount, offset));
|
||||
}
|
||||
else
|
||||
{
|
||||
setStatusError(tr("Invalid output: ") + str);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
bool ret = m_wallet->set_blackballed_outputs(raw_outputs, add);
|
||||
if (!ret)
|
||||
{
|
||||
setStatusError(tr("Failed to mark outputs as spent"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WalletImpl::blackballOutput(const std::string &amount, const std::string &offset)
|
||||
{
|
||||
uint64_t raw_amount, raw_offset;
|
||||
if (!epee::string_tools::get_xtype_from_string(raw_amount, amount))
|
||||
{
|
||||
setStatusError(tr("Failed to parse output amount"));
|
||||
return false;
|
||||
}
|
||||
if (!epee::string_tools::get_xtype_from_string(raw_offset, offset))
|
||||
{
|
||||
setStatusError(tr("Failed to parse output offset"));
|
||||
return false;
|
||||
}
|
||||
bool ret = m_wallet->blackball_output(std::make_pair(raw_amount, raw_offset));
|
||||
if (!ret)
|
||||
{
|
||||
setStatusError(tr("Failed to mark output as spent"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WalletImpl::unblackballOutput(const std::string &amount, const std::string &offset)
|
||||
{
|
||||
uint64_t raw_amount, raw_offset;
|
||||
if (!epee::string_tools::get_xtype_from_string(raw_amount, amount))
|
||||
{
|
||||
setStatusError(tr("Failed to parse output amount"));
|
||||
return false;
|
||||
}
|
||||
if (!epee::string_tools::get_xtype_from_string(raw_offset, offset))
|
||||
{
|
||||
setStatusError(tr("Failed to parse output offset"));
|
||||
return false;
|
||||
}
|
||||
bool ret = m_wallet->unblackball_output(std::make_pair(raw_amount, raw_offset));
|
||||
if (!ret)
|
||||
{
|
||||
setStatusError(tr("Failed to mark output as unspent"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WalletImpl::getRing(const std::string &key_image, std::vector<uint64_t> &ring) const
|
||||
{
|
||||
crypto::key_image raw_key_image;
|
||||
|
||||
Reference in New Issue
Block a user