Commit graph

10738 commits

Author SHA1 Message Date
Jason Rhinelander
51b247bfac daemon & daemonize overhaul
This commit continues the complete replacement of the spaghetti code
mess that was inside daemon/ and daemonize/ which started in #1138, and
looked like a entry level Java programmer threw up inside the code base.
This greatly simplifies it, removing a whole pile of useless abstraction
layers that don't actually abstract anything, and results in
considerably simpler code.  (Many of the changes here were also carried
out in #1138; this commit updates them with the merged result which
amends some things from that PR and goes further in some places).

In detail:

- the `--detach` (and related `--pidfile`) options are gone.  (--detach
  is still handled, but now just prints a fatal error).  Detaching a
  process is an archaic unix mechanism that has no place on a modern
  system.  If you *really* want to do it anyway, `nohup lokid &` will do
  the job.  (The Windows service control code, which is probably seldom
  used, is kept because it seems potentially useful for Windows users).

- Many of the `t_whatever` classes in daemon/* are just deleted (mostly
  done in #1138); each one was a bunch of junk code that wraps 3-4 lines
  but forces an extra layer (not even a generic abstraction, just a
  useless wrapper) for no good reason and made the daemon code painfully
  hard to understand and work with.

- All of the remaining `t_whatever` classes in daemon/* are either
  renamed to `whatever` (because prefixing every class with `t_` is
  moronic).

- Some stupid related code (e.g. epee's command handler returning an
  unsuitable "usage" string that has to be string modified into what we
  want) was replaced with more generic, useful code.

- Replaced boost mutexes/cvs with std ones in epee command handler, and
  deleted some commented out code.

- The `--public-node` option handling was terrible: it was being handled
  in main, but main doesn't know anything about options, so then it
  forced it through the spaghetti objects *beside* the pack of all
  options that got passed along.  Moved it to a more sane location
  (core_rpc_server) and parse it out with some sanity.

- Changed a bunch of std::bind's to lambdas because, at least for small
  lambdas (i.e. with only one-or-two pointers for captures) they will
  generally be more efficient as the values can be stored in
  std::function's without any memory allocations.
2020-05-11 18:44:45 -03:00
Jason Rhinelander
8d53c0377e Loki-ify --block-rate-notify
- Monero -> Loki
- Remove the part about attacks as checkpointing alleviates that
concern.
- Remove the recommendation about using it for confirmations, since
again checkpointing and blink make it unnecessary.
2020-05-11 18:44:45 -03:00
Jason Rhinelander
14fcc7cad1 Make --help support >80 char width terminals 2020-05-11 18:44:45 -03:00
Jason Rhinelander
a46c1a33cb Resort common source code files
The list was *mostly* sorted by newer additions had been inserted in
random places.
2020-05-11 18:44:45 -03:00
Jason Rhinelander
509c7322c7 Stop using old quorumnet aliases
Now that we have forked, the old commands aren't needed anymore.
2020-05-11 18:44:45 -03:00
Jason Rhinelander
1cd160f45a Remove deprecated code 2020-05-11 18:44:45 -03:00
Jason Rhinelander
a8bdb1888e Remove dangerous and broken glob_to_regex function
This function is broken: if it encounters a \ it stays in "escape" more
forever.  However the entire function is also moronic because it is only
used in the test suite (and thus doesn't belong out of the test suite),
but is also only used for the test `--filter` arguments which have this
help message:

    Regular expression filter for which tests to run

Since a glob is not a regular expression, and because passing legitimate
regular expressions through this glob_to_regex function serious breaks
them, removing this stupid broken code is actually a bug fix.
2020-05-11 18:44:45 -03:00
Jason Rhinelander
459a0c0ed7 fix: decomposed amount removal 2020-05-11 18:44:45 -03:00
Jason Rhinelander
5ea5d5c13b Remove useless --os-version option
This is a big chunk of code with little usefulness: It is not the job of
Loki to tell you what operating system you are using.  If someone needs
to know what OS they are on they can run `uname` themselves on anything
other than Windows, and click the Start menu in Windows.

(Contrary to the option description, this actually just tells you the
current OS, not the compiled-for OS).
2020-05-11 18:44:45 -03:00
Jason Rhinelander
d3098ce023 Simplify/enhance command_line::is_yes etc.
This uses templates to simplify the is_yes (etc.) functions, also
removing a boost dependency and making them more flexible where callers
sometimes want "is_yes or one of these other truthy strings".
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
Jason Rhinelander
b69316ec38 Add missing depends 2020-05-11 18:44:45 -03:00
Jason Rhinelander
492d900693 Fix cmake policy warnings
The policy needs to be set before the `link_dep_libs` function (it was
before when it was in `external`, but this started generating warnings
again when I moved it from there to the top level CMakeLists.txt).
2020-05-11 18:44:45 -03:00
Jason Rhinelander
5189412d3b Remove valid_decomposed_outputs
We have never had decomposed amounts.  (And I think the stuck v1
transactions are stuck precisely *because* they are v1 transactions
which are not valid decomposed amounts).
2020-05-11 18:44:45 -03:00
Doyle
6ebe81b229
Merge pull request #1145 from jagerman/version-in-cmake
Move version into top-level CMakeLists.txt
2020-05-04 11:40:35 +10:00
Jason Rhinelander
c50d2e93dc Add a LOKI_RELEASE_SUFFIX for adding "-dev" to dev branch builds
This will require a one-time change when we merge to master (to delete
the `-dev`) but after that it should just sit there without needing any
modifications on `master` or `dev`.  (And letting it be specified via
cmake arguments will let me slightly simplify the debs which currently
have to add a vaguely similar patch to get the debian version into the
version string).
2020-05-03 22:20:49 -03:00
Jason Rhinelander
db5c053057 Move version into top-level CMakeLists.txt
CMake already provides variables to handle the version major/minor/patch
if we give it the dotted version in the `project()` command.  Using it
significantly reduces the amount of macro stuff we have to do in
version.cpp.in, and it seems a little nicer to have it defined in the
project top level rather than buried in a needs-to-beprocessed .cpp
file.

This moves the release codename there, too, so that it stays being
defined in essentially the same place as the version.

This change here requires some minor tweaking of the version generation
code to do it in two steps (when we have git): the first
(`src/version.cpp.in` -> `build/version.cpp.in`) replaces all the main
version variables during cmake configuration, the second
(`build/version.cpp.in` -> `build/version.cpp`) then replaces the
VERSIONTAG at build time.  (Before this commit, there was only version
tag replacement that only happened at build time).

Also bumps up the version here (since I'm moving it anyway) to match
master's 7.1.8.
2020-05-03 22:19:51 -03:00
Jason Rhinelander
3dddd07b9c Remove impossible version export cruft
In Monero 12.0 the version code got rewritten and, as a result, the
variable substitution export attribute no longer applies (since
`version.cmake` got moved and renamed to `Version.cmake`), but this bit
of cruft to rewrite the release tag to "-release" and the attribute are
still there, but cannot ever be invoked.

Remove them.  I specifically don't want to fix it because source exports
can come from anywhere, *not* only tagged versions, so putting
"-release" in the version string could be highly misleading.
2020-05-03 15:59:24 -03:00
Doyle
b4db8f7598
Merge pull request #1138 from Doy-lee/DaemonizerSimplifyer
Simplify Daemon/Wallet RPC initialization code
2020-04-24 14:25:55 +10:00
Doyle
713d848146 core_tests: Fix core still expecting cryptonote_protocol to be set 2020-04-24 14:19:04 +10:00
Doyle
90360bdcb0 Remove unused variables, remove os-version flag
OS version flag doesn't return the OS it was compiled on, just uname.
2020-04-24 14:19:04 +10:00
Doyle
22d1b76fee Remove optional dependencies from constructor, no code actually uses it 2020-04-24 14:19:04 +10:00
Doyle
1aa6ca005f Remove old daemonizing method 2020-04-24 14:14:49 +10:00
Doyle
fa139fb2bc daemon: Remove oop cruft and layers of indirection
Inline everything so daemon initialisation reads more linearly.
2020-04-24 14:14:49 +10:00
Doyle
2909ad886a wallet_rpc: Simplify daemonizer, remove t_handler/t_executor
The daemonizer requires you to fill out an "interface" to use it. This
imposes a design constraint on end users whens starting up applications
and led to a initialization circus with a t_executor starting up
a t_daemon that creates an instance of our application.

Instead design it so that execution flow is controlled by the user and
not the interface by returning the run_type that the user requested (run
as a service, forked, interactive or non-interactive) and launch
accordingly at the call site, and not indirected through 2 classes of
OOP cruft.

There still remains 1 wart with the Windows daemonizer requiring
templatization on the application so that Windows can callback at
a their deferred discretion and startup and shutdown the application
accordingly.
2020-04-24 14:14:49 +10: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
35621a0979 Switch to exception based error reporting 2020-04-24 13:39:27 +10:00
Doyle
7a2efc2cac
Merge pull request #1133 from Doy-lee/KeyImageFi
Annotate how key image exporting/importing works
2020-04-24 12:33:15 +10:00
Doyle
0662b7f600 std::memcpy, convert offset to little endian 2020-04-24 12:28:07 +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
5d6be45a4f
The portable implementation doesn't use the light parameter causing (#1126)
inconsistent results. I desk checked against the ARM64 implementation
that does NOT used the +crypto extensions, meaning it is emulated in
software- That implementation is essentially the same as the portable
implementation, some minor differences in the pre-amble but correctly
uses the light flag.

Adapting that over allows us to sync past block 321280, which previously
emitted an "unexpected difficulty" error.

This code path was never excercised due to the '-maes' flag being forced
on via CMake. That was removed in this commit to make it specifiable by
the user.

17be0ed650
2020-04-24 10:38:16 +10:00
Doyle
9510e2b5ea
Merge pull request #932 from Doy-lee/ClassifyStakes
Classify stakes in show/export_transfers
2020-04-24 10:18:47 +10:00
Doyle
6e12ab3665 Add overload for tx_get_staking_components that accepts a txid 2020-04-24 10:18:12 +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
Doyle
8f58ce001f get_contribution -> tx_get_staking_components and make public 2020-04-23 16:44:08 +10:00
Doyle
74e884c640 Difficulty needs access to easylogging++.h 2020-04-21 13:27:43 +10:00
Doyle
ef2ee4e27e Update trezor-common to 31a0073c62738827b48d725facd3766879429124 2020-04-21 12:23:55 +10:00
Doyle
669b943b06 s/MONERO_VERSION/LOKI_VERSION for Trezor 2020-04-21 12:23:55 +10:00
Doyle
94a243d542
Merge pull request #1132 from loki-project/master
Merge v7.1.5 to dev
2020-04-20 13:57:33 +10:00
Doyle
dabc9fae23
Use std::atomic for mingw build+avoid boost (#1131) 2020-04-20 13:12:21 +10:00
Doyle
fe4b992f5a
Bump version 7.1 patch to 5 (#1130) 2020-04-20 11:57:13 +10:00
Doyle
b9c30f4d0c
LongPoll: Reduce connection timeout duration on local addresses (#1129) 2020-04-20 11:55:27 +10:00
cryptonote.social
c12dcfa93c
fix segfault when exiting cli wallet due to running long poll thread (#1127)
* fix segfault when exiting cli wallet due to running poll thread

* fix whitespace

* style
2020-04-20 11:51:39 +10:00
Doyle
87f0b57b38
Update LokiMQ to v1.1.1 (#1128) 2020-04-20 09:36:14 +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
Doyle
f33e426b6b
Update version 7.1 patch to 4 (#1125) 2020-04-16 11:20:28 +10:00
Doyle
29fc6286fc
Merge pull request #1118 from Doy-lee/EpeeCleanup2
Fixes rvalues not taking correct default_serialize overload
2020-04-16 11:20:14 +10:00