Browse Source

Test

pull/4/head
jl777 7 years ago
parent
commit
f0279d992f
  1. 17
      src/komodo_gateway.h
  2. 6
      src/komodo_interest.h
  3. 17
      src/main.cpp

17
src/komodo_gateway.h

@ -694,15 +694,22 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
}
prevtotal = total;
}
if ( overflow != 0 || total > COIN/10 )
if ( ASSETCHAINS_SYMBOL[0] == 0 )
{
//fprintf(stderr,">>>>>>>> <<<<<<<<<< ht.%d illegal nonz output %.8f n.%d\n",height,dstr(block.vtx[0].vout[1].nValue),n);
if ( height >= 235300 )
if ( overflow != 0 || total > COIN/10 )
{
//fprintf(stderr,">>>>>>>> <<<<<<<<<< ht.%d illegal nonz output %.8f n.%d\n",height,dstr(block.vtx[0].vout[1].nValue),n);
if ( height >= 235300 )
return(-1);
}
}
else
{
if ( overflow != 0 || total > 0 )
return(-1);
}
return(0);
}
//fprintf(stderr,"ht.%d n.%d nValue %.8f (%d %d %d)\n",height,n,dstr(block.vtx[0].vout[1].nValue),KOMODO_PAX,komodo_isrealtime(&ht),KOMODO_PASSPORT_INITDONE);
offset += komodo_scriptitemlen(&opretlen,&script[offset]);
if ( ASSETCHAINS_SYMBOL[0] == 0 )
@ -745,7 +752,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
return(0);
if ( baseid == USD ) // 6820 in balance calcs
{
if ( height <= 2000 || height == 2968 || height == 2960 || height == 2649 || height == 3275 || height == 3282 || height == 3328 || height == 3468 )
if ( height <= 6821 || height <= 2000 || height == 2968 || height == 2960 || height == 2649 || height == 3275 || height == 3282 || height == 3328 || height == 3468 )
return(0);
}
else if ( baseid == EUR )

6
src/komodo_interest.h

@ -75,6 +75,8 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin
{
if ( minutes > 365 * 24 * 60 )
minutes = 365 * 24 * 60;
if ( txheight >= 275000 )
minutes -= 59;
denominator = (((uint64_t)365 * 24 * 60) / minutes);
if ( denominator == 0 )
denominator = 1; // max KOMODO_INTEREST per transfer, do it at least annually!
@ -104,7 +106,7 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin
if ( exception == 0 )
{
numerator = (nValue / 20); // assumes 5%!
if ( txheight < 300000 )
if ( txheight < 275000 )
interest = (numerator / denominator);
else interest = (numerator * minutes) / ((uint64_t)365 * 24 * 60);
}
@ -117,7 +119,7 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin
else
{
numerator = (nValue * KOMODO_INTEREST);
if ( txheight < 300000 || numerator * minutes < 365 * 24 * 60 )
if ( txheight < 275000 || numerator * minutes < 365 * 24 * 60 )
interest = (numerator / denominator) / COIN;
else interest = ((numerator * minutes) / ((uint64_t)365 * 24 * 60)) / COIN;
}

17
src/main.cpp

@ -708,12 +708,23 @@ bool IsStandardTx(const CTransaction& tx, string& reason)
bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
{
static uin32_t grandfathered[] =
{
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
};
int32_t i;
if (tx.nLockTime == 0)
return true;
if ( ASSETCHAINS_SYMBOL[0] == 0 && nBlockTime != 1477598030 && nBlockTime != 1477269321 && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && (int64_t)tx.nLockTime < nBlockTime-3600 )
if ( ASSETCHAINS_SYMBOL[0] == 0 && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && (int64_t)tx.nLockTime < nBlockTime-3600 )
{
fprintf(stderr,"IsFinalTx reject locktime %u vs nBlockTime %u\n",tx.nLockTime,(uint32_t)nBlockTime);
return(false); // need to prevent pastdating tx
for (i=0; i<sizeof(grandfathered)/sizeof(*grandfathered); i++)
if ( nBlockTime == grandfathered[i] )
break;
if ( i == sizeof(grandfathered)/sizeof(*grandfathered) )
{
fprintf(stderr,"IsFinalTx reject locktime %u vs nBlockTime %u\n",tx.nLockTime,(uint32_t)nBlockTime);
return(false); // need to prevent pastdating tx
}
}
if ((int64_t)tx.nLockTime < ((int64_t)tx.nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime))
return true;

Loading…
Cancel
Save