comparator.
This commit is contained in:
parent
f8efdb105e
commit
bcbcd1178d
|
@ -2019,7 +2019,7 @@ async_get_addrtx(uv_work_t *req) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
CScript expected = GetScriptForDestination(address.Get());
|
CScript expected = GetScriptForDestination(address.Get());
|
||||||
|
|
||||||
int64_t i = 0;
|
int64_t i = 0;
|
||||||
|
@ -2098,9 +2098,10 @@ done:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
#endif
|
#else
|
||||||
ctx_list *ctxs = read_addr(data->addr);
|
ctx_list *ctxs = read_addr(data->addr);
|
||||||
data->ctxs = ctxs;
|
data->ctxs = ctxs;
|
||||||
|
#endif
|
||||||
if (data->ctxs == NULL) {
|
if (data->ctxs == NULL) {
|
||||||
data->err_msg = std::string("Could not read database.");
|
data->err_msg = std::string("Could not read database.");
|
||||||
}
|
}
|
||||||
|
@ -5636,41 +5637,26 @@ GetOptions(size_t nCacheSize) {
|
||||||
class TwoPartComparator : public leveldb::Comparator {
|
class TwoPartComparator : public leveldb::Comparator {
|
||||||
public:
|
public:
|
||||||
// Three-way comparison function:
|
// Three-way comparison function:
|
||||||
// if a < b: negative result
|
// if a < end: negative result
|
||||||
// if a > b: positive result
|
// if a > end: positive result
|
||||||
// else: zero result
|
// else: zero result
|
||||||
int Compare(const leveldb::Slice& a, const leveldb::Slice& b) const {
|
int Compare(const leveldb::Slice& key, const leveldb::Slice& end) const {
|
||||||
#if 0
|
std::string key_ = key.ToString();
|
||||||
int a1, a2, b1, b2;
|
std::string end_ = end.ToString();
|
||||||
ParseKey(a, &a1, &a2);
|
|
||||||
ParseKey(b, &b1, &b2);
|
const char *k = key_.c_str();
|
||||||
if (a1 < b1) return -1;
|
const char *e = end_.c_str();
|
||||||
if (a1 > b1) return +1;
|
|
||||||
if (a2 < b2) return -1;
|
if (k[0] == 't'
|
||||||
if (a2 > b2) return +1;
|
&& k[1] == 'x'
|
||||||
return 0;
|
&& k[2] == '-') {
|
||||||
#endif
|
unsigned int el = strlen(e);
|
||||||
#if 1
|
if (k[el - 1] == '\0' || k[el - 1] == e[el - 1]) {
|
||||||
std::string a_ = a.ToString();
|
return 1;
|
||||||
std::string b_ = b.ToString();
|
}
|
||||||
const char *a__ = a_.c_str();
|
return -1;
|
||||||
const char *b__ = b_.c_str();
|
}
|
||||||
int r = strcmp(a__, b__);
|
return 1;
|
||||||
// free(a__);
|
|
||||||
// free(b__);
|
|
||||||
return r;
|
|
||||||
#endif
|
|
||||||
#if 0
|
|
||||||
std::string a_ = a.ToString();
|
|
||||||
std::string b_ = b.ToString();
|
|
||||||
const char *a__ = a_.c_str();
|
|
||||||
const char *b__ = b_.c_str();
|
|
||||||
char *sub = strstr(a__, b__);
|
|
||||||
// free(a__);
|
|
||||||
// free(b__);
|
|
||||||
if (sub == NULL) return 1;
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore the following methods for now:
|
// Ignore the following methods for now:
|
||||||
|
@ -5736,8 +5722,8 @@ read_addr(const std::string addr) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
leveldb::Slice start = "txa2-" + addr + "-";
|
leveldb::Slice start = "tx-" + addr + "-";
|
||||||
leveldb::Slice end = "txa2-" + addr + "-~";
|
leveldb::Slice end = "tx-" + addr + "-~";
|
||||||
//leveldb::Options options;
|
//leveldb::Options options;
|
||||||
|
|
||||||
leveldb::Iterator* it = pdb->NewIterator(leveldb::ReadOptions());
|
leveldb::Iterator* it = pdb->NewIterator(leveldb::ReadOptions());
|
||||||
|
|
Loading…
Reference in New Issue