aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/crypto/slow-hash.c70
-rw-r--r--src/cryptonote_core/blockchain.cpp21
-rw-r--r--src/cryptonote_core/cryptonote_tx_utils.cpp13
-rw-r--r--src/cryptonote_core/cryptonote_tx_utils.h2
-rw-r--r--src/cryptonote_core/tx_pool.cpp88
-rw-r--r--src/device/device_ledger.cpp18
-rw-r--r--src/rpc/core_rpc_server.cpp56
-rw-r--r--src/rpc/core_rpc_server.h2
-rw-r--r--src/rpc/core_rpc_server_commands_defs.h24
-rw-r--r--src/wallet/wallet2.cpp8
10 files changed, 217 insertions, 85 deletions
diff --git a/src/crypto/slow-hash.c b/src/crypto/slow-hash.c
index 53628ab18..38aeeee54 100644
--- a/src/crypto/slow-hash.c
+++ b/src/crypto/slow-hash.c
@@ -51,6 +51,12 @@
#define INIT_SIZE_BLK 8
#define INIT_SIZE_BYTE (INIT_SIZE_BLK * AES_BLOCK_SIZE)
+#if defined(_MSC_VER)
+#define THREADV __declspec(thread)
+#else
+#define THREADV __thread
+#endif
+
extern void aesb_single_round(const uint8_t *in, uint8_t *out, const uint8_t *expandedKey);
extern void aesb_pseudo_round(const uint8_t *in, uint8_t *out, const uint8_t *expandedKey);
@@ -459,12 +465,6 @@ static inline int force_software_aes(void)
_b1 = _b; \
_b = _c; \
-#if defined(_MSC_VER)
-#define THREADV __declspec(thread)
-#else
-#define THREADV __thread
-#endif
-
#pragma pack(push, 1)
union cn_slow_hash_state
{
@@ -1012,6 +1012,44 @@ void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int
}
#elif !defined NO_AES && (defined(__arm__) || defined(__aarch64__))
+#ifdef __aarch64__
+#include <sys/mman.h>
+THREADV uint8_t *hp_state = NULL;
+THREADV int hp_malloced = 0;
+
+void cn_slow_hash_allocate_state(void)
+{
+ if(hp_state != NULL)
+ return;
+
+#ifndef MAP_HUGETLB
+#define MAP_HUGETLB 0
+#endif
+ hp_state = mmap(0, MEMORY, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANON | MAP_HUGETLB, -1, 0);
+
+ if(hp_state == MAP_FAILED)
+ hp_state = NULL;
+ if(hp_state == NULL)
+ {
+ hp_malloced = 1;
+ hp_state = (uint8_t *) malloc(MEMORY);
+ }
+}
+
+void cn_slow_hash_free_state(void)
+{
+ if(hp_state == NULL)
+ return;
+
+ if (hp_malloced)
+ free(hp_state);
+ else
+ munmap(hp_state, MEMORY);
+ hp_state = NULL;
+ hp_malloced = 0;
+}
+#else
void cn_slow_hash_allocate_state(void)
{
// Do nothing, this is just to maintain compatibility with the upgraded slow-hash.c
@@ -1023,6 +1061,7 @@ void cn_slow_hash_free_state(void)
// As above
return;
}
+#endif
#if defined(__GNUC__)
#define RDATA_ALIGN16 __attribute__ ((aligned(16)))
@@ -1272,12 +1311,7 @@ void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int
{
RDATA_ALIGN16 uint8_t expandedKey[240];
-#ifndef FORCE_USE_HEAP
- RDATA_ALIGN16 uint8_t local_hp_state[MEMORY];
-#else
- uint8_t *local_hp_state = (uint8_t *)aligned_malloc(MEMORY,16);
-#endif
-
+ uint8_t *local_hp_state;
uint8_t text[INIT_SIZE_BYTE];
RDATA_ALIGN16 uint64_t a[2];
RDATA_ALIGN16 uint64_t b[4];
@@ -1296,6 +1330,14 @@ void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int
hash_extra_blake, hash_extra_groestl, hash_extra_jh, hash_extra_skein
};
+ // this isn't supposed to happen, but guard against it for now.
+ if(hp_state == NULL)
+ cn_slow_hash_allocate_state();
+
+ // locals to avoid constant TLS dereferencing
+ local_hp_state = hp_state;
+
+ // locals to avoid constant TLS dereferencing
/* CryptoNight Step 1: Use Keccak1600 to initialize the 'state' (and 'text') buffers from the data. */
if (prehashed) {
@@ -1409,10 +1451,6 @@ void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int
memcpy(state.init, text, INIT_SIZE_BYTE);
hash_permutation(&state.hs);
extra_hashes[state.hs.b[0] & 3](&state, 200, hash);
-
-#ifdef FORCE_USE_HEAP
- aligned_free(local_hp_state);
-#endif
}
#else /* aarch64 && crypto */
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 33407bf95..34031fb7c 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -588,6 +588,7 @@ block Blockchain::pop_block_from_blockchain()
CHECK_AND_ASSERT_THROW_MES(m_db->height() > 1, "Cannot pop the genesis block");
+ const uint8_t previous_hf_version = get_current_hard_fork_version();
try
{
m_db->pop_block(popped_block, popped_txs);
@@ -650,6 +651,13 @@ block Blockchain::pop_block_from_blockchain()
m_tx_pool.on_blockchain_dec(top_block_height, top_block_hash);
invalidate_block_template_cache();
+ const uint8_t new_hf_version = get_current_hard_fork_version();
+ if (new_hf_version != previous_hf_version)
+ {
+ MINFO("Validating txpool for v" << (unsigned)new_hf_version);
+ m_tx_pool.validate(new_hf_version);
+ }
+
return popped_block;
}
//------------------------------------------------------------------
@@ -4392,6 +4400,19 @@ leave:
get_difficulty_for_next_block(); // just to cache it
invalidate_block_template_cache();
+ const uint8_t new_hf_version = get_current_hard_fork_version();
+ if (new_hf_version != hf_version)
+ {
+ // the genesis block is added before everything's setup, and the txpool is empty
+ // when we start from scratch, so we skip this
+ const bool is_genesis_block = new_height == 1;
+ if (!is_genesis_block)
+ {
+ MGINFO("Validating txpool for v" << (unsigned)new_hf_version);
+ m_tx_pool.validate(new_hf_version);
+ }
+ }
+
send_miner_notifications(id, already_generated_coins);
for (const auto& notifier: m_block_notifiers)
diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp
index f41c63a4b..f6061b803 100644
--- a/src/cryptonote_core/cryptonote_tx_utils.cpp
+++ b/src/cryptonote_core/cryptonote_tx_utils.cpp
@@ -678,7 +678,7 @@ namespace cryptonote
rx_slow_hash(main_height, seed_height, seed_hash.data, bd.data(), bd.size(), res.data, 0, 1);
}
- bool get_block_longhash(const Blockchain *pbc, const block& b, crypto::hash& res, const uint64_t height, const crypto::hash *seed_hash, const int miners)
+ bool get_block_longhash(const Blockchain *pbc, const blobdata& bd, crypto::hash& res, const uint64_t height, const int major_version, const crypto::hash *seed_hash, const int miners)
{
// block 202612 bug workaround
if (height == 202612)
@@ -687,8 +687,7 @@ namespace cryptonote
epee::string_tools::hex_to_pod(longhash_202612, res);
return true;
}
- blobdata bd = get_block_hashing_blob(b);
- if (b.major_version >= RX_BLOCK_VERSION)
+ if (major_version >= RX_BLOCK_VERSION)
{
uint64_t seed_height, main_height;
crypto::hash hash;
@@ -705,12 +704,18 @@ namespace cryptonote
}
rx_slow_hash(main_height, seed_height, hash.data, bd.data(), bd.size(), res.data, seed_hash ? 0 : miners, !!seed_hash);
} else {
- const int pow_variant = b.major_version >= 7 ? b.major_version - 6 : 0;
+ const int pow_variant = major_version >= 7 ? major_version - 6 : 0;
crypto::cn_slow_hash(bd.data(), bd.size(), res, pow_variant, height);
}
return true;
}
+ bool get_block_longhash(const Blockchain *pbc, const block& b, crypto::hash& res, const uint64_t height, const crypto::hash *seed_hash, const int miners)
+ {
+ blobdata bd = get_block_hashing_blob(b);
+ return get_block_longhash(pbc, bd, res, height, b.major_version, seed_hash, miners);
+ }
+
bool get_block_longhash(const Blockchain *pbc, const block& b, crypto::hash& res, const uint64_t height, const int miners)
{
return get_block_longhash(pbc, b, res, height, NULL, miners);
diff --git a/src/cryptonote_core/cryptonote_tx_utils.h b/src/cryptonote_core/cryptonote_tx_utils.h
index 06412d6bf..cea4aad17 100644
--- a/src/cryptonote_core/cryptonote_tx_utils.h
+++ b/src/cryptonote_core/cryptonote_tx_utils.h
@@ -142,6 +142,8 @@ namespace cryptonote
);
class Blockchain;
+ bool get_block_longhash(const Blockchain *pb, const blobdata& bd, crypto::hash& res, const uint64_t height,
+ const int major_version, const crypto::hash *seed_hash, const int miners);
bool get_block_longhash(const Blockchain *pb, const block& b, crypto::hash& res, const uint64_t height, const int miners);
bool get_block_longhash(const Blockchain *pb, const block& b, crypto::hash& res, const uint64_t height, const crypto::hash *seed_hash, const int miners);
void get_altblock_longhash(const block& b, crypto::hash& res, const uint64_t main_height, const uint64_t height,
diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp
index 84605d6f5..6fe5a54ac 100644
--- a/src/cryptonote_core/tx_pool.cpp
+++ b/src/cryptonote_core/tx_pool.cpp
@@ -1568,61 +1568,59 @@ namespace cryptonote
{
CRITICAL_REGION_LOCAL(m_transactions_lock);
CRITICAL_REGION_LOCAL1(m_blockchain);
- size_t tx_weight_limit = get_transaction_weight_limit(version);
- std::unordered_set<crypto::hash> remove;
- m_txpool_weight = 0;
- m_blockchain.for_all_txpool_txes([this, &remove, tx_weight_limit](const crypto::hash &txid, const txpool_tx_meta_t &meta, const cryptonote::blobdata_ref*) {
- m_txpool_weight += meta.weight;
- if (meta.weight > tx_weight_limit) {
- LOG_PRINT_L1("Transaction " << txid << " is too big (" << meta.weight << " bytes), removing it from pool");
- remove.insert(txid);
- }
- else if (m_blockchain.have_tx(txid)) {
- LOG_PRINT_L1("Transaction " << txid << " is in the blockchain, removing it from pool");
- remove.insert(txid);
- }
+ MINFO("Validating txpool contents for v" << (unsigned)version);
+
+ LockedTXN lock(m_blockchain.get_db());
+
+ struct tx_entry_t
+ {
+ crypto::hash txid;
+ txpool_tx_meta_t meta;
+ };
+
+ // get all txids
+ std::vector<tx_entry_t> txes;
+ m_blockchain.for_all_txpool_txes([&txes](const crypto::hash &txid, const txpool_tx_meta_t &meta, const cryptonote::blobdata_ref*) {
+ if (!meta.pruned) // skip pruned txes
+ txes.push_back({txid, meta});
return true;
}, false, relay_category::all);
- size_t n_removed = 0;
- if (!remove.empty())
+ // take them all out and add them back in, some might fail
+ size_t added = 0;
+ for (auto &e: txes)
{
- LockedTXN lock(m_blockchain.get_db());
- for (const crypto::hash &txid: remove)
+ try
{
- try
- {
- cryptonote::blobdata txblob = m_blockchain.get_txpool_tx_blob(txid, relay_category::all);
- cryptonote::transaction tx;
- if (!parse_and_validate_tx_from_blob(txblob, tx)) // remove pruned ones on startup, they're meant to be temporary
- {
- MERROR("Failed to parse tx from txpool");
- continue;
- }
- // remove tx from db first
- m_blockchain.remove_txpool_tx(txid);
- m_txpool_weight -= get_transaction_weight(tx, txblob.size());
- remove_transaction_keyimages(tx, txid);
- auto sorted_it = find_tx_in_sorted_container(txid);
- if (sorted_it == m_txs_by_fee_and_receive_time.end())
- {
- LOG_PRINT_L1("Removing tx " << txid << " from tx pool, but it was not found in the sorted txs container!");
- }
- else
- {
- m_txs_by_fee_and_receive_time.erase(sorted_it);
- }
- ++n_removed;
- }
- catch (const std::exception &e)
+ size_t weight;
+ uint64_t fee;
+ cryptonote::transaction tx;
+ cryptonote::blobdata blob;
+ bool relayed, do_not_relay, double_spend_seen, pruned;
+ if (!take_tx(e.txid, tx, blob, weight, fee, relayed, do_not_relay, double_spend_seen, pruned))
+ MERROR("Failed to get tx " << e.txid << " from txpool for re-validation");
+
+ cryptonote::tx_verification_context tvc{};
+ relay_method tx_relay = e.meta.get_relay_method();
+ if (!add_tx(tx, e.txid, blob, e.meta.weight, tvc, tx_relay, relayed, version))
{
- MERROR("Failed to remove invalid tx from pool");
- // continue
+ MINFO("Failed to re-validate tx " << e.txid << " for v" << (unsigned)version << ", dropped");
+ continue;
}
+ m_blockchain.update_txpool_tx(e.txid, e.meta);
+ ++added;
+ }
+ catch (const std::exception &e)
+ {
+ MERROR("Failed to re-validate tx from pool");
+ continue;
}
- lock.commit();
}
+
+ lock.commit();
+
+ const size_t n_removed = txes.size() - added;
if (n_removed > 0)
++m_cookie;
return n_removed;
diff --git a/src/device/device_ledger.cpp b/src/device/device_ledger.cpp
index 5caad3a1a..c082544e8 100644
--- a/src/device/device_ledger.cpp
+++ b/src/device/device_ledger.cpp
@@ -55,10 +55,10 @@ namespace hw {
}
#define TRACKD MTRACE("hw")
- #define ASSERT_SW(sw,ok,msk) CHECK_AND_ASSERT_THROW_MES(((sw)&(mask))==(ok), \
+ #define ASSERT_SW(sw,ok,msk) CHECK_AND_ASSERT_THROW_MES(((sw)&(msk))==(ok), \
"Wrong Device Status: " << "0x" << std::hex << (sw) << " (" << Status::to_string(sw) << "), " << \
"EXPECTED 0x" << std::hex << (ok) << " (" << Status::to_string(ok) << "), " << \
- "MASK 0x" << std::hex << (mask));
+ "MASK 0x" << std::hex << (msk));
#define ASSERT_T0(exp) CHECK_AND_ASSERT_THROW_MES(exp, "Protocol assert failure: "#exp ) ;
#define ASSERT_X(exp,msg) CHECK_AND_ASSERT_THROW_MES(exp, msg);
@@ -451,13 +451,6 @@ namespace hw {
ASSERT_X(this->length_recv>=3, "Communication error, less than three bytes received. Check your application version.");
- unsigned int device_version = 0;
- device_version = VERSION(this->buffer_recv[0], this->buffer_recv[1], this->buffer_recv[2]);
-
- ASSERT_X (device_version >= MINIMAL_APP_VERSION,
- "Unsupported device application version: " << VERSION_MAJOR(device_version)<<"."<<VERSION_MINOR(device_version)<<"."<<VERSION_MICRO(device_version) <<
- " At least " << MINIMAL_APP_VERSION_MAJOR<<"."<<MINIMAL_APP_VERSION_MINOR<<"."<<MINIMAL_APP_VERSION_MICRO<<" is required.");
-
return true;
}
@@ -470,7 +463,10 @@ namespace hw {
this->length_recv -= 2;
this->sw = (this->buffer_recv[length_recv]<<8) | this->buffer_recv[length_recv+1];
logRESP();
- ASSERT_SW(this->sw,ok,msk);
+ MDEBUG("Device "<< this->id << " exchange: sw: " << this->sw << " expected: " << ok);
+ ASSERT_X(sw != SW_CLIENT_NOT_SUPPORTED, "Monero Ledger App doesn't support current monero version. Try to update the Monero Ledger App, at least " << MINIMAL_APP_VERSION_MAJOR<< "." << MINIMAL_APP_VERSION_MINOR << "." << MINIMAL_APP_VERSION_MICRO << " is required.");
+ ASSERT_X(sw != SW_PROTOCOL_NOT_SUPPORTED, "Make sure no other program is communicating with the Ledger.");
+ ASSERT_SW(this->sw,ok,mask);
return this->sw;
}
@@ -487,7 +483,7 @@ namespace hw {
// cancel on device
deny = 1;
} else {
- ASSERT_SW(this->sw,ok,msk);
+ ASSERT_SW(this->sw,ok,mask);
}
logRESP();
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index da36f3c64..e114ea7c6 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -1912,6 +1912,43 @@ namespace cryptonote
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
+ bool core_rpc_server::on_calcpow(const COMMAND_RPC_CALCPOW::request& req, COMMAND_RPC_CALCPOW::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx)
+ {
+ RPC_TRACKER(calcpow);
+
+ blobdata blockblob;
+ if(!string_tools::parse_hexstr_to_binbuff(req.block_blob, blockblob))
+ {
+ error_resp.code = CORE_RPC_ERROR_CODE_WRONG_BLOCKBLOB;
+ error_resp.message = "Wrong block blob";
+ return false;
+ }
+ if(!m_core.check_incoming_block_size(blockblob))
+ {
+ error_resp.code = CORE_RPC_ERROR_CODE_WRONG_BLOCKBLOB_SIZE;
+ error_resp.message = "Block blob size is too big, rejecting block";
+ return false;
+ }
+ crypto::hash seed_hash, pow_hash;
+ std::string buf;
+ if(req.seed_hash.size())
+ {
+ if (!string_tools::parse_hexstr_to_binbuff(req.seed_hash, buf) ||
+ buf.size() != sizeof(crypto::hash))
+ {
+ error_resp.code = CORE_RPC_ERROR_CODE_WRONG_PARAM;
+ error_resp.message = "Wrong seed hash";
+ return false;
+ }
+ buf.copy(reinterpret_cast<char *>(&seed_hash), sizeof(crypto::hash));
+ }
+
+ cryptonote::get_block_longhash(&(m_core.get_blockchain_storage()), blockblob, pow_hash, req.height,
+ req.major_version, req.seed_hash.size() ? &seed_hash : NULL, 0);
+ res = string_tools::pod_to_hex(pow_hash);
+ return true;
+ }
+ //------------------------------------------------------------------------------------------------------------------------------
bool core_rpc_server::on_add_aux_pow(const COMMAND_RPC_ADD_AUX_POW::request& req, COMMAND_RPC_ADD_AUX_POW::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx)
{
RPC_TRACKER(add_aux_pow);
@@ -2898,7 +2935,7 @@ namespace cryptonote
{
if (req.limit_down != -1)
{
- res.status = CORE_RPC_ERROR_CODE_WRONG_PARAM;
+ res.status = "Invalid parameter";
return true;
}
epee::net_utils::connection_basic::set_rate_down_limit(nodetool::default_limit_down);
@@ -2912,7 +2949,7 @@ namespace cryptonote
{
if (req.limit_up != -1)
{
- res.status = CORE_RPC_ERROR_CODE_WRONG_PARAM;
+ res.status = "Invalid parameter";
return true;
}
epee::net_utils::connection_basic::set_rate_up_limit(nodetool::default_limit_up);
@@ -3164,6 +3201,14 @@ namespace cryptonote
if (use_bootstrap_daemon_if_necessary<COMMAND_RPC_GET_OUTPUT_DISTRIBUTION>(invoke_http_mode::JON_RPC, "get_output_distribution", req, res, r))
return r;
+ const bool restricted = m_restricted && ctx;
+ if (restricted && req.amounts != std::vector<uint64_t>(1, 0))
+ {
+ error_resp.code = CORE_RPC_ERROR_CODE_RESTRICTED;
+ error_resp.message = "Restricted RPC can only get output distribution for rct outputs. Use your own node.";
+ return false;
+ }
+
size_t n_0 = 0, n_non0 = 0;
for (uint64_t amount: req.amounts)
if (amount) ++n_non0; else ++n_0;
@@ -3205,6 +3250,13 @@ namespace cryptonote
if (use_bootstrap_daemon_if_necessary<COMMAND_RPC_GET_OUTPUT_DISTRIBUTION>(invoke_http_mode::BIN, "/get_output_distribution.bin", req, res, r))
return r;
+ const bool restricted = m_restricted && ctx;
+ if (restricted && req.amounts != std::vector<uint64_t>(1, 0))
+ {
+ res.status = "Restricted RPC can only get output distribution for rct outputs. Use your own node.";
+ return false;
+ }
+
size_t n_0 = 0, n_non0 = 0;
for (uint64_t amount: req.amounts)
if (amount) ++n_non0; else ++n_0;
diff --git a/src/rpc/core_rpc_server.h b/src/rpc/core_rpc_server.h
index 84b14383a..664af3686 100644
--- a/src/rpc/core_rpc_server.h
+++ b/src/rpc/core_rpc_server.h
@@ -149,6 +149,7 @@ namespace cryptonote
MAP_JON_RPC_WE("get_block_template", on_getblocktemplate, COMMAND_RPC_GETBLOCKTEMPLATE)
MAP_JON_RPC_WE("getblocktemplate", on_getblocktemplate, COMMAND_RPC_GETBLOCKTEMPLATE)
MAP_JON_RPC_WE("get_miner_data", on_getminerdata, COMMAND_RPC_GETMINERDATA)
+ MAP_JON_RPC_WE_IF("calc_pow", on_calcpow, COMMAND_RPC_CALCPOW, !m_restricted)
MAP_JON_RPC_WE("add_aux_pow", on_add_aux_pow, COMMAND_RPC_ADD_AUX_POW)
MAP_JON_RPC_WE("submit_block", on_submitblock, COMMAND_RPC_SUBMITBLOCK)
MAP_JON_RPC_WE("submitblock", on_submitblock, COMMAND_RPC_SUBMITBLOCK)
@@ -231,6 +232,7 @@ namespace cryptonote
bool on_getblockhash(const COMMAND_RPC_GETBLOCKHASH::request& req, COMMAND_RPC_GETBLOCKHASH::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
bool on_getblocktemplate(const COMMAND_RPC_GETBLOCKTEMPLATE::request& req, COMMAND_RPC_GETBLOCKTEMPLATE::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
bool on_getminerdata(const COMMAND_RPC_GETMINERDATA::request& req, COMMAND_RPC_GETMINERDATA::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
+ bool on_calcpow(const COMMAND_RPC_CALCPOW::request& req, COMMAND_RPC_CALCPOW::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
bool on_add_aux_pow(const COMMAND_RPC_ADD_AUX_POW::request& req, COMMAND_RPC_ADD_AUX_POW::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
bool on_submitblock(const COMMAND_RPC_SUBMITBLOCK::request& req, COMMAND_RPC_SUBMITBLOCK::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
bool on_generateblocks(const COMMAND_RPC_GENERATEBLOCKS::request& req, COMMAND_RPC_GENERATEBLOCKS::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h
index 1dbfc83a7..166fb39ea 100644
--- a/src/rpc/core_rpc_server_commands_defs.h
+++ b/src/rpc/core_rpc_server_commands_defs.h
@@ -88,7 +88,7 @@ namespace cryptonote
// advance which version they will stop working with
// Don't go over 32767 for any of these
#define CORE_RPC_VERSION_MAJOR 3
-#define CORE_RPC_VERSION_MINOR 8
+#define CORE_RPC_VERSION_MINOR 9
#define MAKE_CORE_RPC_VERSION(major,minor) (((major)<<16)|(minor))
#define CORE_RPC_VERSION MAKE_CORE_RPC_VERSION(CORE_RPC_VERSION_MAJOR, CORE_RPC_VERSION_MINOR)
@@ -990,6 +990,28 @@ namespace cryptonote
typedef epee::misc_utils::struct_init<response_t> response;
};
+ struct COMMAND_RPC_CALCPOW
+ {
+ struct request_t: public rpc_request_base
+ {
+ uint8_t major_version;
+ uint64_t height;
+ blobdata block_blob;
+ std::string seed_hash;
+
+ BEGIN_KV_SERIALIZE_MAP()
+ KV_SERIALIZE_PARENT(rpc_request_base)
+ KV_SERIALIZE(major_version)
+ KV_SERIALIZE(height)
+ KV_SERIALIZE(block_blob)
+ KV_SERIALIZE(seed_hash)
+ END_KV_SERIALIZE_MAP()
+ };
+ typedef epee::misc_utils::struct_init<request_t> request;
+
+ typedef std::string response;
+ };
+
struct COMMAND_RPC_ADD_AUX_POW
{
struct aux_pow_t
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 2a190add5..bdac3109f 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -13728,12 +13728,8 @@ std::string wallet2::make_uri(const std::string &address, const std::string &pay
if (!payment_id.empty())
{
- crypto::hash pid32;
- if (!wallet2::parse_long_payment_id(payment_id, pid32))
- {
- error = "Invalid payment id";
- return std::string();
- }
+ error = "Standalone payment id deprecated, use integrated address instead";
+ return std::string();
}
std::string uri = "monero:" + address;