-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstub_mining.cpp
More file actions
69 lines (61 loc) · 3 KB
/
Copy pathstub_mining.cpp
File metadata and controls
69 lines (61 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// This file exists purely to satisfy the linker. Most functions in it are
// mining/PoW-verification specific (RandomX, cn_slow_hash, blockchain
// queries, miner nonce search) and are never called along the
// construct_tx_and_get_tx_key -> signing path - they're only pulled in
// because the linker needs symbols that live in the same object files as
// code we do call. None of this affects the actual tx/signature math; it's
// not a cryptographic shortcut, just a stub for a path that's never
// exercised here.
#include <cstdint>
#include <cstddef>
#include <cstdlib>
#include <functional>
#include <string>
#include <vector>
#include "easylogging++.h"
INITIALIZE_EASYLOGGINGPP
extern "C" {
void* aligned_realloc(void* p, size_t size, size_t align) {
void* np = nullptr;
if (posix_memalign(&np, align, size) != 0) return nullptr;
if (p) { free(p); }
return np;
}
void aligned_free(void* p) { free(p); }
uint64_t rx_seedheight(uint64_t) { return 0; }
void rx_slow_hash(uint64_t, uint64_t, const void*, const void*, size_t, void*, int, int, int) {}
}
#include "cryptonote_core/blockchain.h"
#include "cryptonote_basic/miner.h"
namespace cryptonote {
crypto::hash Blockchain::get_pending_block_id_by_height(uint64_t) const { return crypto::hash(); }
bool miner::find_nonce_for_given_block(const std::function<bool(const cryptonote::block&, uint64_t, const crypto::hash*, unsigned int, crypto::hash&)>&, cryptonote::block&, const difficulty_type&, uint64_t, const crypto::hash*) { return false; }
}
void div128_64(uint64_t,uint64_t,uint64_t,uint64_t*,uint64_t*,uint64_t*,uint64_t*) {}
// --- Features never reached on the single-sig spending path: the Trezor
// hardware wallet, i18n, external script notification, the CLI password-file
// argument, and a combinatorics helper. These live in the
// same source files as wallet2.cpp functions we do call, but we never
// call them ourselves - stubbed for the linker only.
#include <string>
#include <vector>
const char* i18n_translate(const char* s, const std::string&) { return s; }
namespace hw { namespace trezor { void register_all() {} } }
namespace wallet_args { std::string arg_password_file() { return ""; } }
namespace tools { size_t combinations_count(unsigned int, unsigned int) { return 0; }
int spawn(const char*, const std::vector<std::string>&, bool) { return -1; } }
#include <boost/asio.hpp>
#include "net/net_helper.h"
namespace epee { namespace net_utils {
boost::unique_future<boost::asio::ip::tcp::socket> direct_connect::operator()(const std::string&, const std::string&, boost::asio::steady_timer&) const {
boost::promise<boost::asio::ip::tcp::socket> p; return p.get_future();
}
}}
// RandomX-specific (a different variant of cn_slow_hash, not used for
// wallet password derivation) - stubbed for the linker only, never
// actually called at runtime on our path.
extern "C" {
void* rx_slow_hash_allocate_state(void) { return nullptr; }
void rx_slow_hash_free_state(void*) {}
void v4_generate_JIT_code(const void*, char*, unsigned long) {}
}