revert short reorg limit. Add some comments to dailysnapshot
This commit is contained in:
@@ -292,7 +292,7 @@ int32_t payments_gettokenallocations(int32_t top, int32_t bottom, const std::vec
|
|||||||
/*
|
/*
|
||||||
- check tokenid exists.
|
- check tokenid exists.
|
||||||
- iterate tokenid address and extract all pubkeys, add to map.
|
- 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
|
- convert balances to mpz_t and add up totalallocations
|
||||||
- sort the map into a vector, then convert to the correct output.
|
- 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
|
else
|
||||||
{
|
{
|
||||||
|
// NOTE: should make this default behaviour.
|
||||||
// truncate off any vouts that are less than minimum.
|
// truncate off any vouts that are less than minimum.
|
||||||
mtx.vout.resize(i+1);
|
mtx.vout.resize(i+1);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -656,8 +656,12 @@ std::vector <std::pair<CAmount, CTxDestination>> vAddressSnapshot;
|
|||||||
|
|
||||||
bool komodo_dailysnapshot(int32_t height)
|
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;
|
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 )
|
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.
|
// 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.
|
||||||
|
|||||||
Reference in New Issue
Block a user