This adds a new table to the batching schema to copy the accrued
balances every so often. This means that we can jump back to a
previous point without popping blocks.
The archiving is triggered in sql every 100 blocks and added to the
archive table, then pruned from the archive table at a later time to
ensure the size is kept small. Rebuilding 100 blocks is pretty
reasonable and should be less than 10s.
For longer distance pop_blocks and blockchain detached every 10k blocks
is kept in the archiving table. This takes longer to rebuild but is
better than rebuilding from scratch.
The blockchain detached function is also added to our regular blockchain
detached hooks so that it gets called every time the blockchain
detaches. Which appears to have caused some issues previously when some
of the modules would detach but batching would be stuck in an advanced
state.
- This was infinitely recursing because it was picking up fmt::to_string
(on macos) rather than formattable::to_string, which led to infinite
recursion and then a crash.
- Add a custom ghc::filesystem::path formatter (because it just seems
wrong to add a function into ghc::filesystem) instead of using the
to_string formatting. Same for boost formatting crap in simplewallet.
- Move the formatter structs into the `formattable` namespace so that
this sort of recursive error can't happen again.
- Remove implicit `operator bool` from ec_point/public_key/etc. which
was causing all sorts of implicit conversion mess and bugs.
- Change ec_point/public_key/etc. to use a `std::array<unsigned char,
32>` (via a base type) rather than a C-array of char that has to be
reinterpret_cast<>'ed all over the place.
- Add methods to ec_point/public_key/etc. that make it work more like a
container of bytes (`.data()`, `.size()`, `operator[]`, `begin()`,
`end()`).
- Make a generic `crypto::null<T>` that is a constexpr all-0 `T`, rather
than the mishmash `crypto::null_hash`, crypto::null_pkey,
crypto:#️⃣:null(), and so on.
- Replace three metric tons of `crypto::hash blahblah =
crypto::null_hash;` with the much simpler `crypto::hash blahblah{};`,
because there's no need to make a copy of a null hash in all these
cases. (Likewise for a few other null_whatevers).
- Remove a whole bunch of `if (blahblah == crypto::null_hash)` and `if
(blahblah != crypto::null_hash)` with the more concise `if
(!blahblah)` and `if (blahblah)` (which are fine via the newly
*explicit* bool conversion operators).
- `crypto::signature` becomes a 64-byte container (as above) but with
`c()` and `r()` to get the c() and r() data pointers. (Previously
`.c` and `.r` were `ec_scalar`s).
- Delete with great prejudice CRYPTO_MAKE_COMPARABLE and
CRYPTO_MAKE_HASHABLE and all the other utter trash in
`crypto/generic-ops.h`.
- De-inline functions in very common crypto/*.h files so that they don't
have to get compiled 300 times.
- Remove the disgusting include-a-C-header-inside-a-C++-namespace
garbage from some crypto headers trying to be both a C and *different*
C++ header at once.
- Remove the toxic, disgusting, shameful `operator&` on ec_scalar, etc.
that replace `&x` with `reinterpret_cast x into an unsigned char*`.
This was pure toxic waste.
- changed some `<<` outputs to fmt
- Random other small changes encountered while fixing everything that
cascaded out of the above changes.
Fixed a bug where ec_point subclasses were not getting formatted via
to_string(ec_point).
Also fixed the crappy test code that was incapable of reporting the
actual test failure.
- Don't touch <fmt/std.h> because it touches std::filesystem which makes
macOS throw a hissy fit and refuse to compile.
- int_to_string is broken on macOS because it uses std::to_chars which
makes macos throw a hissy fit like a cranky old female cat seeing a
kitten if it sees it.
- wallet3 was using std::filesystem and std::visit, both of which make
macos throw a hissy fit. (There is a pattern here). Apply the dumb
fs::path and var::visit workarounds needed to appease this garbage OS.
- use var::get (from oxenc/variant.h) instead of std::get because, oh
yeah, we need to support a garbage OS that Apple themselves don't even
properly support. Yay!
cmake 3.24 defaults to ignoring all archive timestamps, which completely
breaks autotools packages (which rely on timestamps to know when they
need to be autoreconf'd).
Override this stupid default.
oxen::log::info(...), etc. are a bit too verbose; this simplifies them
to just `log::info(...)`, etc. by aliasing the `oxen::log` namespace
into most of the common namespaces we use in core.
This result is usage that is shorter but also reads better:
oxen::log::info(logcat, "blah: {}", 42);
log::info(logcat, "blah: {}", 42);
oxen_logger was getting included indirectly via something
device_ledger.hpp includes, but that doesn't get included at all if
HIDAPI headers weren't found.
The tagged 1.0.0 release includes a fix for the fmt::fmt/spdlog::spdlog
targets not being transitively available. (It does require a cmake
version bump to 3.13, though, to make it work).
This replaces the current epee logging system with our oxen::log
library. It replaces the easylogging library with spdlog, removes the
macros and replaces with functions and standardises how we call the
logs.
This lets lokinet or SS signal to oxend that something is known to be
wrong, and so oxend should not send a proof so that, hopefully, the
problem gets noticed and fixed.
Currently we're putting the last-uptime-received data in the service
node list info, even when we have more updated info that hasn't yet been
accepted by the network.
This causes problems for lokinet, in particular, because it ignores any
SNs in the list without ed25519 pubkeys, including itself, which can
result in lokinet thinking it is deregistered for a while after the SN
becomes registered.
This updates `get_service_nodes` to always include current info (rather
than latest proof info) for itself when querying a service node.