put leveldb key in error message.
This commit is contained in:
parent
7e00980db2
commit
69e6a252d1
@ -5885,13 +5885,20 @@ read_addr(const std::string addr) {
|
|||||||
|
|
||||||
while (pcursor->Valid()) {
|
while (pcursor->Valid()) {
|
||||||
boost::this_thread::interruption_point();
|
boost::this_thread::interruption_point();
|
||||||
|
char *k_debug = NULL;
|
||||||
try {
|
try {
|
||||||
leveldb::Slice slKey = pcursor->key();
|
leveldb::Slice slKey = pcursor->key();
|
||||||
const char *k = slKey.ToString().c_str();
|
CDataStream ssKey(slKey.data(), slKey.data() + slKey.size(), SER_DISK, CLIENT_VERSION);
|
||||||
if (k[0] == 'b') {
|
std::string key;
|
||||||
char *blockhash_ = strdup(k);
|
// XXX ERRORS HERE:
|
||||||
|
ssKey >> key;
|
||||||
|
char type = key.c_str()[0];
|
||||||
|
k_debug = (char *)key.c_str();
|
||||||
|
if (type == 'b') {
|
||||||
|
char *blockhash_ = strdup(key.c_str());
|
||||||
blockhash_++;
|
blockhash_++;
|
||||||
std::string sblockhash = std::string(blockhash_);
|
std::string sblockhash = std::string(blockhash_);
|
||||||
|
free(blockhash_);
|
||||||
uint256 blockhash(sblockhash);
|
uint256 blockhash(sblockhash);
|
||||||
leveldb::Slice slValue = pcursor->value();
|
leveldb::Slice slValue = pcursor->value();
|
||||||
CDataStream ssValue(slValue.data(), slValue.data() + slValue.size(), SER_DISK, CLIENT_VERSION);
|
CDataStream ssValue(slValue.data(), slValue.data() + slValue.size(), SER_DISK, CLIENT_VERSION);
|
||||||
@ -5951,11 +5958,13 @@ read_addr(const std::string addr) {
|
|||||||
found:
|
found:
|
||||||
pcursor->Next();
|
pcursor->Next();
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
// throw runtime_error(e.what() + std::string(" : Deserialize or I/O error - %s"));
|
head->err_msg = std::string(
|
||||||
// head->err_msg = std::string(e.what() + std::string(" : Deserialize or I/O error - %s"));
|
e.what()
|
||||||
// delete pcursor;
|
+ std::string(" : Deserialize or I/O error. Key: ")
|
||||||
// return head;
|
+ (k_debug != NULL ? std::string(k_debug) : std::string("NULL"))
|
||||||
;
|
);
|
||||||
|
delete pcursor;
|
||||||
|
return head;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user