This commit is contained in:
jl777
2017-03-21 21:05:11 +02:00
parent f2919b68d9
commit 74a1cd7aa8

View File

@@ -706,16 +706,31 @@ bool IsStandardTx(const CTransaction& tx, string& reason)
return true;
}
int32_t komodo_grandfathered(uint32_t nBlockTime)
int32_t komodo_grandfathered(uint32_t locktime)
{
static uint32_t grandfathered[] = //1477262652
{
1477262681, 1477262990, 1477598030, 1477269321, 1480625490, 1482008580, 1485678643, 1485972116, 1486039258, 1486096477, 1486159886, 1486236495, 1486305013, 1486390414, 1486390791, 1486391232, 1486395617, 1486415304, 1486439074, 1486507244, 1486536946, 1486766037, 1486766559, 1486768230, 1486768294, 1487355181, 1487356312, 1487449891, 1487467926, 1487614001, 1487639158, 1489298992, 1489299229, 1489299737, 1489299939, 1489300155, 1489300326, 1489300370, 1489408020, 1489408285, 1489438206, 1489463334, 1489519879, 1489519942, 1489519818, 1489597387, 1489663030, 1489687820, 1489796259, 1489838437, 1489847404, 1490022684, 1490117937, 1490118373
//1477262681, 1477262990, 1477598030, 1477269321, 1480625490, 1482008580, 1485678643, 1485972116, 1486039258, 1486096477, 1486159886, 1486236495, 1486305013, 1486390414, 1486390791, 1486391232, 1486395617, 1486415304, 1486439074, 1486507244, 1486536946, 1486766037, 1486766559, 1486768230, 1486768294, 1487355181, 1487356312, 1487449891, 1487467926, 1487614001, 1487639158, 1489298992, 1489299229, 1489299737, 1489299939, 1489300155, 1489300326, 1489300370, 1489408020, 1489408285, 1489438206, 1489463334, 1489519879, 1489519942, 1489519818, 1489597387, 1489663030, 1489687820, 1489796259, 1489838437, 1489847404, 1490022684, 1490117937, 1490118373
1477258935, 1477257204, 1477253947, 1477254016, 1477251241, 1477251105, 1477250875, 1477249280,
1477249145, 1477249036, 1477248998, 1477248821, 1477248760, 1477248662, 1477248623, 1477248467,
1477248430, 1477248389, 1477248268, 1477247602, 1477247563, 1477247480, 1477247443, 1477247152,
1477246967, 1477246843, 1477246772, 1477246737, 1477246659, 1477246372, 1477246214, 1477245870,
1477245519, 1477245434, 1477245280, 1477245043, 1477244956, 1477244721, 1477244574, 1477244444,
1477244345, 1477244293, 1477253223, 1477253297, 1477252992, 1477253025, 1477256283, 1476963619,
1480538961, 1480538961, 1481994241, 1485376185, 1485964187, 1486019481, 1486126273, 1486232034,
1486231980, 1486158028, 1486381700, 1486367151, 1486369396, 1486369400, 1486369739, 1486381492,
1486502320, 1486496032, 1486507806, 1486490938, 1485981956, 1486466190, 1487578969, 1487625710,
1488740061, 1489381998, 1489368980, 1489394298, 1489379223, 1489373356, 1489381621, 1489385381,
1489383213, 1489419739, 1489381922, 1489511155, 1489372632, 1489519630, 1489683097, 1489695388,
1489817053, 1489814059, 1489958883
};
int32_t i;
for (i=0; i<sizeof(grandfathered)/sizeof(*grandfathered); i++)
if ( nBlockTime == grandfathered[i] )
return(i);
if ( locktime <= grandfathered[sizeof(grandfathered)/sizeof(*grandfathered) - 1] )
{
for (i=0; i<sizeof(grandfathered)/sizeof(*grandfathered); i++)
if ( nBlockTime == grandfathered[i] )
return(i);
}
return(-1);
}
@@ -729,7 +744,7 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime,int
if ( komodo_grandfathered(tx.nLockTime) < 0 )
{
fprintf(stderr,"[%d] IsFinalTx reject locktime %u vs nBlockTime %u\n",(int32_t)(tx.nLockTime-nBlockTime),tx.nLockTime,(uint32_t)nBlockTime);
//return(false); // need to prevent pastdating tx
return(false); // need to prevent pastdating tx
} else fprintf(stderr,"IsFinalTx grandfather locktime %u vs nBlockTime %u\n",tx.nLockTime,(uint32_t)nBlockTime);
}
if ((int64_t)tx.nLockTime < ((int64_t)tx.nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime))
@@ -890,7 +905,7 @@ int32_t komodo_validate_interest(const CTransaction& tx)
if ( komodo_grandfathered(locktime) < 0 )
{
fprintf(stderr,"komodo_validate_interest reject locktime %u/%u vs nBlockTime %u tiptime.%u\n",(uint32_t)tx.nLockTime,locktime,(uint32_t)chainActive.Tip()->nTime,tiptime);
//return(-1);
return(-1);
}
}
}