mirror of
https://github.com/monero-project/monero.git
synced 2025-08-16 05:00:33 -04:00
Enforce Tx unlock_time is Zero by Relay Rule [RELEASE]
Related to https://github.com/monero-project/research-lab/issues/78 Added a relay rule that enforces the `unlock_time` field is equal to 0 for non-coinbase transactions. UIs changed: * Removed `locked_transfer` and `locked_sweep_all` commands from `monero-wallet-cli` APIs changed: * Removed `unlock_time` parameters from `wallet2` transfer methods * Wallet RPC transfer endpoints send error codes when requested unlock time is not 0 * Removed `unlock_time` parameters from `construct_tx*` cryptonote core functions @tobtoht: undo rebase changes tx.dsts -> tx_dsts
This commit is contained in:
parent
81d4db08eb
commit
dd47d03cf2
38 changed files with 186 additions and 230 deletions
|
@ -1080,6 +1080,12 @@ namespace tools
|
|||
er.message = "Command unavailable in restricted mode.";
|
||||
return false;
|
||||
}
|
||||
else if (req.unlock_time)
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_NONZERO_UNLOCK_TIME;
|
||||
er.message = "Transaction cannot have non-zero unlock time";
|
||||
return false;
|
||||
}
|
||||
|
||||
CHECK_MULTISIG_ENABLED();
|
||||
|
||||
|
@ -1093,7 +1099,7 @@ namespace tools
|
|||
{
|
||||
uint64_t mixin = m_wallet->adjust_mixin(req.ring_size ? req.ring_size - 1 : 0);
|
||||
uint32_t priority = m_wallet->adjust_priority(req.priority);
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_2(dsts, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices, req.subtract_fee_from_outputs);
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_2(dsts, mixin, priority, extra, req.account_index, req.subaddr_indices, req.subtract_fee_from_outputs);
|
||||
|
||||
if (ptx_vector.empty())
|
||||
{
|
||||
|
@ -1134,6 +1140,12 @@ namespace tools
|
|||
er.message = "Command unavailable in restricted mode.";
|
||||
return false;
|
||||
}
|
||||
else if (req.unlock_time)
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_NONZERO_UNLOCK_TIME;
|
||||
er.message = "Transaction cannot have non-zero unlock time";
|
||||
return false;
|
||||
}
|
||||
|
||||
CHECK_MULTISIG_ENABLED();
|
||||
|
||||
|
@ -1148,7 +1160,7 @@ namespace tools
|
|||
uint64_t mixin = m_wallet->adjust_mixin(req.ring_size ? req.ring_size - 1 : 0);
|
||||
uint32_t priority = m_wallet->adjust_priority(req.priority);
|
||||
LOG_PRINT_L2("on_transfer_split calling create_transactions_2");
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_2(dsts, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices);
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_2(dsts, mixin, priority, extra, req.account_index, req.subaddr_indices);
|
||||
LOG_PRINT_L2("on_transfer_split called create_transactions_2");
|
||||
|
||||
if (ptx_vector.empty())
|
||||
|
@ -1570,6 +1582,12 @@ namespace tools
|
|||
er.message = "Command unavailable in restricted mode.";
|
||||
return false;
|
||||
}
|
||||
else if (req.unlock_time)
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_NONZERO_UNLOCK_TIME;
|
||||
er.message = "Transaction cannot have non-zero unlock time";
|
||||
return false;
|
||||
}
|
||||
|
||||
CHECK_MULTISIG_ENABLED();
|
||||
|
||||
|
@ -1605,7 +1623,7 @@ namespace tools
|
|||
{
|
||||
uint64_t mixin = m_wallet->adjust_mixin(req.ring_size ? req.ring_size - 1 : 0);
|
||||
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, req.outputs, mixin, req.unlock_time, priority, extra, req.account_index, 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, priority, extra, req.account_index, subaddr_indices);
|
||||
|
||||
return fill_response(ptx_vector, req.get_tx_keys, res.tx_key_list, res.amount_list, res.amounts_by_dest_list, res.fee_list, res.weight_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, res.spent_key_images_list, er);
|
||||
|
@ -1630,6 +1648,12 @@ namespace tools
|
|||
er.message = "Command unavailable in restricted mode.";
|
||||
return false;
|
||||
}
|
||||
else if (req.unlock_time)
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_NONZERO_UNLOCK_TIME;
|
||||
er.message = "Transaction cannot have non-zero unlock time";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (req.outputs < 1)
|
||||
{
|
||||
|
@ -1662,7 +1686,7 @@ namespace tools
|
|||
{
|
||||
uint64_t mixin = m_wallet->adjust_mixin(req.ring_size ? req.ring_size - 1 : 0);
|
||||
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, req.outputs, 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, priority, extra);
|
||||
|
||||
if (ptx_vector.empty())
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue