diff --git a/src/cc/payments.cpp b/src/cc/payments.cpp index 6207915d9..0ea339f3a 100644 --- a/src/cc/payments.cpp +++ b/src/cc/payments.cpp @@ -292,7 +292,7 @@ int32_t payments_gettokenallocations(int32_t top, int32_t bottom, const std::vec /* - check tokenid exists. - iterate tokenid address and extract all pubkeys, add to map. - - rewind to last notarized height for balances? + - rewind to last notarized height for balances? see main.cpp: line# 660. - convert balances to mpz_t and add up totalallocations - sort the map into a vector, then convert to the correct output. */ @@ -885,6 +885,7 @@ UniValue PaymentsRelease(struct CCcontract_info *cp,char *jsonstr) } else { + // NOTE: should make this default behaviour. // truncate off any vouts that are less than minimum. mtx.vout.resize(i+1); break; diff --git a/src/main.cpp b/src/main.cpp index 20354fd59..7198fe7e6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -656,8 +656,12 @@ std::vector > vAddressSnapshot; bool komodo_dailysnapshot(int32_t height) { - int reorglimit = 10; // CHANGE BACK TO 100 AFTER TESTING! + int reorglimit = 100; uint256 notarized_hash,notarized_desttxid; int32_t prevMoMheight,notarized_height,undo_height,extraoffset; + // NOTE: To make this 100% safe under all sync conditions, it should be using a notarized notarization, from the DB. + // Under heavy reorg attack, its possible `komodo_notarized_height` can return a height that can't be found on chain sync. + // However, the DB can reorg the last notarization. By using 2 deep, we know 100% that the previous notarization cannot be reorged by online nodes, + // and as such will always be notarizing the same height. May need to check heights on scan back to make sure they are confirmed in correct order. if ( (extraoffset= height % KOMODO_SNAPSHOT_INTERVAL) != 0 ) { // we are on chain init, and need to scan all the way back to the correct height, other wise our node will have a diffrent snapshot to online nodes.