mirror of https://github.com/oxen-io/lokinet
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
548 B
C++
30 lines
548 B
C++
6 years ago
|
#ifndef LLARP_POW_HPP
|
||
|
#define LLARP_POW_HPP
|
||
|
#include <llarp/buffer.h>
|
||
|
#include <llarp/crypto.h>
|
||
|
#include <llarp/router_id.hpp>
|
||
|
|
||
|
namespace llarp
|
||
|
{
|
||
|
/// proof of work
|
||
|
struct PoW
|
||
|
{
|
||
|
static constexpr size_t MaxSize = 128;
|
||
|
|
||
|
RouterID router;
|
||
|
uint64_t version = 0;
|
||
|
uint32_t extendedLifetime = 0;
|
||
|
byte_t nonce[32];
|
||
|
|
||
|
bool
|
||
|
BEncode(llarp_buffer_t* buf) const;
|
||
|
|
||
|
bool
|
||
|
BDecode(llarp_buffer_t* buf);
|
||
|
|
||
|
bool
|
||
|
IsValid(llarp_shorthash_func hashfunc, const RouterID& us) const;
|
||
|
};
|
||
|
} // namespace llarp
|
||
|
|
||
|
#endif
|