goes through block 664641
This commit is contained in:
parent
217c102f8f
commit
7241ed9c41
3 changed files with 535 additions and 467 deletions
|
@ -215,7 +215,7 @@ void CClaimTrieCacheBase::ensureTreeStructureIsUpToDate() {
|
|||
|
||||
// the plan: update all the claim hashes first
|
||||
std::vector<std::string> names;
|
||||
db << "SELECT name FROM nodes WHERE hash IS NULL ORDER BY LENGTH(name), name"
|
||||
db << "SELECT name FROM nodes WHERE hash IS NULL ORDER BY name"
|
||||
>> [&names](std::string name) {
|
||||
names.push_back(std::move(name));
|
||||
};
|
||||
|
@ -226,7 +226,7 @@ void CClaimTrieCacheBase::ensureTreeStructureIsUpToDate() {
|
|||
// assume parents are not set correctly here:
|
||||
auto parentQuery = db << "SELECT name FROM nodes WHERE "
|
||||
"name IN (WITH RECURSIVE prefix(p) AS (VALUES(?) UNION ALL "
|
||||
"SELECT SUBSTR(p, 1, LENGTH(p)-1) FROM prefix WHERE p != '') SELECT p FROM prefix) "
|
||||
"SELECT POPS(p) FROM prefix WHERE p != '') SELECT p FROM prefix) "
|
||||
"ORDER BY name DESC LIMIT 1";
|
||||
|
||||
auto insertQuery = db << "INSERT INTO nodes(name, parent, hash) VALUES(?, ?, NULL) "
|
||||
|
@ -486,6 +486,7 @@ bool CClaimTrieCacheBase::flush()
|
|||
transacting = false;
|
||||
}
|
||||
base->nNextHeight = nNextHeight;
|
||||
removalWorkaround.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -534,6 +535,8 @@ CClaimTrieCacheBase::CClaimTrieCacheBase(CClaimTrie* base)
|
|||
db << "PRAGMA journal_mode=MEMORY";
|
||||
db << "PRAGMA temp_store=MEMORY";
|
||||
db << "PRAGMA case_sensitive_like=true";
|
||||
|
||||
db.define("POPS", [](std::string s) -> std::string { if (s.empty()) return s; s.pop_back(); return s; });
|
||||
}
|
||||
|
||||
int CClaimTrieCacheBase::expirationTime() const
|
||||
|
@ -634,6 +637,22 @@ bool CClaimTrieCacheBase::addSupport(const std::string& name, const COutPoint& o
|
|||
if (!db.rows_modified())
|
||||
return false;
|
||||
db << "UPDATE nodes SET hash = NULL WHERE name = ?" << nodeName;
|
||||
|
||||
if (nNextHeight < Params().GetConsensus().nMaxTakeoverWorkaroundHeight) {
|
||||
auto workaroundQuery = db << "SELECT nodeName FROM claims WHERE nodeName LIKE ?1 "
|
||||
"AND validHeight < ?2 AND expirationHeight >= ?2 ORDER BY nodeName LIMIT 1"
|
||||
<< nodeName + "%" << nNextHeight;
|
||||
auto wit = workaroundQuery.begin();
|
||||
if (wit != workaroundQuery.end()) {
|
||||
std::string shortestMatch;
|
||||
*wit >> shortestMatch;
|
||||
if (shortestMatch != nodeName) {
|
||||
// set this when there are no more claims on that name and that node still has children
|
||||
removalWorkaround.insert(nodeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -937,6 +956,164 @@ static const boost::container::flat_map<std::pair<int, std::string>, int> takeov
|
|||
{{653354, "double-giveaway-lpi-class-dates-and"}, 608129},
|
||||
{{653354, "linux-on-the-smartphone-in-2019-librem"}, 530426},
|
||||
{{653524, "celtic-folk-music-full-live-concert-mps"}, 589762},
|
||||
{{653745, "aftermath-of-the-mac"}, 592768},
|
||||
{{653745, "b-c-a-glock-17-threaded-barrel"}, 592770},
|
||||
{{653800, "middle-earth-shadow-of-mordor-by"}, 590229},
|
||||
{{654079, "tomand-jeremy-chirs45"}, 614296},
|
||||
{{654096, "achamos-carteira-com-grana-olha-o-que"}, 466262},
|
||||
{{654096, "viagem-bizarra-e-cansativa-ao-nordeste"}, 466263},
|
||||
{{654096, "tedio-na-tailandia-limpeza-de-area"}, 466265},
|
||||
{{654425, "schau-bung-2014-in-windischgarsten"}, 654410},
|
||||
{{654425, "mitternachtseinlage-ball-rk"}, 654410},
|
||||
{{654425, "zugabe-ball-rk-windischgarsten"}, 654412},
|
||||
{{654722, "skytrain-in-korea"}, 463145},
|
||||
{{654722, "luwak-coffee-the-shit-coffee"}, 463155},
|
||||
{{654722, "puppet-show-in-bangkok-thailand"}, 462812},
|
||||
{{654722, "kyaito-market-myanmar"}, 462813},
|
||||
{{654724, "wipeout-zombies-bo3-custom-zombies-1st"}, 589569},
|
||||
{{654724, "the-street-bo3-custom-zombies"}, 589544},
|
||||
{{654880, "wwii-airsoft-pow"}, 586968},
|
||||
{{654880, "dueling-geese-fight-to-the-death"}, 586968},
|
||||
{{654880, "wwii-airsoft-torgau-raw-footage-part4"}, 586968},
|
||||
{{655173, "april-2019-q-and-a"}, 554032},
|
||||
{{655173, "the-meaning-and-reality-of-individual"}, 607892},
|
||||
{{655173, "steven-pinker-progress-despite"}, 616984},
|
||||
{{655173, "we-make-stories-out-of-totem-poles"}, 549090},
|
||||
{{655173, "jamil-jivani-author-of-why-young-men"}, 542035},
|
||||
{{655173, "commentaries-on-jb-peterson-rebel-wisdom"}, 528898},
|
||||
{{655173, "auckland-clip-4-on-cain-and-abel"}, 629242},
|
||||
{{655173, "peterson-vs-zizek-livestream-tickets"}, 545285},
|
||||
{{655173, "auckland-clip-3-the-dawning-of-the-moral"}, 621154},
|
||||
{{655173, "religious-belief-and-the-enlightenment"}, 606269},
|
||||
{{655173, "auckland-lc-highlight-1-the-presumption"}, 565783},
|
||||
{{655173, "q-a-sir-roger-scruton-dr-jordan-b"}, 544184},
|
||||
{{655173, "cancellation-polish-national-foundation"}, 562529},
|
||||
{{655173, "the-coddling-of-the-american-mind-haidt"}, 440185},
|
||||
{{655173, "02-harris-weinstein-peterson-discussion"}, 430896},
|
||||
{{655173, "jordan-peterson-threatens-everything-of"}, 519737},
|
||||
{{655173, "on-claiming-belief-in-god-commentary"}, 581738},
|
||||
{{655173, "how-to-make-the-world-better-really-with"}, 482317},
|
||||
{{655173, "quillette-discussion-with-founder-editor"}, 413749},
|
||||
{{655173, "jb-peterson-on-free-thought-and-speech"}, 462849},
|
||||
{{655173, "marxism-zizek-peterson-official-video"}, 578453},
|
||||
{{655173, "patreon-problem-solution-dave-rubin-dr"}, 490394},
|
||||
{{655173, "next-week-st-louis-salt-lake-city"}, 445933},
|
||||
{{655173, "conversations-with-john-anderson-jordan"}, 529981},
|
||||
{{655173, "nz-australia-12-rules-tour-next-2-weeks"}, 518649},
|
||||
{{655173, "a-call-to-rebellion-for-ontario-legal"}, 285451},
|
||||
{{655173, "2016-personality-lecture-12"}, 578465},
|
||||
{{655173, "on-the-vital-necessity-of-free-speech"}, 427404},
|
||||
{{655173, "2017-01-23-social-justice-freedom-of"}, 578465},
|
||||
{{655173, "discussion-sam-harris-the-idw-and-the"}, 423332},
|
||||
{{655173, "march-2018-patreon-q-a"}, 413749},
|
||||
{{655173, "take-aim-even-badly"}, 490395},
|
||||
{{655173, "jp-f-wwbgo6a2w"}, 539940},
|
||||
{{655173, "patreon-account-deletion"}, 503477},
|
||||
{{655173, "canada-us-europe-tour-august-dec-2018"}, 413749},
|
||||
{{655173, "leaders-myth-reality-general-stanley"}, 514333},
|
||||
{{655173, "jp-ifi5kkxig3s"}, 539940},
|
||||
{{655173, "documentary-a-glitch-in-the-matrix-david"}, 413749},
|
||||
{{655173, "2017-08-14-patreon-q-and-a"}, 285451},
|
||||
{{655173, "postmodernism-history-and-diagnosis"}, 285451},
|
||||
{{655173, "23-minutes-from-maps-of-meaning-the"}, 413749},
|
||||
{{655173, "milo-forbidden-conversation"}, 578493},
|
||||
{{655173, "jp-wnjbasba-qw"}, 539940},
|
||||
{{655173, "uk-12-rules-tour-october-and-november"}, 462849},
|
||||
{{655173, "2015-maps-of-meaning-10-culture-anomaly"}, 578465},
|
||||
{{655173, "ayaan-hirsi-ali-islam-mecca-vs-medina"}, 285452},
|
||||
{{655173, "jp-f9393el2z1i"}, 539940},
|
||||
{{655173, "campus-indoctrination-the-parasitization"}, 285453},
|
||||
{{655173, "jp-owgc63khcl8"}, 539940},
|
||||
{{655173, "the-death-and-resurrection-of-christ-a"}, 413749},
|
||||
{{655173, "01-harris-weinstein-peterson-discussion"}, 430896},
|
||||
{{655173, "enlightenment-now-steven-pinker-jb"}, 413749},
|
||||
{{655173, "the-lindsay-shepherd-affair-update"}, 413749},
|
||||
{{655173, "jp-g3fwumq5k8i"}, 539940},
|
||||
{{655173, "jp-evvs3l-abv4"}, 539940},
|
||||
{{655173, "former-australian-deputy-pm-john"}, 413750},
|
||||
{{655173, "message-to-my-korean-readers-90-seconds"}, 477424},
|
||||
{{655173, "jp--0xbomwjkgm"}, 539940},
|
||||
{{655173, "ben-shapiro-jordan-peterson-and-a-12"}, 413749},
|
||||
{{655173, "jp-91jwsb7zyhw"}, 539940},
|
||||
{{655173, "deconstruction-the-lindsay-shepherd"}, 299272},
|
||||
{{655173, "september-patreon-q-a"}, 285451},
|
||||
{{655173, "jp-2c3m0tt5kce"}, 539940},
|
||||
{{655173, "australia-s-john-anderson-dr-jordan-b"}, 413749},
|
||||
{{655173, "jp-hdrlq7dpiws"}, 539940},
|
||||
{{655173, "stephen-hicks-postmodernism-reprise"}, 578480},
|
||||
{{655173, "october-patreon-q-a"}, 285451},
|
||||
{{655173, "an-animated-intro-to-truth-order-and"}, 413749},
|
||||
{{655173, "jp-bsh37-x5rny"}, 539940},
|
||||
{{655173, "january-2019-q-a"}, 503477},
|
||||
{{655173, "comedians-canaries-and-coalmines"}, 498586},
|
||||
{{655173, "the-democrats-apology-and-promise"}, 465433},
|
||||
{{655173, "jp-s4c-jodptn8"}, 539940},
|
||||
{{655173, "2014-personality-lecture-16-extraversion"}, 578465},
|
||||
{{655173, "dr-jordan-b-peterson-on-femsplainers"}, 490395},
|
||||
{{655173, "higher-ed-our-cultural-inflection-point"}, 527291},
|
||||
{{655173, "archetype-reality-friendship-and"}, 519736},
|
||||
{{655173, "sir-roger-scruton-dr-jordan-b-peterson"}, 490395},
|
||||
{{655173, "jp-cf2nqmqifxc"}, 539940},
|
||||
{{655173, "penguin-uk-12-rules-for-life"}, 413749},
|
||||
{{655173, "march-2019-q-and-a"}, 537138},
|
||||
{{655173, "jp-ne5vbomsqjc"}, 539940},
|
||||
{{655173, "dublin-london-harris-murray-new-usa-12"}, 413749},
|
||||
{{655173, "12-rules-12-cities-tickets-now-available"}, 413749},
|
||||
{{655173, "jp-j9j-bvdrgdi"}, 539940},
|
||||
{{655173, "responsibility-conscience-and-meaning"}, 499123},
|
||||
{{655173, "04-harris-murray-peterson-discussion"}, 436678},
|
||||
{{655173, "jp-ayhaz9k008q"}, 539940},
|
||||
{{655173, "with-jocko-willink-the-catastrophe-of"}, 490395},
|
||||
{{655173, "interview-with-the-grievance-studies"}, 501296},
|
||||
{{655173, "russell-brand-jordan-b-peterson-under"}, 413750},
|
||||
{{655173, "goodbye-to-patreon"}, 496771},
|
||||
{{655173, "revamped-podcast-announcement-with"}, 540943},
|
||||
{{655173, "swedes-want-to-know"}, 285453},
|
||||
{{655173, "auckland-clip-2-the-four-fundamental"}, 607892},
|
||||
{{655173, "jp-dtirzqmgbdm"}, 539940},
|
||||
{{655173, "political-correctness-a-force-for-good-a"}, 413750},
|
||||
{{655173, "sean-plunket-full-interview-new-zealand"}, 597638},
|
||||
{{655173, "q-a-the-meaning-and-reality-of"}, 616984},
|
||||
{{655173, "lecture-and-q-a-with-jordan-peterson-the"}, 413749},
|
||||
{{655173, "2017-personality-07-carl-jung-and-the"}, 578465},
|
||||
{{655173, "nina-paley-animator-extraordinaire"}, 413750},
|
||||
{{655173, "truth-as-the-antidote-to-suffering-with"}, 455127},
|
||||
{{655173, "bishop-barron-word-on-fire"}, 599814},
|
||||
{{655173, "zizek-vs-peterson-april-19"}, 527291},
|
||||
{{655173, "revamped-podcast-with-westwood-one"}, 540943},
|
||||
{{655173, "2016-11-19-university-of-toronto-free"}, 578465},
|
||||
{{655173, "jp-1emrmtrj5jc"}, 539940},
|
||||
{{655173, "who-is-joe-rogan-with-jordan-peterson"}, 585578},
|
||||
{{655173, "who-dares-say-he-believes-in-god"}, 581738},
|
||||
{{655252, "games-with-live2d"}, 589978},
|
||||
{{655252, "kaenbyou-rin-live2d"}, 589978},
|
||||
{{655374, "steam-groups-are-crazy"}, 607590},
|
||||
{{655379, "asmr-captain-falcon-happily-beats-you-up"}, 644574},
|
||||
{{655379, "pixel-art-series-5-link-holding-the"}, 442952},
|
||||
{{655379, "who-can-cross-the-planck-length-the-hero"}, 610830},
|
||||
{{655379, "ssbb-the-yoshi-grab-release-crash"}, 609747},
|
||||
{{655379, "tas-captain-falcon-s-bizarre-adventure"}, 442958},
|
||||
{{655379, "super-smash-bros-in-360-test"}, 442963},
|
||||
{{655379, "what-if-luigi-was-b-u-f-f"}, 442971},
|
||||
{{655803, "sun-time-lapse-test-7"}, 610634},
|
||||
{{655952, "upper-build-complete"}, 591728},
|
||||
{{656758, "cryptocurrency-awareness-adoption-the"}, 541770},
|
||||
{{656829, "3d-printing-technologies-comparison"}, 462685},
|
||||
{{656829, "3d-printing-for-everyone"}, 462685},
|
||||
{{657052, "tni-punya-ilmu-kanuragan-gaya-baru"}, 657045},
|
||||
{{657052, "papa-sunimah-nelpon-sri-utami-emon"}, 657045},
|
||||
{{657274, "rapforlife-4-win"}, 656856},
|
||||
{{657274, "bizzilion-proof-of-withdrawal"}, 656856},
|
||||
{{657420, "quick-drawing-prince-tribute-colored"}, 605630},
|
||||
{{657453, "white-boy-tom-mcdonald-facts"}, 597169},
|
||||
{{657453, "is-it-ok-to-look-when-you-with-your-girl"}, 610508},
|
||||
{{657584, "need-for-speed-ryzen-5-1600-gtx-1050-ti"}, 657161},
|
||||
{{657584, "quantum-break-ryzen-5-1600-gtx-1050-ti-4"}, 657161},
|
||||
{{657584, "nightcore-legends-never-die"}, 657161},
|
||||
{{657706, "mtb-enduro-ferragosto-2019-sestri"}, 638904},
|
||||
{{657706, "warface-free-for-all"}, 638908},
|
||||
{{657782, "nick-warren-at-loveland-but-not-really"}, 444299},
|
||||
{{658098, "le-temps-nous-glisse-entre-les-doigts"}, 600099},
|
||||
};
|
||||
|
||||
bool CClaimTrieCacheBase::incrementBlock(insertUndoType& insertUndo, claimUndoType& expireUndo,
|
||||
|
@ -994,14 +1171,9 @@ bool CClaimTrieCacheBase::incrementBlock(insertUndoType& insertUndo, claimUndoTy
|
|||
auto getTakeoverQuery = db << "SELECT IFNULL(takeoverHeight, 0), takeoverID FROM nodes WHERE name = ?";
|
||||
auto hasCandidateQuery = db << "UPDATE nodes SET takeoverHeight = ?, takeoverID = ? WHERE name = ?";
|
||||
auto noCandidateQuery = db << "UPDATE nodes SET takeoverHeight = NULL, takeoverID = NULL WHERE name = ?";
|
||||
auto maxWorkaround = Params().GetConsensus().nMaxTakeoverWorkaroundHeight;
|
||||
|
||||
for (const auto& nameWithTakeover : takeovers) {
|
||||
auto needsActivate = false;
|
||||
if (nNextHeight >= 496856 && nNextHeight <= 653524) {
|
||||
auto wit = takeoverWorkarounds.find(std::make_pair(nNextHeight, nameWithTakeover));
|
||||
needsActivate = wit != takeoverWorkarounds.end();
|
||||
}
|
||||
|
||||
// if somebody activates on this block and they are the new best, then everybody activates on this block
|
||||
CClaimValue candidateValue;
|
||||
auto hasCandidate = getInfoForName(nameWithTakeover, candidateValue, 1);
|
||||
|
@ -1012,10 +1184,18 @@ bool CClaimTrieCacheBase::incrementBlock(insertUndoType& insertUndo, claimUndoTy
|
|||
getTakeoverQuery++; // reset it
|
||||
|
||||
auto hasBeenSetBefore = existingID != nullptr && !existingID->IsNull();
|
||||
auto takeoverHappening = needsActivate || !hasCandidate || (hasBeenSetBefore && *existingID != candidateValue.claimId);
|
||||
auto takeoverHappening = !hasCandidate || (hasBeenSetBefore && *existingID != candidateValue.claimId);
|
||||
if (takeoverHappening && activateAllFor(insertUndo, insertSupportUndo, nameWithTakeover))
|
||||
hasCandidate = getInfoForName(nameWithTakeover, candidateValue, 1);
|
||||
|
||||
// This is a super ugly hack to work around bug in old code.
|
||||
// The bug: un/support a name then update it. This will cause its takeover height to be reset to current.
|
||||
// This is because the old code with add to the cache without setting block originals when dealing in supports.
|
||||
if (nNextHeight >= 496856 && nNextHeight < maxWorkaround) {
|
||||
auto wit = takeoverWorkarounds.find(std::make_pair(nNextHeight, nameWithTakeover));
|
||||
takeoverHappening |= wit != takeoverWorkarounds.end();
|
||||
}
|
||||
|
||||
LogPrint(BCLog::CLAIMS, "Takeover on %s (%s) at %d, happening: %d, set before: %d\n", nameWithTakeover, HexStr(nameWithTakeover), nNextHeight, takeoverHappening, hasBeenSetBefore);
|
||||
|
||||
if (takeoverHappening || !hasBeenSetBefore) {
|
||||
|
@ -1132,167 +1312,6 @@ bool CClaimTrieCacheBase::finalizeDecrement(takeoverUndoType& takeoverUndo)
|
|||
return true;
|
||||
}
|
||||
|
||||
static const boost::container::flat_set<std::pair<int, std::string>> ownershipWorkaround = {
|
||||
{ 297706, "firstvideo" },
|
||||
{ 300045, "whatislbry" },
|
||||
{ 305742, "mrrobots01e01" },
|
||||
{ 350299, "gaz" },
|
||||
{ 426898, "travtest01" },
|
||||
{ 466336, "network" },
|
||||
{ 481633, "11111111111111111111" },
|
||||
{ 538169, "cmd" },
|
||||
{ 539068, "who13" },
|
||||
{ 552082, "right" },
|
||||
{ 557322, "pixelboard" },
|
||||
{ 562221, "stats331" },
|
||||
{ 583305, "gauntlet-invade-the-darkness-lvl-1-of" },
|
||||
{ 584733, "0000001" },
|
||||
{ 584733, "0000003" },
|
||||
{ 584733, "0000002" },
|
||||
{ 588287, "livestream-project-reality-arma-3" },
|
||||
{ 588308, "fr-let-s-play-software-inc-jay" },
|
||||
{ 588308, "fr-motorsport-manager-jay-s-racing-5" },
|
||||
{ 588308, "fr-motorsport-manager-jay-s-racing" },
|
||||
{ 588318, "fr-hoi-iv-the-great-war-l-empire-2" },
|
||||
{ 588318, "fr-stellaris-distant-stars-la-pr" },
|
||||
{ 588318, "fr-stellaris-distant-stars-la-pr-2" },
|
||||
{ 588318, "fr-crusader-kings-2-la-dynastie-6" },
|
||||
{ 588318, "fr-jurassic-world-evolution-let-s-play" },
|
||||
{ 588322, "fr-cold-waters-campagne-asie-2000-2" },
|
||||
{ 588683, "calling-tech-support-scammers-live-3" },
|
||||
{ 589013, "lets-play-jackbox-games-5" },
|
||||
{ 589013, "let-s-play-jackbox-games" },
|
||||
{ 589534, "let-s-play-the-nightmare-before" },
|
||||
{ 589538, "kabutothesnake-s-live-ps4-broadcast" },
|
||||
{ 589538, "back-with-fortnite" },
|
||||
{ 589554, "no-eas-strong-thunderstorm-advisory" },
|
||||
{ 589606, "new-super-mario-bros-wii-walkthrough" },
|
||||
{ 589606, "samurai-warrior-chronicles-hero-rise" },
|
||||
{ 589630, "ullash" },
|
||||
{ 589640, "today-s-professionals-2018-winter-3" },
|
||||
{ 589640, "let-s-run-a-mall-series-6-1-18-no-more" },
|
||||
{ 589640, "today-s-professionals-2018-winter-4" },
|
||||
{ 589641, "today-s-professionals-big-brother-6-14" },
|
||||
{ 589641, "today-s-professionals-2018-winter-14" },
|
||||
{ 589641, "today-s-professionals-big-brother-6-13" },
|
||||
{ 589641, "today-s-professionals-big-brother-6-28" },
|
||||
{ 589641, "today-s-professionals-2018-winter-6" },
|
||||
{ 589641, "today-s-professionals-big-brother-6-26" },
|
||||
{ 589641, "today-s-professionals-big-brother-6-27" },
|
||||
{ 589641, "today-s-professionals-2018-winter-10" },
|
||||
{ 589641, "today-s-professionals-2018-winter-7" },
|
||||
{ 589641, "today-s-professionals-big-brother-6-29" },
|
||||
{ 589760, "bobby-blades" },
|
||||
{ 589831, "fifa-14-android-astrodude44-vs" },
|
||||
{ 589849, "gaming-and-drawing-videos-live-stream" },
|
||||
{ 589849, "gaming-with-silverwolf-live-stream-2" },
|
||||
{ 589849, "gaming-with-silverwolf-live-stream-3" },
|
||||
{ 589849, "gaming-with-silverwolf-videos-live" },
|
||||
{ 589849, "gaming-with-silverwolf-live-stream-4" },
|
||||
{ 589849, "gaming-with-silverwolf-live-stream-5" },
|
||||
{ 589851, "gaming-with-silverwolf-live-stream-7" },
|
||||
{ 589851, "gaming-with-silverwolf-live-stream-6" },
|
||||
{ 589870, "classic-sonic-games" },
|
||||
{ 589926, "j-dog7973-s-fortnite-squad" },
|
||||
{ 589967, "wow-warlords-of-draenor-horde-side" },
|
||||
{ 590020, "come-chill-with-rekzzey-2" },
|
||||
{ 590033, "gothsnake-black-ops-ii-game-clip" },
|
||||
{ 590074, "a-new-stream" },
|
||||
{ 590075, "a-new-stream" },
|
||||
{ 590082, "a-new-stream" },
|
||||
{ 590116, "a-new-stream" },
|
||||
{ 590178, "father-vs-son-stickfight-stickfight" },
|
||||
{ 590178, "little-t-playing-subnautica-livestream" },
|
||||
{ 590179, "my-family-trip-with-my-mom-and-sister" },
|
||||
{ 590206, "pomskies" },
|
||||
{ 590223, "dark-souls-iii-soul-level-1-challenge-2" },
|
||||
{ 590223, "dark-souls-iii-soul-level-1-challenge" },
|
||||
{ 590223, "dark-souls-iii-soul-level-1-challenge-3" },
|
||||
{ 590225, "skyrim-special-edition-ps4-platinum-3" },
|
||||
{ 590225, "skyrim-special-edition-ps4-platinum-4" },
|
||||
{ 590225, "let-s-play-sniper-elite-4-authentic-2" },
|
||||
{ 590226, "let-s-play-final-fantasy-the-zodiac-2" },
|
||||
{ 590226, "let-s-play-final-fantasy-the-zodiac-3" },
|
||||
{ 590401, "ls-h-ppchen-halloween-stream-vom-31-10" },
|
||||
{ 591982, "destiny-the-taken-king-gameplay" },
|
||||
{ 591984, "ghost-recon-wildlands-100-complete-4" },
|
||||
{ 591986, "uncharted-the-lost-legacy-100-complete" },
|
||||
{ 593535, "3-smg4-reactions-in-1-gabrieloreacts" },
|
||||
{ 593550, "speed-runs-community-versus-video" },
|
||||
{ 593551, "rayman-legends-challenges-app-murphy-s" },
|
||||
{ 593551, "rayman-legends-challenges-app-the" },
|
||||
{ 593726, "dmt-psychedelics-death-and-rebirth" },
|
||||
{ 593726, "flat-earth-and-other-shill-potatoes" },
|
||||
{ 593726, "why-everyone-s-leaving-youtube" },
|
||||
{ 595537, "memory-techniques-1-000-people-system" },
|
||||
{ 595556, "qik-mobile-video-by-paul-clifford" },
|
||||
{ 595818, "ohare12345-s-live-ps4-broadcast" },
|
||||
{ 595838, "super-smash-bros-u-3-minute-smash-as" },
|
||||
{ 595838, "super-smash-bros-u-multi-man-smash-3" },
|
||||
{ 595838, "super-smash-bros-u-target-blast-3" },
|
||||
{ 595838, "super-smash-bros-u-donkey-kong-tourney" },
|
||||
{ 595839, "super-smash-bros-u-super-mario-u-smash" },
|
||||
{ 595841, "super-smash-bros-u-zelda-smash-series" },
|
||||
{ 595841, "super-smash-bros-u-tournament-series" },
|
||||
{ 595841, "super-smash-bros-u-link-tourney-mode-a" },
|
||||
{ 595841, "super-smash-bros-u-brawl-co-op-event" },
|
||||
{ 595841, "super-smash-bros-u-link-tourney-mode-b" },
|
||||
{ 595842, "super-smash-bros-u-3-newcomers-the" },
|
||||
{ 595844, "super-smash-bros-u-home-run-contest-2" },
|
||||
{ 596829, "gramy-minecraft" },
|
||||
{ 596829, "gramy-minecraft-jasmc-pl" },
|
||||
{ 597635, "5-new-technology-innovations-in-5" },
|
||||
{ 597658, "borderlands-2-tiny-tina-s-assault-on" },
|
||||
{ 597658, "let-s-play-borderlands-the-pre-sequel" },
|
||||
{ 597660, "caveman-world-mountains-of-unga-boonga" },
|
||||
{ 597787, "playing-hypixel-webcam-and-mic" },
|
||||
{ 597789, "if-herobrine-played-yandere-simulator" },
|
||||
{ 597794, "user-registration-system-in-php-mysql" },
|
||||
{ 597796, "let-s-play-mario-party-luigi-s-engine" },
|
||||
{ 597796, "let-s-play-mario-party-dk-s-jungle" },
|
||||
{ 597803, "asphalt-8-gameplay" },
|
||||
{ 597817, "roblox-phantom-forces-no-audio-just" },
|
||||
{ 597824, "best-funny-clip" },
|
||||
{ 597825, "let-s-play-fallout-2-restoration-3" },
|
||||
{ 597826, "saturday-night-baseball-with-3" },
|
||||
{ 597826, "saturday-night-baseball-with-6" },
|
||||
{ 597829, "payeer" },
|
||||
{ 597831, "dreamtowards" },
|
||||
{ 597833, "20000" },
|
||||
{ 597833, "remme" },
|
||||
{ 597834, "hycon" },
|
||||
{ 597834, "hearthstone-heroes-of-warcraft-3" },
|
||||
{ 597837, "15-curiosidades-que-probablemente-ya" },
|
||||
{ 597893, "elder-scrolls-online-road-to-level-20" },
|
||||
{ 597894, "elder-scrolls-legends-beta-gameplay" },
|
||||
{ 597900, "fallout-4-walkthrough" },
|
||||
{ 597901, "wwe-2k18-with-that-guy-and-tricky" },
|
||||
{ 597902, "dead-space-walkthroug-wcommentary-part" },
|
||||
{ 597903, "how-it-feels-to-chew-5-gum-funny" },
|
||||
{ 597909, "president-obama-apec-press-conference" },
|
||||
{ 597909, "100-5" },
|
||||
{ 597910, "eat-the-street" },
|
||||
{ 597923, "rocket-league-giveaway-3" },
|
||||
{ 597923, "mortal-kombat-xl-livestream" },
|
||||
{ 597930, "lets-play-spore-with" },
|
||||
{ 597931, "lets-play-minecraft-with" },
|
||||
{ 597932, "for-honor-4" },
|
||||
{ 597933, "memorize-english-words-scientifically" },
|
||||
{ 597933, "true-mov" },
|
||||
{ 597935, "jugando-pokemon-esmeralda-gba" },
|
||||
{ 597936, "gta-5-livestream-85-92" },
|
||||
{ 597937, "battlefield-hardline-9-19" },
|
||||
{ 598070, "mechwarrior-2-soundtrack-clan-jade" },
|
||||
{ 606424, "@apostrophe" },
|
||||
{ 615725, "amazonianhunter" },
|
||||
{ 615726, "amazonianhunter" },
|
||||
{ 630930, "cli" },
|
||||
{ 638876, "@ordinary" },
|
||||
{ 638878, "@ordinary" },
|
||||
{ 644575, "ratio" },
|
||||
{ 646584, "calling-tech-support-scammers-live-3" },
|
||||
};
|
||||
|
||||
int CClaimTrieCacheBase::getDelayForName(const std::string& name, const uint160& claimId) const
|
||||
{
|
||||
uint160 winningClaimId;
|
||||
|
@ -1303,8 +1322,13 @@ int CClaimTrieCacheBase::getDelayForName(const std::string& name, const uint160&
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (nNextHeight <= 646584 && ownershipWorkaround.find(std::make_pair(nNextHeight, name)) != ownershipWorkaround.end())
|
||||
// NOTE: old code had a bug in it where nodes with no claims but with children would get left in the cache after removal.
|
||||
// This would cause the getNumBlocksOfContinuousOwnership to return zero (causing incorrect takeover height calc).
|
||||
auto hit = removalWorkaround.find(name);
|
||||
if (hit != removalWorkaround.end()) {
|
||||
removalWorkaround.erase(hit);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return found ? std::min((nNextHeight - winningTakeoverHeight) / base->nProportionalDelayFactor, 4032) : 0;
|
||||
}
|
||||
|
@ -1321,7 +1345,7 @@ bool CClaimTrieCacheBase::getProofForName(const std::string& name, const uint160
|
|||
proof = CClaimTrieProof();
|
||||
auto nodeQuery = db << "SELECT name, IFNULL(takeoverHeight, 0) FROM nodes WHERE "
|
||||
"name IN (WITH RECURSIVE prefix(p) AS (VALUES(?) UNION ALL "
|
||||
"SELECT SUBSTR(p, 1, LENGTH(p)-1) FROM prefix WHERE p != '') SELECT p FROM prefix) "
|
||||
"SELECT POPS(p) FROM prefix WHERE p != '') SELECT p FROM prefix) "
|
||||
"ORDER BY name" << name;
|
||||
for (auto&& row: nodeQuery) {
|
||||
CClaimValue claim;
|
||||
|
|
|
@ -383,6 +383,8 @@ protected:
|
|||
mutable sqlite::database db;
|
||||
int nNextHeight; // Height of the block that is being worked on, which is
|
||||
bool transacting;
|
||||
mutable std::unordered_set<std::string> removalWorkaround;
|
||||
|
||||
// one greater than the height of the chain's tip
|
||||
|
||||
mutable sqlite::database_binder claimHashQuery, childHashQuery;
|
||||
|
|
|
@ -144,27 +144,34 @@ bool CClaimTrieCacheNormalizationFork::normalizeAllNamesInTrieIfNecessary(takeov
|
|||
|
||||
// make the new nodes
|
||||
db << "INSERT INTO nodes(name) SELECT NORMALIZED(name) AS nn FROM claims WHERE nn != nodeName "
|
||||
"ON CONFLICT(name) DO UPDATE SET hash = NULL";
|
||||
"AND validHeight <= ?1 AND expirationHeight > ?1 ON CONFLICT(name) DO UPDATE SET hash = NULL" << nNextHeight;
|
||||
db << "UPDATE nodes SET hash = NULL WHERE name IN "
|
||||
"(SELECT NORMALIZED(name) AS nn FROM supports WHERE nn != nodeName)";
|
||||
"(SELECT NORMALIZED(name) AS nn FROM supports WHERE nn != nodeName "
|
||||
"AND validHeight <= ?1 AND expirationHeight > ?1)" << nNextHeight;
|
||||
|
||||
// update the claims and supports
|
||||
db << "UPDATE claims SET nodeName = NORMALIZED(name)";
|
||||
db << "UPDATE supports SET nodeName = NORMALIZED(name)";
|
||||
db << "UPDATE claims SET nodeName = NORMALIZED(name) WHERE validHeight <= ?1 AND expirationHeight > ?1" << nNextHeight;
|
||||
db << "UPDATE supports SET nodeName = NORMALIZED(name) WHERE validHeight <= ?1 AND expirationHeight > ?1" << nNextHeight;
|
||||
|
||||
// remove the old nodes
|
||||
auto query = db << "SELECT name, IFNULL(takeoverHeight, 0), takeoverID FROM nodes "
|
||||
"WHERE name NOT IN (SELECT nodeName FROM claims)";
|
||||
auto query = db << "SELECT name, IFNULL(takeoverHeight, 0), takeoverID FROM nodes WHERE name NOT IN "
|
||||
"(SELECT nodeName FROM claims WHERE validHeight <= ?1 AND expirationHeight > ?1)";
|
||||
for (auto&& row: query) {
|
||||
std::string name;
|
||||
int takeoverHeight;
|
||||
std::unique_ptr<uint160> takeoverID;
|
||||
row >> name >> takeoverHeight >> takeoverID;
|
||||
if (name.empty()) continue; // preserve our root node
|
||||
if (takeoverHeight > 0)
|
||||
takeoverUndo.emplace_back(name, std::make_pair(takeoverHeight, takeoverID ? *takeoverID : uint160()));
|
||||
// we need to let the tree structure method do the actual node delete:
|
||||
db << "UPDATE nodes SET hash = NULL WHERE name = ?" << name;
|
||||
}
|
||||
db << "UPDATE nodes SET hash = NULL WHERE takeoverHeight IS NULL";
|
||||
|
||||
// work around a bug in the old implementation:
|
||||
db << "UPDATE claims SET validHeight = ?1 " // force a takeover on these
|
||||
"WHERE blockHeight < ?1 AND validHeight > ?1 AND nodeName != name" << nNextHeight;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -177,7 +184,7 @@ bool CClaimTrieCacheNormalizationFork::unnormalizeAllNamesInTrieIfNecessary()
|
|||
db.define("NORMALIZED", [this](const std::string& str) { return normalizeClaimName(str, true); });
|
||||
|
||||
db << "INSERT INTO nodes(name) SELECT name FROM claims WHERE name != nodeName "
|
||||
"ON CONFLICT(name) DO UPDATE SET hash = NULL";
|
||||
"AND validHeight < ?1 AND expirationHeight > ?1 ON CONFLICT(name) DO UPDATE SET hash = NULL" << nNextHeight;
|
||||
db << "UPDATE nodes SET hash = NULL WHERE name IN "
|
||||
"(SELECT name FROM supports WHERE name != nodeName UNION "
|
||||
"SELECT nodeName FROM supports WHERE name != nodeName UNION "
|
||||
|
@ -197,7 +204,42 @@ bool CClaimTrieCacheNormalizationFork::incrementBlock(insertUndoType& insertUndo
|
|||
{
|
||||
if (nNextHeight == Params().GetConsensus().nNormalizedNameForkHeight)
|
||||
normalizeAllNamesInTrieIfNecessary(takeoverUndo);
|
||||
return CClaimTrieCacheExpirationFork::incrementBlock(insertUndo, expireUndo, insertSupportUndo, expireSupportUndo, takeoverUndo);
|
||||
auto ret = CClaimTrieCacheExpirationFork::incrementBlock(insertUndo, expireUndo, insertSupportUndo, expireSupportUndo, takeoverUndo);
|
||||
// if (nNextHeight == 588319) {
|
||||
// getMerkleHash();
|
||||
// auto q2 = db << "SELECT name, nodeName FROM claims WHERE nodeName NOT IN (SELECT name FROM nodes) "
|
||||
// "AND validHeight < ?1 AND expirationHeight >= ?1" << nNextHeight;
|
||||
// for (auto&& row: q2) {
|
||||
// std::string name, nn;
|
||||
// row >> name >> nn;
|
||||
// LogPrintf("BAD NAME 2: %s, %s\n", name, nn);
|
||||
// }
|
||||
// std::ifstream input("dump588318.txt");
|
||||
// std::string line;
|
||||
// std::vector<std::string> lines;
|
||||
// while (std::getline(input, line)) {
|
||||
// lines.push_back(line);
|
||||
// }
|
||||
// std::sort(lines.begin(), lines.end());
|
||||
// auto q3 = db << "SELECT n.name, n.hash, IFNULL(n.takeoverHeight, 0), "
|
||||
// "(SELECT COUNT(*) FROM claims c WHERE c.nodeName = n.name "
|
||||
// "AND validHeight < ?1 AND expirationHeight >= ?1) as cc FROM nodes n ORDER BY n.name" << nNextHeight;
|
||||
// for (auto&& row: q3) {
|
||||
// std::string name; int takeover, childs; uint256 hash;
|
||||
// row >> name >> hash >> takeover >> childs;
|
||||
// std::string m = name + ", " + std::to_string(name.size()) + ", " + hash.GetHex() + ", " + std::to_string(takeover) + ", " + std::to_string(childs);
|
||||
// if (!std::binary_search(lines.begin(), lines.end(), m)) {
|
||||
// LogPrintf("BAD BAD: %s\n", m);
|
||||
// }
|
||||
// }
|
||||
// auto q4 = db << "SELECT n.name, n.parent FROM nodes n LEFT JOIN claims c ON n.name = c.nodeName LEFT JOIN nodes n2 ON n.name = n2.parent WHERE c.nodeName IS NULL AND n2.parent IS NULL";
|
||||
// for (auto&& row: q4) {
|
||||
// std::string name, nn;
|
||||
// row >> name >> nn;
|
||||
// LogPrintf("BAD NAME 3: %s, %s\n", name, nn);
|
||||
// }
|
||||
// }
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool CClaimTrieCacheNormalizationFork::decrementBlock(insertUndoType& insertUndo, claimUndoType& expireUndo, insertUndoType& insertSupportUndo, supportUndoType& expireSupportUndo)
|
||||
|
@ -353,7 +395,7 @@ bool CClaimTrieCacheHashFork::getProofForName(const std::string& name, const uin
|
|||
proof = CClaimTrieProof();
|
||||
auto nodeQuery = db << "SELECT name, IFNULL(takeoverHeight, 0) FROM nodes WHERE "
|
||||
"name IN (WITH RECURSIVE prefix(p) AS (VALUES(?) UNION ALL "
|
||||
"SELECT SUBSTR(p, 1, LENGTH(p)-1) FROM prefix WHERE p != '') SELECT p FROM prefix) "
|
||||
"SELECT POPS(p) FROM prefix WHERE p != '') SELECT p FROM prefix) "
|
||||
"ORDER BY name" << name;
|
||||
for (auto&& row: nodeQuery) {
|
||||
std::string key;;
|
||||
|
|
Loading…
Reference in a new issue