mirror of https://github.com/oxen-io/oxen-core.git
Merge commit '6690190' into LokiMergeUpstreamUntil_20181010_77e1ebf
This commit is contained in:
commit
b052bced48
|
@ -159,6 +159,10 @@ if(ARCH_ID STREQUAL "powerpc")
|
|||
set(PPC 1)
|
||||
endif()
|
||||
|
||||
if(ARCH_ID STREQUAL "s390x")
|
||||
set(S390X 1)
|
||||
endif()
|
||||
|
||||
if(WIN32 OR ARM OR PPC64LE OR PPC64 OR PPC)
|
||||
set(OPT_FLAGS_RELEASE "-O2")
|
||||
else()
|
||||
|
@ -646,12 +650,14 @@ else()
|
|||
message(STATUS "AES support explicitly disabled")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNO_AES")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_AES")
|
||||
elseif(NOT ARM AND NOT PPC64LE AND NOT PPC64 AND NOT PPC)
|
||||
elseif(NOT ARM AND NOT PPC64LE AND NOT PPC64 AND NOT PPC AND NOT S390X)
|
||||
message(STATUS "AES support enabled")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")
|
||||
elseif(PPC64LE OR PPC64 OR PPC)
|
||||
message(STATUS "AES support not available on POWER")
|
||||
elseif(S390X)
|
||||
message(STATUS "AES support not available on s390x")
|
||||
elseif(ARM6)
|
||||
message(STATUS "AES support not available on ARMv6")
|
||||
elseif(ARM7)
|
||||
|
|
|
@ -51,7 +51,7 @@ library archives (`.a`).
|
|||
| libzmq | 3.0.0 | NO | `libzmq3-dev` | `zeromq` | `cppzmq-devel` | NO | ZeroMQ library |
|
||||
| OpenPGM | ? | NO | `libpgm-dev` | `libpgm` | `openpgm-devel` | NO | For ZeroMQ |
|
||||
| libunbound | 1.4.16 | YES | `libunbound-dev` | `unbound` | `unbound-devel` | NO | DNS resolver |
|
||||
| libsodium | ? | NO | `libsodium-dev` | ? | `libsodium-devel` | NO | cryptography |
|
||||
| libsodium | ? | NO | `libsodium-dev` | `libsodium` | `libsodium-devel` | NO | cryptography |
|
||||
| libunwind | any | NO | `libunwind8-dev` | `libunwind` | `libunwind-devel` | YES | Stack traces |
|
||||
| liblzma | any | NO | `liblzma-dev` | `xz` | `xz-devel` | YES | For libunwind |
|
||||
| libreadline | 6.3.0 | NO | `libreadline6-dev` | `readline` | `readline-devel` | YES | Input editing |
|
||||
|
@ -194,7 +194,7 @@ If you are using the older Raspbian Jessie image, compiling Loki is a bit more c
|
|||
```
|
||||
* Wait ~8 hours
|
||||
```
|
||||
sudo ./bjam install
|
||||
sudo ./bjam cxxflags=-fPIC cflags=-fPIC -a install
|
||||
```
|
||||
* Wait ~4 hours
|
||||
|
||||
|
|
|
@ -6092,6 +6092,25 @@ bool simple_wallet::sweep_main(uint64_t below, bool locked, const std::vector<st
|
|||
local_args.erase(local_args.begin() + 1);
|
||||
}
|
||||
|
||||
size_t outputs = 1;
|
||||
if (local_args.size() > 0 && local_args[0].substr(0, 8) == "outputs=")
|
||||
{
|
||||
if (!epee::string_tools::get_xtype_from_string(outputs, local_args[0].substr(8)))
|
||||
{
|
||||
fail_msg_writer() << tr("Failed to parse number of outputs");
|
||||
return true;
|
||||
}
|
||||
else if (outputs < 1)
|
||||
{
|
||||
fail_msg_writer() << tr("Amount of outputs should be greater than 0");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
local_args.erase(local_args.begin());
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<uint8_t> extra;
|
||||
bool payment_id_seen = false;
|
||||
if (local_args.size() >= 2)
|
||||
|
|
|
@ -8566,7 +8566,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_all(uint64_t below
|
|||
return create_transactions_from(address, is_subaddress, unused_transfers_indices, unused_dust_indices, fake_outs_count, unlock_time, priority, extra, is_staking_tx);
|
||||
}
|
||||
|
||||
std::vector<wallet2::pending_tx> wallet2::create_transactions_single(const crypto::key_image &ki, const cryptonote::account_public_address &address, bool is_subaddress, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra)
|
||||
std::vector<wallet2::pending_tx> wallet2::create_transactions_single(const crypto::key_image &ki, const cryptonote::account_public_address &address, bool is_subaddress, const size_t outputs, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra)
|
||||
{
|
||||
std::vector<size_t> unused_transfers_indices;
|
||||
std::vector<size_t> unused_dust_indices;
|
||||
|
@ -8584,7 +8584,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_single(const crypt
|
|||
break;
|
||||
}
|
||||
}
|
||||
return create_transactions_from(address, is_subaddress, unused_transfers_indices, unused_dust_indices, fake_outs_count, unlock_time, priority, extra);
|
||||
return create_transactions_from(address, is_subaddress, outputs, unused_transfers_indices, unused_dust_indices, fake_outs_count, unlock_time, priority, extra);
|
||||
}
|
||||
|
||||
std::vector<wallet2::pending_tx> wallet2::create_transactions_from(const cryptonote::account_public_address &address, bool is_subaddress, std::vector<size_t> unused_transfers_indices, std::vector<size_t> unused_dust_indices, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra, bool is_staking_tx)
|
||||
|
@ -8682,7 +8682,9 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_from(const crypton
|
|||
|
||||
needed_fee = estimate_fee(use_per_byte_fee, use_rct, tx.selected_transfers.size(), fake_outs_count, tx.dsts.size()+1, extra.size(), bulletproof, base_fee, fee_multiplier, fee_quantization_mask);
|
||||
|
||||
tx.dsts.push_back(tx_destination_entry(1, address, is_subaddress));
|
||||
// add N - 1 outputs for correct initial fee estimation
|
||||
for (size_t i = 0; i < ((outputs > 1) ? outputs - 1 : outputs); ++i)
|
||||
tx.dsts.push_back(tx_destination_entry(1, address, is_subaddress));
|
||||
|
||||
LOG_PRINT_L2("Trying to create a tx now, with " << tx.dsts.size() << " destinations and " <<
|
||||
tx.selected_transfers.size() << " outputs");
|
||||
|
@ -8694,15 +8696,35 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_from(const crypton
|
|||
detail::digit_split_strategy, tx_dust_policy(::config::DEFAULT_DUST_THRESHOLD), test_tx, test_ptx);
|
||||
auto txBlob = t_serializable_object_to_blob(test_ptx.tx);
|
||||
needed_fee = calculate_fee(use_per_byte_fee, test_ptx.tx, txBlob.size(), base_fee, fee_multiplier, fee_quantization_mask);
|
||||
available_for_fee = test_ptx.fee + test_ptx.dests[0].amount + test_ptx.change_dts.amount;
|
||||
available_for_fee = test_ptx.fee + test_ptx.change_dts.amount;
|
||||
for (auto &dt: test_ptx.dests)
|
||||
available_for_fee += dt.amount;
|
||||
LOG_PRINT_L2("Made a " << get_weight_string(test_ptx.tx, txBlob.size()) << " tx, with " << print_money(available_for_fee) << " available for fee (" <<
|
||||
print_money(needed_fee) << " needed)");
|
||||
|
||||
// add last output, missed for fee estimation
|
||||
if (outputs > 1)
|
||||
tx.dsts.push_back(tx_destination_entry(1, address, is_subaddress));
|
||||
|
||||
THROW_WALLET_EXCEPTION_IF(needed_fee > available_for_fee, error::wallet_internal_error, "Transaction cannot pay for itself");
|
||||
|
||||
do {
|
||||
LOG_PRINT_L2("We made a tx, adjusting fee and saving it");
|
||||
tx.dsts[0].amount = available_for_fee - needed_fee;
|
||||
// distribute total transferred amount between outputs
|
||||
uint64_t amount_transferred = available_for_fee - needed_fee;
|
||||
uint64_t dt_amount = amount_transferred / outputs;
|
||||
// residue is distributed as one atomic unit per output until it reaches zero
|
||||
uint64_t residue = amount_transferred % outputs;
|
||||
for (auto &dt: tx.dsts)
|
||||
{
|
||||
uint64_t dt_residue = 0;
|
||||
if (residue > 0)
|
||||
{
|
||||
dt_residue = 1;
|
||||
residue -= 1;
|
||||
}
|
||||
dt.amount = dt_amount + dt_residue;
|
||||
}
|
||||
if (use_rct)
|
||||
transfer_selected_rct(tx.dsts, tx.selected_transfers, fake_outs_count, outs, unlock_time, needed_fee, extra,
|
||||
test_tx, test_ptx, range_proof_type, is_staking_tx);
|
||||
|
@ -8954,7 +8976,7 @@ std::vector<wallet2::pending_tx> wallet2::create_unmixable_sweep_transactions()
|
|||
unmixable_transfer_outputs.push_back(n);
|
||||
}
|
||||
|
||||
return create_transactions_from(m_account_public_address, false, unmixable_transfer_outputs, unmixable_dust_outputs, 0 /*fake_outs_count */, 0 /* unlock_time */, 1 /*priority */, std::vector<uint8_t>());
|
||||
return create_transactions_from(m_account_public_address, false, 1, unmixable_transfer_outputs, unmixable_dust_outputs, 0 /*fake_outs_count */, 0 /* unlock_time */, 1 /*priority */, std::vector<uint8_t>());
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::discard_unmixable_outputs()
|
||||
|
|
|
@ -1103,6 +1103,13 @@ namespace tools
|
|||
return false;
|
||||
}
|
||||
|
||||
if (req.outputs < 1)
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_TX_NOT_POSSIBLE;
|
||||
er.message = "Amount of outputs should be greater than 0.";
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
uint64_t mixin;
|
||||
|
@ -1115,7 +1122,7 @@ namespace tools
|
|||
mixin = m_wallet->adjust_mixin(req.mixin);
|
||||
}
|
||||
uint32_t priority = m_wallet->adjust_priority(req.priority);
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_all(req.below_amount, dsts[0].addr, dsts[0].is_subaddress, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices);
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_all(req.below_amount, dsts[0].addr, dsts[0].is_subaddress, req.outputs, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices);
|
||||
|
||||
return fill_response(ptx_vector, req.get_tx_keys, res.tx_key_list, res.amount_list, res.fee_list, res.multisig_txset, res.unsigned_txset, req.do_not_relay,
|
||||
res.tx_hash_list, req.get_tx_hex, res.tx_blob_list, req.get_tx_metadata, res.tx_metadata_list, er);
|
||||
|
@ -1141,6 +1148,13 @@ namespace tools
|
|||
return false;
|
||||
}
|
||||
|
||||
if (req.outputs < 1)
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_TX_NOT_POSSIBLE;
|
||||
er.message = "Amount of outputs should be greater than 0.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// validate the transfer requested and populate dsts & extra
|
||||
std::list<wallet_rpc::transfer_destination> destination;
|
||||
destination.push_back(wallet_rpc::transfer_destination());
|
||||
|
@ -1171,7 +1185,7 @@ namespace tools
|
|||
mixin = m_wallet->adjust_mixin(req.mixin);
|
||||
}
|
||||
uint32_t priority = m_wallet->adjust_priority(req.priority);
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_single(ki, dsts[0].addr, dsts[0].is_subaddress, mixin, req.unlock_time, priority, extra);
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_single(ki, dsts[0].addr, dsts[0].is_subaddress, req.outputs, mixin, req.unlock_time, priority, extra);
|
||||
|
||||
if (ptx_vector.empty())
|
||||
{
|
||||
|
|
|
@ -640,6 +640,7 @@ namespace wallet_rpc
|
|||
uint32_t priority;
|
||||
uint64_t mixin;
|
||||
uint64_t ring_size;
|
||||
uint64_t outputs;
|
||||
uint64_t unlock_time;
|
||||
std::string payment_id;
|
||||
bool get_tx_keys;
|
||||
|
@ -655,6 +656,7 @@ namespace wallet_rpc
|
|||
KV_SERIALIZE(priority)
|
||||
KV_SERIALIZE_OPT(mixin, (uint64_t)0)
|
||||
KV_SERIALIZE_OPT(ring_size, (uint64_t)0)
|
||||
KV_SERIALIZE_OPT(outputs, (uint64_t)1)
|
||||
KV_SERIALIZE(unlock_time)
|
||||
KV_SERIALIZE(payment_id)
|
||||
KV_SERIALIZE(get_tx_keys)
|
||||
|
@ -706,6 +708,7 @@ namespace wallet_rpc
|
|||
uint32_t priority;
|
||||
uint64_t mixin;
|
||||
uint64_t ring_size;
|
||||
uint64_t outputs;
|
||||
uint64_t unlock_time;
|
||||
std::string payment_id;
|
||||
bool get_tx_key;
|
||||
|
@ -719,6 +722,7 @@ namespace wallet_rpc
|
|||
KV_SERIALIZE(priority)
|
||||
KV_SERIALIZE_OPT(mixin, (uint64_t)0)
|
||||
KV_SERIALIZE_OPT(ring_size, (uint64_t)0)
|
||||
KV_SERIALIZE_OPT(outputs, (uint64_t)1)
|
||||
KV_SERIALIZE(unlock_time)
|
||||
KV_SERIALIZE(payment_id)
|
||||
KV_SERIALIZE(get_tx_key)
|
||||
|
|
Loading…
Reference in New Issue