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:
jeffro256
2024-02-03 21:59:58 -06:00
parent 81d4db08eb
commit dd47d03cf2
38 changed files with 186 additions and 230 deletions

View File

@@ -1340,6 +1340,8 @@ namespace cryptonote
add_reason(reason, "too few outputs");
if ((res.tx_extra_too_big = tvc.m_tx_extra_too_big))
add_reason(reason, "tx-extra too big");
if ((res.nonzero_unlock_time = tvc.m_nonzero_unlock_time))
add_reason(reason, "tx unlock time is not zero");
const std::string punctuation = reason.empty() ? "" : ": ";
if (tvc.m_verifivation_failed)
{

View File

@@ -88,7 +88,7 @@ namespace cryptonote
// advance which version they will stop working with
// Don't go over 32767 for any of these
#define CORE_RPC_VERSION_MAJOR 3
#define CORE_RPC_VERSION_MINOR 13
#define CORE_RPC_VERSION_MINOR 14
#define MAKE_CORE_RPC_VERSION(major,minor) (((major)<<16)|(minor))
#define CORE_RPC_VERSION MAKE_CORE_RPC_VERSION(CORE_RPC_VERSION_MAJOR, CORE_RPC_VERSION_MINOR)
@@ -640,6 +640,7 @@ namespace cryptonote
bool too_few_outputs;
bool sanity_check_failed;
bool tx_extra_too_big;
bool nonzero_unlock_time;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE_PARENT(rpc_access_response_base)
@@ -655,6 +656,7 @@ namespace cryptonote
KV_SERIALIZE(too_few_outputs)
KV_SERIALIZE(sanity_check_failed)
KV_SERIALIZE(tx_extra_too_big)
KV_SERIALIZE(nonzero_unlock_time)
END_KV_SERIALIZE_MAP()
};
typedef epee::misc_utils::struct_init<response_t> response;

View File

@@ -422,6 +422,16 @@ namespace rpc
if (!res.error_details.empty()) res.error_details += " and ";
res.error_details += "too few outputs";
}
if (tvc.m_tx_extra_too_big)
{
if (!res.error_details.empty()) res.error_details += " and ";
res.error_details += "tx_extra too long";
}
if (tvc.m_nonzero_unlock_time)
{
if (!res.error_details.empty()) res.error_details += " and ";
res.error_details += "non-zero unlock time";
}
if (res.error_details.empty())
{
res.error_details = "an unknown issue was found with the transaction";