Commit Graph

810 Commits

Author SHA1 Message Date
Jason Rhinelander 53d94bc8b1
Tweaks to default inactivity timeout behaviour (#1211)
The new (from Monero) cli wallet timeout has been annoying me constantly
when testing things.  This tweaks the timeouts to be far less annoying:

- increase default inactivity timeout to 10 minutes for new and
  upgrading mainnet wallets.  90 seconds is annoyingly short.
- Disable (by default) inactivity timeout for non-mainnet wallets.
- switch wallet2 timeout variables to use chrono types
2020-08-03 10:03:54 +10:00
Jason Rhinelander 9931230332 DRY transaction fetching
wallet2 does nearly identical tx fetching in several places; this DRYs
out the code a bit.
2020-07-22 16:54:13 -03:00
Jason Rhinelander d800a0acb4 Reduce ridiculous rpc timeout
3 minutes and 30 seconds is an insane amount of time to wait on an RPC
request.  Reduce it to 30 seconds (which is still high, but not quite so
insane).
2020-07-22 16:54:13 -03:00
Jason Rhinelander bc3a51e639 Remove redundant rpc invocation arguments
Replace invoke_http_{bin,json,json_rpc} with a invoke_http<T>, where T
is the RPC type from which we can figure out binary or JSON or JSON RPC
or light wallet RPC, and thus figure out the URL.

Also remove superfluous arguments: neither timeout or http_method
arguments ever actually differ, so just eliminate them.
2020-07-21 21:53:27 -03:00
Jason Rhinelander f09857de2b More string_view (mostly in wallet code)
This started out with a few string_view simplifications, but unwinding
the string_view calls resulted in quite a few changes.

- use constexpr string_view instead of macros for constants

- use constexpr ints for other macros instead of constants (to be
consistent with the string_view constexprs); also eliminated a couple of
unused variables.

- convert amount parsing to string_view, and rewrite it with comments to
be far less confusing.  (Previously it was remove a "." from a string,
chopping 0s off the end then putting them back on which was hard to
follow).

- fixed some not-quite-right amount parsing unit tests

- replace a bunch of string code (including lots of code allocating new
strings with .substr on a string) with std::string_view.

- avoid using C functions for strings

- convert epee http uri conversion methods to string_view (and fix one
typoed func name "conver" -> "convert")

- Add a `tools::hex_to_type` that converts hex directly into a (simple)
type, with hex and length verification for the type, and use it to
eliminate a bunch of intermediate std::string conversions.

- Convert a bunch of error-prone raw pointer string appends into
more type-safe `tools::view_guts(val)` calls.  (In particular view_guts
always gets the sizeof() correct, while the individual call could easily
put the wrong type in the `sizeof()`).
2020-07-02 12:55:28 -03:00
Jason Rhinelander 89afcad468 Post-merge: locks/mutexes
Replaces boost mutexes/locks added upstream with std::equivalents.
2020-07-02 12:52:13 -03:00
Jason Rhinelander 778cb89620 Post-merge updates: std::optional 2020-07-02 12:52:13 -03:00
Jason Rhinelander 49c693d0a9 Split up common/util.h
common/util.h has become something of a dumping ground of random
functions.  This splits them up a little by moving the filesystem bits
to common/file.h, the sha256sum functions to common/sha256sum.h, and the
(singleton) signal handler to common/signal_handler.h.
2020-07-02 12:52:12 -03:00
Jason Rhinelander b4cbd4af8d String handling improvements
Add number parsing and basic string splitting to common/string_util.h
and use it (replacing some regexes and boost string utilities).

Includes unit tests.
2020-07-02 12:52:12 -03:00
Jason Rhinelander e7d056edf1 boost::variant -> std::variant
A huge amount of this is repetitive:

- `boost::get<T>(variant)` becomes `std::get<T>(variant)`
- `boost::get<T>(variant_ptr)` becomes `std::get_if<T>(variant_ptr)`
- `variant.type() == typeid(T)` becomes `std::holds_alternative<T>(variant)`

There are also some simplifications to visitors using simpler stl
visitors, or (simpler still) generic lambdas as visitors.

Also adds boost serialization serializers for std::variant and
std::optional.
2020-07-02 12:52:12 -03:00
Jason Rhinelander e02545ca4b boost->std: mutex, locks; C++17 lock vars
Changes all boost mutexes, locks, and condition_variables to their stl
equivalents.

Changes all lock_guard/unique_lock/shared_lock to not specify the mutex
type (C++17), e.g.

    std::lock_guard foo{mutex};

instead of

    std::lock_guard<oh::um::what::mutex> foo{mutex};

Also changes some related boost::thread calls to std::thread, and some
related boost chrono calls to stl chrono.

boost::thread isn't changed here to std::thread because some of the
instances rely on some boost thread extensions.
2020-07-02 12:52:12 -03:00
Jason Rhinelander 96354a0e0f boost::optional -> std::optional 2020-07-02 12:52:12 -03:00
Jason Rhinelander b9448febdf Replace boost::string_ref with std::string_view
Also a few related small places in here where a `const std::string&`
made mode sense to be a std::string_view.
2020-07-02 12:52:12 -03:00
Jason Rhinelander b7f50d01e8 Removed unused decomposition functions
These functions were for ancient Monero and have never applied to (and
in fact are not called at all in) Loki.
2020-07-02 12:52:12 -03:00
Doyle 00e090b7c8 sweep_all: Undo adding fractional output ignoring for sweep_all
sweep_all should, sweep_all the balance.
2020-06-05 15:14:44 +10:00
Doyle 906637bdfe Merge commit '7a8c1eece9b6dcb52109dc7c8b4518e0c7439a5b' into MergeUpstream3 2020-05-29 14:24:09 +10:00
Doyle dd638b133d Merge commit '8b655de' into MergeUpstream3 2020-05-29 14:06:27 +10:00
Doyle 67727ab6a7 Merge commit 'ac9f7c9' into MergeUpstream3 2020-05-29 13:47:02 +10:00
Doyle a8abb83b7d Merge commit '2d729fb' into MergeUpstream3 2020-05-28 16:56:01 +10:00
Doyle ebdb4f7965 Merge commit '1df79ae3aae0180d09f4bb9fa19d61a38ac28278' into MergeUpstream3 2020-05-28 12:57:03 +10:00
Doyle 6d69969099 Merge commit '8cb005b39c3def6ae8cd70a29825cb62f3b6b346' into MergeUpstream3 2020-05-28 12:49:24 +10:00
Doyle 5323836f09 Merge commit 'd500bbe68f7d35e22eb331f3a17b0c64ce65f612' into MergeUpstream3 2020-05-28 12:04:00 +10:00
Doyle be454eb731 Merge commit '4764d18eebddee108c3f79c96cce959d8f666bed' into MergeUpstream3 2020-05-28 11:29:54 +10:00
Doyle 7c07a3e8f3 Merge commit '8136bf37e2c0a76851c0bb6482b6e4c2b653f5d7' into MergeUpstream3 2020-05-27 15:40:27 +10:00
Doyle 47807cefec Merge commit 'a26e5b3' into MergeUpstream3 2020-05-27 15:24:18 +10:00
Doyle f2f48f8815 Merge commit 'b4e1dc83d275f8ee9a8c12615cf952f05161c7a3' into MergeUpstream3 2020-05-27 14:25:14 +10:00
Doyle 2e42202e94 Merge commit 'dcff02e4c3b1214143b19685361c3c6cffa62be7' into MergeUpstream3 2020-05-26 15:15:25 +10:00
Doyle d799af317d Merge commit '441ed9f2fef6a43708c115191c51ca16930ce95b' into MergeUpstream3 2020-05-25 10:36:27 +10:00
Doyle 7e3517934c Merge commit '965adff' into MergeUpstream3 2020-05-22 14:48:03 +10:00
Doyle 0c3e3db2eb Merge commit 'a1736a94298fefb3c33adbf22e9333ced55c15bd' into MergeUpstream3 2020-05-22 10:44:14 +10:00
Doyle 371d8b68d9 Merge commit '85962ee8e21c145d67dd249c5df250be8b3ab75d' into MergeUpstream3 2020-05-21 16:11:23 +10:00
Doyle 69a3dd1a93 Merge commit 'b52620800100063ffac771e98101ae10fb5a3fbd' into MergeUpstream3 2020-05-21 15:45:45 +10:00
Doyle 903e80cb65 Merge commit '2ec455df1f82148733c4ac268d22e9c51a690b14' into MergeUpstream3 2020-05-21 14:29:44 +10:00
Doyle 6a357fa499 Merge commit '23547e6ed6c9f0dc694d55316540000b030bbb06' into MergeUpstream3 2020-05-20 18:14:48 +10:00
Doyle fdd624406b Merge commit '63186a01ce1603c65771a3ef91f29f3e91679d42' into MergeUpstream3 2020-05-18 16:09:23 +10:00
Doyle bde36f0918 Merge branch 'master' into MergeMasterToDev 2020-05-15 13:46:28 +10:00
Jason Rhinelander 0e3f173c7f RPC overhaul
High-level details:

This redesigns the RPC layer to make it much easier to work with,
decouples it from an embedded HTTP server, and gets the vast majority of
the RPC serialization and dispatch code out of a very commonly included
header.

There is unfortunately rather a lot of interconnected code here that
cannot be easily separated out into separate commits.  The full details
of what happens here are as follows:

Major details:
- All of the RPC code is now in a `cryptonote::rpc` namespace; this
  renames quite a bit to be less verbose: e.g. CORE_RPC_STATUS_OK
  becomes `rpc::STATUS_OK`, and `cryptonote::COMMAND_RPC_SOME_LONG_NAME`
  becomes `rpc::SOME_LONG_NAME` (or just SOME_LONG_NAME for code already
  working in the `rpc` namespace).
- `core_rpc_server` is now completely decoupled from providing any
  request protocol: it is now *just* the core RPC call handler.
- The HTTP RPC interface now lives in a new rpc/http_server.h; this code
  handles listening for HTTP requests and dispatching them to
  core_rpc_server, then sending the results back to the caller.
- There is similarly a rpc/lmq_server.h for LMQ RPC code; more details
  on this (and other LMQ specifics) below.
- RPC implementing code now returns the response object and throws when
  things go wrong which simplifies much of the rpc error handling.  They
  can throw anything; generic exceptions get logged and a generic
  "internal error" message gets returned to the caller, but there is
  also an `rpc_error` class to return an error code and message used by
  some json-rpc commands.
- RPC implementing functions now overload `core_rpc_server::invoke`
  following the pattern:

    RPC_BLAH_BLAH::response core_rpc_server::invoke(RPC_BLAH_BLAH::request&& req, rpc_context context);

  This overloading makes the code vastly simpler: all instantiations are
  now done with a small amount of generic instantiation code in a single
  .cpp rather than needing to go to hell and back with a nest of epee
  macros in a core header.
- each RPC endpoint is now defined by the RPC types themselves,
  including its accessible names and permissions, in
  core_rpc_server_commands_defs.h:
  - every RPC structure now has a static `names()` function that returns
    the names by which the end point is accessible.  (The first one is
    the primary, the others are for deprecated aliases).
  - RPC command wrappers define their permissions and type by inheriting
    from special tag classes:
    - rpc::RPC_COMMAND is a basic, admin-only, JSON command, available
      via JSON RPC.  *All* JSON commands are now available via JSON RPC,
      instead of the previous mix of some being at /foo and others at
      /json_rpc.  (Ones that were previously at /foo are still there for
      backwards compatibility; see `rpc::LEGACY` below).
    - rpc::PUBLIC specifies that the command should be available via a
      restricted RPC connection.
    - rpc::BINARY specifies that the command is not JSON, but rather is
      accessible as /name and takes and returns values in the magic epee
      binary "portable storage" (lol) data format.
    - rpc::LEGACY specifies that the command should be available via the
      non-json-rpc interface at `/name` for backwards compatibility (in
      addition to the JSON-RPC interface).
- some epee serialization got unwrapped and de-templatized so that it
  can be moved into a .cpp file with just declarations in the .h.  (This
  makes a *huge* difference for core_rpc_server_commands_defs.h and for
  every compilation unit that includes it which previously had to
  compile all the serialization code and then throw all by one copy away
  at link time).  This required some new macros so as to not break a ton
  of places that will use the old way putting everything in the headers;
  The RPC code uses this as does a few other places; there are comments
  in contrib/epee/include/serialization/keyvalue_serialization.h as to
  how to use it.
- Detemplatized a bunch of epee/storages code.  Most of it should have
  have been using templates at all (because it can only ever be called
  with one type!), and now it isn't.  This broke some things that didn't
  properly compile because of missing headers or (in one case) a messed
  up circular dependency.
- Significantly simplified a bunch of over-templatized serialization
  code.
- All RPC serialization definitions is now out of
  core_rpc_server_commands_defs.h and into a single .cpp file
  (core_rpc_server_commands_defs.cpp).
- core RPC no longer uses the disgusting
  BEGIN_URI_MAP2/MAP_URI_BLAH_BLAH macros.  This was a terrible design
  that forced slamming tons of code into a common header that didn't
  need to be there.
- epee::struct_init is gone.  It was a horrible hack that instiated
  multiple templates just so the coder could be so lazy and write
  `some_type var;` instead of properly value initializing with
  `some_type var{};`.
- Removed a bunch of useless crap from epee.  In particular, forcing
  extra template instantiations all over the place in order to nest
  return objects inside JSON RPC values is no longer needed, as are a
  bunch of stuff related to the above de-macroization of the code.
- get_all_service_nodes, get_service_nodes, and get_n_service_nodes are
  now combined into a single `get_service_nodes` (with deprecated
  aliases for the others), which eliminates a fair amount of
  duplication.  The biggest obstacle here was getting the requested
  fields reference passed through: this is now done by a new ability to
  stash a context in the serialization object that can be retrieved by a
  sub-serialized type.

LMQ-specifics:

- The LokiMQ instance moves into `cryptonote::core` rather than being
  inside cryptonote_protocol.  Currently the instance is used both for
  qnet and rpc calls (and so needs to be in a common place), but I also
  intend future PRs to use the batching code for job processing
  (replacing the current threaded job queue).
- rpc/lmq_server.h handles the actual LMQ-request-to-core-RPC glue.
  Unlike http_server it isn't technically running the whole LMQ stack
  from here, but the parallel name with http_server seemed appropriate.
- All RPC endpoints are supported by LMQ under the same names as defined
  generically, but prefixed with `rpc.` for public commands and `admin.`
  for restricted ones.
- service node keys are now always available, even when not running in
  `--service-node` mode: this is because we want the x25519 key for
  being able to offer CURVE encryption for lmq RPC end-points, and
  because it doesn't hurt to have them available all the time.  In the
  RPC layer this is now called "get_service_keys" (with
  "get_service_node_key" as an alias) since they aren't strictly only
  for service nodes.  This also means code needs to check
  m_service_node, and not m_service_node_keys, to tell if it is running
  as a service node.  (This is also easier to notice because
  m_service_node_keys got renamed to `m_service_keys`).
- Added block and mempool monitoring LMQ RPC endpoints: `sub.block` and
  `sub.mempool` subscribes the connection for new block and new mempool
  TX notifications.  The latter can notify on just blink txes, or all
  new mempool txes (but only new ones -- txes dumped from a block don't
  trigger it).  The client gets pushed a [`notify.block`, `height`,
  `hash`] or [`notify.tx`, `txhash`, `blob`] message when something
  arrives.

Minor details:
- rpc::version_t is now a {major,minor} pair.  Forcing everyone to pack
  and unpack a uint32_t was gross.
- Changed some macros to constexprs (e.g. CORE_RPC_ERROR_CODE_...).
  (This immediately revealed a couple of bugs in the RPC code that was
  assigning CORE_RPC_ERROR_CODE_... to a string, and it worked because
  the macro allows implicit conversion to a char).
- De-templatizing useless templates in epee (i.e. a bunch of templated
  types that were never invoked with different types) revealed a painful
  circular dependency between epee and non-epee code for tor_address and
  i2p_address.  This crap is now handled in a suitably named
  `net/epee_network_address_hack.cpp` hack because it really isn't
  trivial to extricate this mess.
- Removed `epee/include/serialization/serialize_base.h`.  Amazingly the
  code somehow still all works perfectly with this previously vital
  header removed.
- Removed bitrotted, unused epee "crypted_storage" and
  "gzipped_inmemstorage" code.
- Replaced a bunch of epee::misc_utils::auto_scope_leave_caller with
  LOKI_DEFERs.  The epee version involves quite a bit more instantiation
  and is ugly as sin.  Also made the `loki::defer` class invokable for
  some edge cases that need calling before destruction in particular
  conditions.
- Moved the systemd code around; it makes much more sense to do the
  systemd started notification as in daemon.cpp as late as possible
  rather than in core (when we can still have startup failures, e.g. if
  the RPC layer can't start).
- Made the systemd short status string available in the get_info RPC
  (and no longer require building with systemd).
- during startup, print (only) the x25519 when not in SN mode, and
  continue to print all three when in SN mode.
- DRYed out some RPC implementation code (such as set_limit)
- Made wallet_rpc stop using a raw m_wallet pointer
2020-05-11 18:44:45 -03:00
Jason Rhinelander 5fd8939c6a Remove background mining
This was a useless feature to begin with.  According to a Monero
insider, this was introduced at the time with an intention of making it
on-by-default on every monerod instance everywhere, but because that was
such an overwhelmingly stupid idea, it never happened yet all this code
(which is probably used by no one anywhere ever) remains in the code
base.

Even if the idea wasn't dumb to start with, this will also become even
more pointless with pulse, so just drop it (it is over 1000 lines of
code, not even counting the extra headers pulled in to do things like
querying CPU usage and battery status).
2020-05-11 18:44:45 -03:00
luigi1111 c9b800a787
Merge pull request #6446
e509ede trezor: adapt to new passphrase mechanism (ph4r05)
2020-05-01 15:32:52 -05:00
moneromooo-monero 7a8c1eece9
wallet2: fix subaddress expansion when receiving monero 2020-04-27 16:48:19 +00:00
Dusan Klinec e509ede2aa
trezor: adapt to new passphrase mechanism
- choice where to enter passphrase is now made on the host
- use wipeable string in the comm stack
- wipe passphrase memory
- protocol optimizations, prepare for new firmware version
- minor fixes and improvements
- tests fixes, HF12 support
2020-04-27 18:17:56 +02:00
Doyle ee44c01c69
Merge pull request #1119 from Doy-lee/MergeUpstream
Merge upstream changes (~130 commits)
2020-04-24 14:09:22 +10:00
Doyle 24ebce22a9
Merge pull request #1103 from Doy-lee/SNClientSignatureCheck
SN: Client side check signature
2020-04-24 13:40:03 +10:00
Doyle 1d8adbb555 Writeup how key image exporting/importing works
Remove some ambigious overloads for clarity and make it less annoying to
understand.
2020-04-24 12:13:58 +10:00
Doyle ff2949934d SN: Move signature validating code to function and use in wallet2 & sn 2020-04-24 11:46:38 +10:00
Doyle f218d6cf45 Allow filter show_transfers by multiple arguments
- Allow show_transfers to filter by stake
- Allow combining show_transfer arguments to get a composition of
arguments specifying transfer type
- Transfer type arguments in RPC call are defaulted to true
2020-04-23 16:52:08 +10:00
Doyle f3767a5d7e Classify staking transactions in show/export_transfers 2020-04-23 16:50:25 +10:00
moneromooo-monero 8b655de8ed
simplewallet: report timestamp based expected unlock time on balance 2020-04-22 13:34:58 +00:00
Doyle ba7faacab9
Handle long poll shutdown properly (#1136)
Wait for thread to end before terminating wallet_rpc

- In RPC wallet, we need to track long polling shutting down separately
from the wallet as the RPC wallet can start up without instantiating
a wallet2 instance. If this is the case, shutting down the RPC wallet
will hang the long polling thread as the terminating variable can never
be retrieved from wallet2.

- Simplify RAII of the long polling thread by putting it into the
simple_wallet destructor

- Fix long poll thread constantly resetting the host. set_server() was
currently parsing host = "localhost:38157" such that get_host()
= "localhost" and port() = 38157 so that host != get_host().
2020-04-22 16:50:08 +10:00
Sean 385d8cf104
Updates the formatting for buying and updating LNS mappings (#1110)
* Updates the formatting for buying and updating LNS mappings

Previously there was no detail on the inputted information to the LNS
commands for buy and update. This commit outputs the information to the
command line for the user to review.

* Update command now queries previous LNS data

* Remove comments

* check for null on response pointer

* update if path

* Fix up scope of response
2020-04-16 16:07:13 +10:00
woodser 87d75584e8 Allow wallet2.h to run in WebAssembly
- Add abstract_http_client.h which http_client.h extends.
- Replace simple_http_client with abstract_http_client in wallet2,
message_store, message_transporter, and node_rpc_proxy.
- Import and export wallet data in wallet2.
- Use #if defined __EMSCRIPTEN__ directives to skip incompatible code.
2020-04-15 13:22:46 -04:00
luigi1111 bce050ee78
Merge pull request #6394
69b5992 simplewallet: new 'address one-off <major> <minor>' command (moneromooo-monero)
2020-04-10 16:06:10 -05:00
Doyle c43dd20b3e Merge commit 'dd58057126be2232f2ab59b1b4c18c956ceb20e9' into MergeUpstream 2020-04-09 16:32:22 +10:00
Doyle 66790db9e5 Merge commit '8774555d29a3594d430d1bc7c744ca904f38b389' into MergeUpstream 2020-04-09 16:19:40 +10:00
Doyle eb5e7207dc Merge commit 'bc94ba4d1421b061e12eb187f553250223a1ff8d' into MergeUpstream 2020-04-09 15:32:16 +10:00
moneromooo-monero 69b5992296
simplewallet: new "address one-off <major> <minor>" command 2020-04-07 16:25:01 +00:00
luigi1111 d0065f3063
Merge pull request #6302
dab604e wallet2_api: implement estimateTransactionFee (xiphon)
2020-03-31 15:12:48 -05:00
Alexander Blair 72262b348a
Merge pull request #6299
9c1f970b wallet2: remember daemon address overrides when loading a new wallet (moneromooo-monero)
2020-03-27 12:33:15 -07:00
Alexander Blair 8cb005b39c
Merge pull request #6289
ffe7165e wallet: reroll fake outs selection on local tx_sanity_check failure (xiphon)
2020-03-27 12:28:29 -07:00
Doyle 28cecfe558 LNS: Serialize owner if not specified, use subaddress keys if possible
- Also fix a subtle bug that use to always default a the wallet's spend
key in update mappings even if no owner or backup owner was specified
for update.
2020-03-16 09:34:59 +11:00
Doyle 0112974dda LNS: Store wallet addresses to DB
- Renames generic_key->generic_owner
- Move generic_owner and generic_signature out of crypto.h because they
aren't really crypto items, rather composition of crypto primitives.
generic_owner also needs access to account_public_address, while that is
just 2 public keys, I've decided to include cryptonote_basic.h into
tx_extra.h instead of crypto.h.
- Some generic_owner helper functions were moved into
cryptonote_basic/format_utils as they need to avoid circular
dependencies between cryptonote_core/cryptonote_basic had I included
generic_owner/generic_signature into loki_name_system.h
- Utilise the normal serialize macros since tx_extra.h already includes
the serializing headers.
2020-03-13 16:07:14 +11:00
Doyle 22e51bca1c LNS: Lowercase names at the boundary between LNS and user code 2020-03-13 13:46:45 +11:00
Alexander Blair d500bbe68f
Merge pull request #6268
a6c24412 wallet: fix exceptions getting the hash of a pruned tx (moneromooo-monero)
2020-03-12 01:02:31 -07:00
Doyle d54f117469 Owner is optional, if not specified it will use the current wallet 2020-03-11 10:58:05 +11:00
Doyle 1bff385cac Add support for backup owners and allow updating LNS fields 2020-03-11 10:58:05 +11:00
Doyle 68782a76df Add standalone LNS signature generator for CLI/RPC wallet 2020-03-11 10:58:05 +11:00
Doyle 5dd5723332 Prefix LNS commands with lns, instead of <verb> lns <action> 2020-03-11 10:58:05 +11:00
Doyle 9071ecbc92 Make LNS take generic keys/sigs where it can for owner keys 2020-03-11 10:58:05 +11:00
moneromooo-monero 9c1f970b82
wallet2: remember daemon address overrides when loading a new wallet 2020-03-07 18:09:31 +00:00
Alexander Blair da617ac1b0
Merge pull request #6238
f717d593 wallet2: guard against race with multiple decrypt_keys users (moneromooo-monero)
2020-02-28 20:21:06 -08:00
Doyle cbc0740f43 LNS: Allow multi-year registration for lokinet entries 2020-02-25 12:56:42 +11:00
Doyle 02a1f0741a
Merge pull request #1044 from Doy-lee/LokiNameServiceUpdateTX
Loki Name Service - Update Mappings TX
2020-02-21 11:06:01 +11:00
luigi1111 22a0367398
Merge pull request #6190
096a9db Wallet: Distingush amounts for a single subaddress (tmoravec)
2020-02-19 22:22:36 -05:00
Doyle 1197ae9635 Add RPC calls for updating lns tx 2020-02-20 10:08:38 +11:00
Doyle 2ee128c47a Use enum_field for type to use lns::mapping_type 2020-02-20 09:34:25 +11:00
Doyle 523635db0b Generate a proper hash for signatures to prevent LNS update replays 2020-02-20 09:34:25 +11:00
Doyle f47efd713a Introduce LNS update transaction to update the underlying value mapping 2020-02-20 09:34:25 +11:00
Jason Rhinelander 0b0e909d8f Lower blink fees, remove higher priorities and backlog checking
This reduces blink fees by half (from 5x to 2.5x base fee) at HF15, and
makes anything other than "unimportant" priority map to blink for
ordinary transactions.

For non-blink txes priorities are still accepted (so that, if the
mempool is clogged, you can still get a registration or stake through by
upping the priority).

It also updates the wallets default priority for transactions to blink
(that is, "default" now becomes blink).

With the priorities gone and default set to blink, the backlog-checking
code and automatic priority bumping code don't serve any useful purpose,
so this rips them out, along with a few other related code
simplifications.
2020-02-19 12:52:28 -04:00
Jason Rhinelander d1a67b4497 Remove confirm-missing-payment-id option
This has been deprecated for a while and it's time to kill the warning
option off (and the associated code).
2020-02-19 12:52:28 -04:00
Jason Rhinelander 1f3d50b425 Remove wallet mixin code
Since you can't change it there's no point in having a default, or in
worrying about "adjusting" the passed in value.
2020-02-19 12:52:28 -04:00
Doyle e3a6f20f85 Code review
- constexpr functions in common/loki.h for inlining
- move hex functions out from common/loki.h to common/hex.h
- use and apply prev_txid on LNS TX's to all LNS types (for updating in the future)
- add lns burn type, for custom burn amounts
- accept and validate lokinet addresses via base32z
- return lokinet addresses in RPC LNS calls via base32z
- updated Messenger references to Session
- update documentation to note that only Session LNS entries are allowed currently
- remove raw c-string interface from LNS db
- update multi-SQL queries into single SQL queries
- remove tx estimation backlog in anticipation for 2 priorities only, blink + unimportant
2020-02-13 11:07:47 +11:00
Doyle a531f3fb90 Remove and undo some changes for github diffs 2020-02-13 11:07:46 +11:00
Doyle 658db0c3f1 Add query LNS mappings to the CLI wallet 2020-02-13 11:07:46 +11:00
Doyle 0b3df6c5ad Remove owner signature from loki name service tx extra
We want to allow people to buy LNS entries on behalf of other users. If
this is the case we don't need signatures to verify that the purchaser
knows the secret key. What we actually want in this scenario is that,
there's a LNS entry, and people can voluntarily pay to renew/buy that.
2020-02-13 11:07:46 +11:00
Doyle f17ed52182 Add buy lns rpc wallet, and wallet cli commands 2020-02-13 11:07:46 +11:00
Doyle c19dad418b Formatting: loki_name_system_db -> loki_name_system, cold_sign_tx arg const 2020-02-13 11:07:46 +11:00
Doyle e71962f3dc Remove block indirection in chain gen, support null lns_db for tests 2020-02-13 11:07:46 +11:00
Doyle dc69d237e6 Add support for Loki Name Service on the backend 2020-02-13 11:07:46 +11:00
Doyle e1893a1513 Distinguish staking transactions and revamp construct_tx 2020-02-13 11:07:46 +11:00
Alexander Blair 3b224bb99d
Merge pull request #6069
d64e5aa7 wallet: allow message sign/verify for subaddresses (moneromooo-monero)
2020-02-06 00:29:32 -08:00
moneromooo-monero dd8c6b1703
wallet: do not split integrated addresses in address book api 2020-01-26 00:03:53 +00:00
xiphon dab604e010 wallet2_api: implement estimateTransactionFee 2020-01-25 05:34:51 +00:00
Jason Rhinelander 7017d0edd4 Don't use pool tx list from long polling
This fixes two issues: first when running with --disable-rpc-long-poll
the long poll isn't present, so the list of pool txes will always be
empty, which means unconfirmed_txs will get cleared on refresh because
they don't appear to be in the node's pool.  This makes us likely to
wind up with double spending failures on subsequent txes since we don't
know about the outgoing unconfirmed_tx anymore.

Secondly, it seems like there's a potential race condition here even
when long polling is enabled that can cause the same failure depending
on the timing of polling in the long poll thread (for example, if it
hits the 30s cooldown from a MAX_CONNECTIONS response), so just fixing
this for the no-long-polling case doesn't seem sufficient.

The previous (< v6.1.1) code didn't have this issue because the tx
construction and refreshing new pool data were synchronous.  (There is a
potential race condition if refresh requests span the node finding a new
block between the block refresh and the pool tx refresh, but that's
already handled in the code by requiring two refreshes before setting it
as unspent).

This reverts the old synchronous fetch-pool-txes behaviour on refresh so
that there is no window of opportunity with long polling for us to
prematurely treat unconfirmed_txs as failed/unspent.
2020-01-18 19:25:50 -04:00
Doyle 621e1a0824 Update blink priority to 5 2020-01-16 10:29:36 +11:00
xiphon ffe7165ebf wallet: reroll fake outs selection on local tx_sanity_check failure 2020-01-14 22:56:23 +00:00
Alexander Blair d024695772
Merge pull request #6105
0de8a0d3 wallet_rpc_server: new estimate_tx_size_and_weight RPC (moneromooo-monero)
2020-01-11 18:04:49 -08:00
Tadeas Moravec 096a9dbdf9
Wallet: Distingush amounts for a single subaddress
Adding a new `amounts` field ot the output of `get_transfers` RPC
method. This field specifies individual payments made to a single
subaddress in a single transaction, e.g., made by this command:

    transfer <addr1> <amount1> <addr1> <amount2>
2020-01-11 11:48:27 +01:00
Doyle 98fe4d7bf9 Add a flag to disable long polling on wallets 2020-01-10 15:51:32 +11:00
Doyle 04f9721c8f Long polling QOL, handle errors gracefully avoid lock contention
Handle errors better when long polling is disabled instead of endlessly
spamming logs.

Avoid lock contention when set_daemon is called. Instead of immediately
affecting the long polling thread (which could be engaging the mutex
until RPC timeout, meaning the program stalls for that duration), update
the address on the next iteration of the long polling thread.

Wallets handle daemons that disable long polling better by sleeping.
2020-01-10 13:07:37 +11:00
Jason Rhinelander 1f3b8891f1 Fix 6.1.1 compilation (#1002)
`tools::wallet2::rpc_long_poll_timeout` was a static member declaration
without a definition, which isn't allowed before C++17 (although can
work depending on compiler optimizations).  Adding the definition in
wallet2.cpp isn't really an option (it would make core depend on the
wallet), so just move it to a constexpr static global (which is allowed
without a definition, even before C++17) in `rpc/` instead.
2020-01-08 09:56:00 +11:00