Commit graph

845 commits

Author SHA1 Message Date
Sean Darcy 95f6c02d55 SETBANS 2021-11-08 10:16:42 +11:00
Sean Darcy 6651fdd33a GETBANS 2021-11-05 16:19:11 +11:00
Sean Darcy d476f216cc GET_BLOCK_HEADER_BY_HASH 2021-11-05 15:21:38 +11:00
Sean Darcy 445fab4ac5 GET_LAST_BLOCK_HEADER 2021-11-05 14:12:29 +11:00
Sean Darcy d5cb4a0ae7 FLUSH_CACHE 2021-11-01 17:08:57 -04:00
Sean Darcy 60db8271a9 TEST_TRIGGER_UPTIME_PROOF TEST_TRIGGER_P2P_RESYNC REPORT_PEER_STATUS 2021-11-01 17:08:57 -04:00
Sean Darcy 88904bc9a3 GET_SN_STATE_CHANGES 2021-11-01 17:08:57 -04:00
Sean Darcy 8f999ec785 PRUNE_BLOCKCHAIN 2021-11-01 17:08:57 -04:00
Sean Darcy 8d1e9985f9 POP_BLOCKS 2021-11-01 17:08:56 -04:00
Sean Darcy ef44031b79 OUT_PEERS and IN_PEERS 2021-11-01 17:08:56 -04:00
Sean Darcy b16a744bf8 GET_BASE_FEE_ESTIMATE 2021-11-01 17:08:56 -04:00
Sean Darcy 53890cc1bc GET_COINBASE_TX_SUM 2021-11-01 17:08:56 -04:00
Sean Darcy 6f3f6a4836 FLUSH_TRANSACTION_POOL to new rpc format 2021-11-01 17:08:56 -04:00
Sean Darcy bd56d537f5 BANNED to new RPC format 2021-11-01 17:08:56 -04:00
Sean Darcy 2a4ca2a50f make_request template instead of try_running 2021-11-01 17:08:56 -04:00
Sean Darcy 1c2a798bc9 set_log_level and set_log_categories to use new RPC 2021-11-01 17:08:56 -04:00
Jason Rhinelander 7551f5c137 Remove p2p rpc_port; p2p code clean-ups
The public rpc port code from Monero is not used on Oxen (we have no
ability to enable it because we didn't want it), but still carried
around and printed pointlessly.  This removes it entirely.

Along the way I ran into some really nasty p2p code using templates for
absolutely no reason at all, so I fixed that crap, and moved some p2p
serialization out of headers into a .cpp file.  (This only scratches the
surface, but as we're going to replace the p2p code entirely eventually
I don't want to waste time trying to polish a turd).
2021-11-01 17:08:56 -04:00
Jason Rhinelander 6c54ca6abd fix 2021-11-01 17:08:56 -04:00
Jason Rhinelander ff0c76d7f3 RPC: +peerlist, -publicnodes
Updates GET_PEER_LIST to new RPC.

Removes GET_PUBLIC_NODES because we don't use this option at all in
oxend.  (At the point where we need a decentralized public node
repository we'll almost certainly want to use the service node network
to do it, not the p2p layer).
2021-11-01 17:08:56 -04:00
Jason Rhinelander 6729cb2da8 RPC: IS_KEY_IMAGE_SPENT
New RPC.

Also adds the ability to look up more than one key image at a time, and
shows errors through a proper fail_msg_writer().
2021-11-01 17:08:56 -04:00
Jason Rhinelander 7bb3bb1807 RPC: GET_LIMIT, SET_LIMIT
Updates to new RPC interface.

Removes distinct `limit`, `limit_up`, `limit_down` command and makes
them all go through `limit` by allowing limit to take the down and up
parameters.

    limit_up 123
    limit_down 456

becomes

    limit 0 123
    limit 456 0

or to set both at once:

    limit 456 123

Also improves documentation, and allows "default" to be specified for
either limit to return the limit to its default.  (-1 is also accepted
for this, but is a pain because on the command line it produces an
invalid option error unless you also prefix the command with `--` to
stop further arg parsing).

Also makes the command actually print an error (instead of nothing at
all) when given invalid arguments.  Whoa such innovation!
2021-11-01 17:08:56 -04:00
Jason Rhinelander 91f327db06 Wire up start_mining command
Also remove some old autodetect handling which doesn't exist anymore.
2021-11-01 17:08:56 -04:00
Jason Rhinelander fe376e184d RPC: add support for fetching transaction pool
This drops the dedicated GET_TRANSACTION_POOL endpoint entirely and
folds the txpool fetching into GET_TRANSACTIONS via a new `memory_pool`
parameter.  (This is backwards incompatible, of course, but the results
may not be too harmful: the wallet doesn't actually use this endpoint,
so it mainly affects internal oxend commands (fixed here) and the block
explorer (which is fairly easily fixed).

This also removes some of the useless GET_TRANSACTIONS bits such as
decode_as_json.

`fee` and `burned` are now always provided in the return (for both
specific requested transactions and mempool transactions).

As a side effect, this code ventured deep into core/blockchain in terms
of dealing with missed transactions: previously they were always
returned (via lvalue ref) as a vector, and always had to be specified.
This changes to take via pointer to an unordered_set, which can be null
if you don't care about the missed ones.  This reduces several calls
that indeed didn't care about collecting the missed values, and improved
virtually all the places that *did* care which need to query which ones
were missed rather than needing a specific order.
2021-11-01 17:08:56 -04:00
Jason Rhinelander 27683554e4 RPC: GET_TRANSACTIONS
Various cleanups.

Moves RPC-specific logic out of tx_pool and into the rpc code.
2021-11-01 17:08:56 -04:00
Jason Rhinelander 61f87e42a6 RPC: HARD_FORK_INFO
Implements new RPC for hard_fork_info, which `oxend status` (most
notably, but there are others) requires.
2021-11-01 17:08:54 -04:00
Jason Rhinelander 7e6097d312 RPC: GET_TRANSACTION_POOL_STATS improvements/tweaks
- Take the "include_unrelayed" as a parameter instead of switching on on
  the admin context; there isn't likely to be anything sensitive there,
  and it makes little sense for a wallet to get *different* results just
  because it happens to be talking to a localhost oxend.
- Change the histogram code so that it always returns a fixed size
- Various improvements to histogram output; most notably printing a more
  useful indication of what the histogram outputs are (e.g. instead of:

             Age             Txes       Bytes
             now                0           0
       8.0 minutes ago          0           0
       16.1 minutes ago         0           0
       24.1 minutes ago         0           0
       32.2 minutes ago         0           0
       40.2 minutes ago         0           0
       48.3 minutes ago         0           0
       56.3 minutes ago         0           0
       64.3 minutes ago         0           0
       72.4 minutes ago         2        4559

  it now displays the ranges:

                  Age                Txes       Bytes
           now - 10.6min ago          0           0
       10.6min - 21.3min ago          0           0
       21.3min - 32.0min ago          0           0
       32.0min - 42.6min ago          0           0
       42.6min - 53.2min ago          0           0
       53.2min - 63.9min ago          0           0
       63.9min - 74.6min ago          0           0
       74.6min - 85.2min ago          0           0
       85.2min - 1.6hr ago            0           0
         1.6hr - 1.8hr ago            2        4559
2021-11-01 17:08:22 -04:00
Jason Rhinelander 7b871e97fc Add fmtlib::fmt backport of C++20 std::format
Because I'm tired of waiting for std::format.
2021-11-01 17:03:47 -04:00
Jason Rhinelander 3415733996 RPC overhaul: SYNC_INFO 2021-11-01 16:59:01 -04:00
Jason Rhinelander 8bb9d56f96 Fix mining status commands 2021-11-01 16:59:01 -04:00
Jason Rhinelander 6d7428b0e1 Add invoke_simple for invoking simple RPC calls
Simple here means no arguments and no return aside from the "status":
"OK" field.  For commands like stop_mining, stop_daemon, save_bc.
2021-11-01 16:58:59 -04:00
Jason Rhinelander c2f39b6541 RPC update: get_connections
- add documentation
- change download/upload speed values to B/s instead of KiB/s
- return times as milliseconds instead of seconds, and rename those
  fields from ..._time to ..._ms.
- Code cleanup of state strings
- remove completely unused peer state "idle"
2021-11-01 16:58:01 -04:00
Jason Rhinelander ef3686ccf3 Remove hide_hr, show_hr commands, part 2 2021-11-01 14:59:27 -04:00
Jason Rhinelander 1f16daf109 Replace epee C date crap with C++20 date backport 2021-11-01 14:54:18 -04:00
Jason Rhinelander 9a0e23ca05 get_service_node *client* updates
Updates the internal callers of get_service_nodes to properly deal with
the new request format/fields.

Note that this also introduces some significant changes to the
`print_sn` output:

- contributor formats are more compact (one line per contributor), show
  reserved amounts (if != contributed amouont), and show the stake %.
- reworded "Operator Cut (% of Fee Reward)" to "Operator Fee"
- checkpoint/pulse vote format is completely overhauled to list voted
  and missed heights separately.
- pulse votes now show the pulse round for non-zero round results.
- timestamp checks renamed to Quorumnet tests
- qnet & timesync results now just print the number of successes/fails
  rather than a list of true/false values.
2021-11-01 14:53:10 -04:00
Jason Rhinelander e8cbf6352d using nlohmann::json
Simplify things by not require full qualification everywhere.
2021-11-01 14:53:10 -04:00
Jason Rhinelander 4a8023ade6 Make RPC more flexible & add bt-encoding
The bt-encoding, in particular, is aimed at more efficient wallet3 rpc
interactions with a daemon.

This removes the rigidity from RPC request responses, making it easier
to return useful constructs that the current epee code doesn't support
(like lists of lists), and also adds support for bt-encoded RPC requests
(intended to eventually replace the ".bin" endpoints with Monero NIH
binary encoding).

Instead endpoints now set a nlohmann::json response object with whatever
arbitrary values they want without having to add a bunch of limited epee
serialization macro hell.

So, for example, to set the value "foo" to 20, you use:

    rpc.response["height"] = 20;

Binary values (for things like hashes) are handled by going through a proxy object:

    rpc.response_hex["hash"] = hash; // hash is a crypto::hash

which, for json, is equivalent to:

    rpc.response["hash"] = tools::type_to_hex(hash);

but when the response is to be bt-encoded it leaves it as binary for
more efficient transfers.

There is also a `response_b64` that converts json-destined values to
base64 instead of hex (and again leaves bt-destined values as binary).

Parsing of incoming requests now moves to a new
core_rpc_server_command_parser file, which does free-form parsing from a
nlohmann::json or bt_dict_consumer, and has various templated helper
functions to make this easier.

This is preliminary: this builds the basic infrastucture for handling
requests, and converts three endpoints:

- get_info
- get_height
- ons_resolve

Currently only `make daemon` builds (there is code in the wallet that
hasn't been updated yet), and the other RPC interfaces are disabled by
this commit (until they get converted to the new style).
2021-11-01 14:53:05 -04:00
Jason Rhinelander 9782155c81
Merge pull request #1481 from jagerman/drop-integration-tests
Drop unmaintained integration test code
2021-09-03 00:28:49 -03:00
Jason Rhinelander eefd42f93f Add fmtlib::fmt backport of C++20 std::format
Because I'm tired of waiting for std::format.
2021-09-02 17:25:13 -03:00
Jason Rhinelander 5f1bd2f1e4 Drop integration test code.
This code is bitrotting, doesn't compile, and isn't being maintained
anymore.

The integration test suite was an interesting idea, in early Loki days,
but is no longer being maintained and is quite cumbersome to run (for
instance, it is not possible to run it via CI because it depends on
xterm to actually run).  The code to actually run it (in doy-lee's
loki-integration-testing repository) is also a large burden of "janky"
code that isn't worth maintaining.

Remove this from the code; if someone wants to pick it back up in the
future reverting this commit shouldn't be too difficult (though I'd
suggest that a much better approach to integration testing would be to
run different daemons/wallets via rpc commands, as the network-tests do,
rather than trying to feed stdin and parse stdout from running
individual oxends/wallets).
2021-08-19 16:42:15 -03:00
Jason Rhinelander 7b00cb251b Add snode revision soft forks & drop hard fork voting code
Snode revisions are a secondary version that let us put out a mandatory
update for snodes that isn't a hardfork (and so isn't mandatory for
wallets/exchanges/etc.).

The main point of this is to let us make a 9.2.0 release that includes
new mandatory minimums of future versions of storage server (2.2.0) and
lokinet (0.9.4) to bring upgrades to the network.

This slightly changes the HF7 blocks to 0 (instead of 1) because,
apparently, we weren't properly checking the HF value of the
pre-first-hf genesis block at all before.  (In practice this changes
nothing because genesis blocks are v7 anyway).

This also changes (slightly) how we check for hard forks: now if we skip
some hard forks then we still want to know the height when a hard fork
triggers.  For example, if the hf tables contains {7,14} then we still
need to know that the HF14 block height also is the height that
activates HF9, 10, etc.
2021-06-19 15:13:57 -03:00
Jason Rhinelander bbb8bdb1af Add lokinet reachability to quorum testing
It works just like storage server testing.

Renames the report_peer_storage_server_status to report_peer_status, and
repurposes the code to handle both SS and lokinet.

This *doesn't* need a HF by design because the reason bit field was
deliberately designed so that we can add reason fields (older clients
will just ignore unknown bits).
2021-06-10 12:13:33 -03:00
javabudd e32cbcbccd
Check if SN has a ping from lokinet and the storage server before registration (#1457)
* Make preparing registration fail if lokinet or the storage server have not received a ping yet

* Add prepare_registration boolean default

* Add signature override for get_human_time_ago to accept an optional uint64. Add stricter comparisons to ping checks

* Remove duplicate logic

* Remove method override and assign/cast last_lokinet_ping/last_storage_server_ping

* Use auto definition and static_cast res.last_lokinet_ping
2021-05-20 21:59:21 -03:00
Jason Rhinelander f287d3d614 Remove STACK_TRACE option
This option is incredibly misguided: exceptions are a normal part of C++
error handling that are used *as intended* in lots of places in the
code.  Spewing massive amounts of output every time any exception is
thrown anywhere (even when caught!) is terrible.

More than that, we don't ever build with it enabled (for the above
reasons) so this is all just unused code.
2021-05-12 11:59:22 -03:00
Sean Darcy 435c187ca0 initialise version and pretty print if no version 2021-04-20 16:22:00 +10:00
Jason Rhinelander 7ecef1529d print_sn display tweaks
- decrease indent
- show lokinet address
2021-04-18 22:20:10 -03:00
Jason Rhinelander bdebfda9f8 Re-do how SS ping tests are handled
This moves all the responsibility of ping testing (deciding when it's
unreachable, etc.) into oxend, allowing for better reporting on SS ping
results and eliminating some edge cases that can lead to oxend and
storage server getting "stuck" thinking each is in a different state.
2021-04-18 22:20:10 -03:00
Jason Rhinelander 3b4c8f4a5d Make get_human_time_ago use seconds rather than ints 2021-04-18 22:20:10 -03:00
Jason Rhinelander eda03d1590
Merge pull request #1432 from jagerman/ss-updates
Storage server RPC updates
2021-04-18 22:19:13 -03:00
Jason Rhinelander ce9d0a9c1e Storage server RPC improvements
Improves the oxend<->storage server communications protocol:

- pass storage server HTTPS port as part of the storage server ping
(which already carries the also-required OMQ port) rather than needing
to provide it when starting up oxend.  --storage-server-port is now
obsolete (and ignored, if specified).
- Fix up the internal API to use `storage_https_port` and
`storage_omq_port` rather than `storage_port` and `storage_lmq_port`.
- Redo and the SS ping RPC endpoint so that it is less verbose and more
closely matches the lokinet endpoint; instead of:

    { "version_major": 2, "version_minor": 0, "version_patch": 9, "storage_lmq_port": 22222 }

we now expect:

    { "version": [2,0,9], "https_port": 11111, "omq_port": 22222 }

- Tweaks the (not-yet-released) SS proof key names: "s"->"shp" and "slp"->"sop"
2021-04-08 13:42:33 -03:00
Jason Rhinelander 2f5ec0e1e6 lmq -> omq internal rename
More rebrand updates to rename lmq (lokimq) internals with omq (oxenmq).
2021-04-08 13:38:51 -03:00
Jason Rhinelander 944ff226d0
Merge pull request #1407 from jagerman/network-test-fixes
Network test fixes
2021-04-07 18:39:07 -03:00
Jason Rhinelander b1344e919c Show both all & some reasons
Suffix "(some)" onto reasons in any but not in all.
2021-03-28 22:08:19 -03:00
Jason Rhinelander 1c2db6fe34 Move Current Status to the bottom of the status list
This makes it easier to pick out at a glance.

Also adds "Current Status: awaiting contributions" if not fully
contributed.
2021-03-28 22:08:19 -03:00
Jason Rhinelander 7d78f48305 Current Status: ACTIVE; fallback to any (or no) reasons
The status doesn't have a nice way to tell it is active or awaiting
contributions, so add it.

If "all" reasons don't give any results then try showing the "any"
reasons, and if that doesn't work, show a "reason(s) not available"
message.
2021-03-28 22:08:19 -03:00
Jason Rhinelander 5a05bd5e41 Make print_sn_status more compact
- Put SS/lokinet version on same line
- make checkpoint/pulse/timestamp/timesync each take one line instead of
  three
- instead of [height,round,vote] for pulse just print [height,vote] and
add a '+R' on height if for a pulse round > 0.
- remove the space after the , in the checkpoint/pulse/etc. lines to
save a little
2021-03-28 22:08:19 -03:00
Jason Rhinelander e4e48f983a Show decomm reasons in oxend status 2021-03-26 17:40:35 -03:00
Sean Darcy ded6e6bbf4 Add multiple decommission reasons to output. 2021-03-26 15:25:12 -03:00
Sean Darcy 10c3c3f0df print reason for decommission 2021-03-26 15:25:12 -03:00
Jason Rhinelander faed99a373 Fix exception when given a relative --log-file 2021-02-16 23:47:58 -04:00
Jason Rhinelander 438a47c5e6 Fix main exceptions resulting in no output
If `main` throws an exception before the log system is initialized then
the error message just got lost; this fixes it to print to stderr if
that happens.
2021-02-16 23:46:41 -04:00
Sean Darcy 90232dd217 shorten wire names 2021-02-09 11:54:27 +11:00
Sean Darcy 2ba4438e6a RPC to return SS and lokinet versions, renaming variables 2021-02-09 11:54:19 +11:00
Jason Rhinelander 466a1317d2 Rename lokimq -> oxenmq 2021-01-14 19:35:00 -04:00
Jason Rhinelander 8913aecdb1 Config file migration fixes
The loki.conf -> oxen.conf migration wasn't working right when there is
also a ~/.loki -> ~/.oxen migration happening, so this rewrites it to
work properly:

- Make loki.conf -> oxen.conf migration leave behind a symlink
- Fix config file migration to also look for ~/.loki/loki.conf, and also
  consider ~/.loki/oxen.conf as a valid load source.  (The ~/.loki
  consideration only happens when data-dir is default *and* neither
  oxen.conf nor loki.conf are found in ~/.oxen).
- *Don't* look for ~/.loki/{loki,oxen}.conf if the default data dir
  (~/.oxen) exists.

Other changes:

- remove the default handling for the config file/log file and put it in
  main instead.  This is non-trivial, and the existing default is broken
  in that if you specify `--data-dir=blah` it still tries to load
  `~/.oxen/oxen.conf` rather than `blah/oxen.conf`.  With this commit it
  now does the expected thing when a data-dir is specified.
- Append /regtest to data-dir when running in --regtest mode.  The
  existing behaviour of clobbering the mainnet data dir is nasty.
2021-01-07 15:57:36 -04:00
Jason Rhinelander 95537a7e3e Eliminate tools::create_directories_if_necessary
We shouldn't actually use it in `main.cpp` because it is called before
the log system is initialized, and it is a wrapper that saves basically
nothing, so just replace it everywhere with direct calls to
fs::create_directories and delete it.
2021-01-07 15:26:30 -04:00
Sean Darcy d198af3de6 line break 2021-01-07 14:41:14 +11:00
Sean Darcy 04114050e3 make lokid.sock and move the .oxen folder migration to before logs initialise folder 2021-01-07 14:39:58 +11:00
Sean Darcy 8261af980c default directory migration, .loki -> .oxen moved to .main 2021-01-07 10:31:28 +11:00
Jason Rhinelander af115b7c5c Rename loki.conf -> oxen.conf when appropriate
Requires:
- config-file argument is not given
- default DATA/oxen.conf does not exist
- old DATA/loki.conf does exist
2021-01-06 18:12:07 -04:00
Jason Rhinelander 6e3ab03923 Add some color in main.cpp before log init 2021-01-06 18:11:57 -04:00
Jason Rhinelander 7c62d94597 Change Loki startup message from green -> cyan 2021-01-06 17:23:08 -04:00
Sean Darcy 851f9af707 lokinet revert 2021-01-04 15:21:21 +11:00
Sean Darcy 432dc319a9 executable names changed 2021-01-04 14:19:42 +11:00
Sean Darcy 0396698ee7 initial loki -> oxen pass 2021-01-04 11:09:45 +11:00
Sean Darcy ed5b946c0a quorumnet message for timestamp requests
random sampling of service nodes, call timestamp lmq message

checks timestamp of 5 service nodes, if local time is 30 seconds different from 80% of the nodes tested then warn user

tracks external timesync status and timestamp participation of service nodes

clean up includes

new template struct for participation history, individual types for participation entry

refactor checking participation

update select_randomly, move the testing for variance overflow

version locks, bump to 8.1.5

explicit casting for mac & clang

note to remove after hard fork

timestamp debugging log messages

debugging messages for before timesync - before message sent

logging errord with compiling

print version and change add_command to add_request_command

log if statement test

std::to_string replaced with tools::view_guts for x25519 key

check if my sn is active before sending timestamp requests

logging the failures

checking if statement for success of message

more logging, if guards arn't passing

more logging, successfully tests if service node might be out of sync

more tests before we decide we are out of sync

logging output if sn isn't passing tests

if check_participation fails then disconnect

print timestamp status

remove saving variance from the participation history

reduce MIN_TIME_IN_S_BEFORE_VOTING

reset participation history on recommission

undo reduction in startup time

reduce log levels

Set hardfork time in testnet
2020-12-18 16:05:51 +11:00
Jason Rhinelander 6fabd5b70c Remove obsolete JSON serialization
This json serialization layer was only used in the old Monero ZMQ
interface, which no longer exists, and so this is just dead code.

On top of that, it doesn't work properly for serializing CLSAG
transactions, so just delete it.
2020-11-23 17:16:55 -04:00
Jason Rhinelander de7bad36c0 Misc fixes to lokid status output
Removes a space after the / in H/H, and add a missing % symbol.
2020-11-12 17:01:58 -04:00
Jason Rhinelander f9c022ab5d Fix rpc commands invoked via lokid COMMAND
The wrong port was being used (because the new --rpc-admin value wasn't
being recognized), resulting in a connection failure.
2020-11-12 17:01:28 -04:00
Jason Rhinelander d618d82ee4 Overhaul http rpc cli options
The RPC listening options inherited from Monero are a mess: this
overhauls them to support just two options:

    --rpc-admin - takes an IP:PORT value to listen on (and can be
        specified multiple times to listen on multiple IPs/ports)
    --rpc-public - same as above, but the RPC will be restricted.

which allows you to listen on whatever IP/port you want in a much
simpler way.

This replaces all of:

    --rpc-bind-ip
    --rpc-bind-ipv6
    --restricted-rpc
    --rpc-use-ipv6
    --rpc-ignore-ipv4
    --rpc-bind-port
    --rpc-restricted-bind-port
    --confirm-external-bind

and preemptively also replaces Monero upstream's proposed future
argument:

    --rpc-restricted-bind-ip

while being more flexible in every way.

For now the existing Monero options are still supported, but will
produce log warnings on startup when used.  They will be removed in a
future major version upgrade (probably loki 9.x).
2020-11-06 11:48:20 -04:00
Jason Rhinelander b627b3b4bb Move epee includes under "epee/..."
This ends epee's include pollution.
2020-10-24 12:46:27 -03:00
Jason Rhinelander 78833f9d69 Remove deprecated epee code 2020-10-24 12:46:26 -03:00
Jason Rhinelander 862df3b5fe Code cleanups (epee, boost::lexical_cast)
- Remove some useless epee functions, and add deprecated markers to ones
that have good replacements already.
- Don't use boost::lexical_cast when std::to_string or direct stream
output can be used just as well.
- Get rid of dumb epee "include_base_utils.h" header
2020-10-24 12:46:26 -03:00
Jason Rhinelander 1dd98f3dae std::filesystem
Converts all use of boost::filesystem to std::filesystem.

For macos and potentially other exotic systems where std::filesystem
isn't available, we use ghc::filesystem instead (which is a drop-in
replacement for std::filesystem, unlike boost::filesystem).

This also greatly changes how we handle filenames internally by holding
them in filesystem::path objects as soon as possible (using
fs::u8path()), rather than strings, which avoids a ton of issues around
unicode filenames.  As a result this lets us drop the boost::locale
dependency on Windows along with a bunch of messy Windows ifdef code,
and avoids the need for doing gross boost locale codecvt calls.
2020-10-24 12:45:37 -03:00
Doyle 89cc4c42a3
args: Coerce rpc port to number instead of string (#1303) 2020-10-07 10:40:30 +11:00
Jason Rhinelander aec3a57d80
Fix config file parsing to recognize hidden options (#1293)
The old deprecated zmq-rpc-bind-port and other hidden deprecated options
weren't being properly recognized when in a config file because only the
visible settings were passed in.  This fixes it to also pass in hidden
settings.
2020-10-01 09:51:16 +10:00
Jason Rhinelander 4472cd47a7 Showing ", syncing" based on height rather than mining info rpc response
Also move it higher, just after the height (and, if present, ON
TESTNET/DEVNET).
2020-09-26 00:20:06 -03:00
Jason Rhinelander cf1ff3575e Make admin-only get_info fields optional
i.e. just omit them from the response rather than sending back 0's.
2020-09-25 18:53:34 -03:00
Jason Rhinelander ebb8c274cf Rewrite lokid status message to remove mining info
The existing boost::format was a monstrosity, so rewrote it to build a
stringstream instead.

- No longer print anything about mining on HF16 unless we are actually
  mining.

- Don't print net hash for HF16+ since it is not valid.

- don't show incoming/outgoing connections count if response looks
  restricted.

- Print "next fork in x.x hours" starting at 24.0 hours instead of 12.0
  hours.

- Replace ridiculous integer-math-done-on-floats with actual integer
  math.
2020-09-25 18:53:34 -03:00
Doyle c986888fcf Pulse: Record Pulse participation globally on network
- Instead of the Pulse quorums validators recording participation
between each other- so failures may not manifest in a decommission until
the several common nodes align and agree to vote off the node.

Voting now occurs when blocks arrives, validators participating in the
generation of the block are marked. This is shared information between
all nodes syncing the chain so decommissions are more readily agreeable
and acted upon in the Obligation quorums immediately.
2020-09-23 15:15:16 +10:00
Jason Rhinelander 808b907f0d block rpc improvements
- Allow retrieving multiple blocks headers by height in the same request
  (matching the API already available to do that for by-hash lookups).
- make pow_hash an optional so that it gets omitted entirely if not
  requested
- Likewise for block header responses when using the array arguments
  instead of the single value argument.
2020-09-18 20:25:48 -03:00
Jason Rhinelander a22f1cfce9 Eliminate unnamespaced parse_hash256 function
tools::hex_to_type does exactly the same thing, but generically.
2020-09-18 20:25:48 -03:00
Jason Rhinelander caf5e59984 Merge branch 'pulse' into dev 2020-09-18 17:40:25 -03:00
Doyle 3482f0b786 Pulse: Format vote history nicely 2020-09-18 13:50:05 -03:00
Doyle 31b9fbff91 Pulse: Record pulse participation and issue decommission 2020-09-18 13:50:05 -03:00
Jason Rhinelander 99632845a0 Remove redundant version fields
We already provide the maj/min/patch versions much more compactly in the
service_node_version field.
2020-08-18 12:21:28 -03:00
Doyle 62fe4db413 config: Convert DIFFICULTY_BLOCKS_V2 to TARGET_BLOCK_TIME 2020-08-18 11:59:53 +10:00
Doyle a62ff316e3 Pulse: Queue Block Gen code review
- Rename find_named_argument -> find_prefixed_value
- Update get_current_blockchain_height() comment to specify ability to lock
- Update memcmp(address1, address2) to address1 == address2
- Make create_next_miner_block_template call create_miner_block_template
- Update LMQ x25519 keys only when key has changed
- construct_miner_tx: Use C++17 features
- Pulse: Add log category "Pulse"
- Pulse: Check shutdown before blockchain height
- Pulse: Use get_human_readable_timespan
- Pulse: Switch to MINFO, enable with --log-level +pulse:DEBUG
- Pulse: Add height into context
- Pulse: Remove some default switch cases hiding compiler warnings
- SN: Update hardcoded '9' literals to network_version_9_service_nodes
- Core: Use using namespace std::literals
- Miner: Change num_blocks availability to debug
- RPC: Gate test rpc commands to != MAINNET
- Wallet: Store wallet before deinitialization instead of refresh
2020-08-18 11:59:53 +10:00
Doyle 530994dee9 Pulse: Add debug trigger uptime proof via rpc 2020-08-18 11:59:53 +10:00
Doyle 2ce8f23991 wallet: Save on refresh
Otherwise RPCing into the wallet and triggering a refresh doesn't really
work, i.e.

loki-wallet-cli --wallet-file file --password '' refresh
loki-wallet-cli --wallet-file file --password '' balance <-- this returns 0
2020-08-18 11:59:53 +10:00
Doyle 9a5889b68b miner: Allow setting num_blocks param, used named arguments 2020-08-18 11:59:53 +10:00