Rescue stuff
This commit is contained in:
@@ -961,12 +961,35 @@ int64_t utxo_value(char *refcoin,char *srcaddr,bits256 txid,int32_t v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct addritem { int64_t total,numutxos; char addr[64]; } ADDRESSES[1200];
|
struct addritem { int64_t total,numutxos; char addr[64]; } ADDRESSES[1200];
|
||||||
struct claimitem { int64_t total,numutxos; char oldaddr[64],destaddr[64],username[64]; } CLAIMS[1200];
|
struct claimitem { int64_t total; int32_t numutxos,disputed; char oldaddr[64],destaddr[64],username[64]; } CLAIMS[1200];
|
||||||
int32_t NUM_ADDRESSES,NUM_CLAIMS;
|
int32_t NUM_ADDRESSES,NUM_CLAIMS;
|
||||||
|
|
||||||
int32_t update_claimstats(char *username,char *oldaddr,char *destaddr,int64_t amount)
|
int64_t update_claimstats(char *username,char *oldaddr,char *destaddr,int64_t amount)
|
||||||
{
|
{
|
||||||
|
int32_t i; struct claimitem *item;
|
||||||
|
for (i=0; i<NUM_CLAIMS; i++)
|
||||||
|
{
|
||||||
|
if ( strcmp(oldaddr,CLAIMS[i].oldaddr) == 0 )
|
||||||
|
{
|
||||||
|
item = &CLAIMS[i];
|
||||||
|
if ( strcmp(destaddr,item->destaddr) != 0 )//|| strcmp(username,item->username) != 0 )
|
||||||
|
{
|
||||||
|
item->disputed++;
|
||||||
|
printf("disputed.%d claim.%-4d: (%36s -> %36s %s) vs. (%36s -> %36s %s) \n",item->disputed,i,oldaddr,destaddr,username,item->oldaddr,item->destaddr,item->username);
|
||||||
|
}
|
||||||
|
item->numutxos++;
|
||||||
|
item->total += amount;
|
||||||
|
return(amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item = &CLAIMS[NUM_CLAIMS++];
|
||||||
|
item->total = amount;
|
||||||
|
item->numutxos = 1;
|
||||||
|
strncpy(item->oldaddr,oldaddr,sizeof(item->oldaddr));
|
||||||
|
strncpy(item->destaddr,destaddr,sizeof(item->destaddr));
|
||||||
|
strncpy(item->username,username,sizeof(item->username));
|
||||||
|
//printf("new claim.%-4d: %36s %16.8f -> %36s %s\n",NUM_CLAIMS,oldaddr,dstr(amount),destaddr,username);
|
||||||
|
return(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t update_addrstats(char *srcaddr,int64_t amount)
|
int32_t update_addrstats(char *srcaddr,int64_t amount)
|
||||||
@@ -1031,7 +1054,7 @@ void genpayout(char *coinstr,char *destaddr,int32_t amount)
|
|||||||
|
|
||||||
void reconcile_claims(char *fname)
|
void reconcile_claims(char *fname)
|
||||||
{
|
{
|
||||||
FILE *fp; double amount; int32_t i,n,numlines = 0; char buf[1024],fields[16][256],*str;
|
FILE *fp; double amount; int32_t i,n,numlines = 0; char buf[1024],fields[16][256],*str; int64_t total = 0;
|
||||||
if ( (fp= fopen(fname,"rb")) != 0 )
|
if ( (fp= fopen(fname,"rb")) != 0 )
|
||||||
{
|
{
|
||||||
while ( fgets(buf,sizeof(buf),fp) > 0 )
|
while ( fgets(buf,sizeof(buf),fp) > 0 )
|
||||||
@@ -1048,7 +1071,7 @@ void reconcile_claims(char *fname)
|
|||||||
i = 0;
|
i = 0;
|
||||||
if ( n != 4 && n > 1 )
|
if ( n != 4 && n > 1 )
|
||||||
{
|
{
|
||||||
printf("(%16s) ",fields[n]);
|
//printf("(%16s) ",fields[n]);
|
||||||
}
|
}
|
||||||
n++;
|
n++;
|
||||||
if ( *str == '\n' || *str == '\r' )
|
if ( *str == '\n' || *str == '\r' )
|
||||||
@@ -1058,15 +1081,13 @@ void reconcile_claims(char *fname)
|
|||||||
str++;
|
str++;
|
||||||
else fields[n][i++] = *str++;
|
else fields[n][i++] = *str++;
|
||||||
}
|
}
|
||||||
printf("%s\n",fields[0]);
|
//printf("%s\n",fields[0]);
|
||||||
//for (i=0; i<n; i++)
|
total += update_claimstats(fields[0],fields[2],fields[5],atof(fields[3])*SATOSHIDEN + 0.0000000049);
|
||||||
// if ( i != 4 )
|
|
||||||
// printf("(%s) ",fields[i]);
|
|
||||||
//printf("n.%d\n",n);
|
|
||||||
numlines++;
|
numlines++;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
printf("total claims %.8f\n",dstr(total));
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t main(int32_t argc,char **argv)
|
int32_t main(int32_t argc,char **argv)
|
||||||
@@ -1135,7 +1156,7 @@ int32_t main(int32_t argc,char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t oldmain(int32_t argc,char **argv)
|
int32_t zmigratemain(int32_t argc,char **argv)
|
||||||
{
|
{
|
||||||
char buf[1024],*zsaddr,*coinstr;
|
char buf[1024],*zsaddr,*coinstr;
|
||||||
if ( argc != 3 )
|
if ( argc != 3 )
|
||||||
|
|||||||
@@ -627,7 +627,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
|
|||||||
|
|
||||||
const char *banned_txids[] =
|
const char *banned_txids[] =
|
||||||
{
|
{
|
||||||
"78cb4e21245c26b015b888b14c4f5096e18137d2741a6de9734d62b07014dfca", //233559
|
"78cb4e21245c26b015b888b14c4f5096e18137d2741a6de9734d62b07014dfca", // vout1 only 233559
|
||||||
"00697be658e05561febdee1aafe368b821ca33fbb89b7027365e3d77b5dfede5", //234172
|
"00697be658e05561febdee1aafe368b821ca33fbb89b7027365e3d77b5dfede5", //234172
|
||||||
"e909465788b32047c472d73e882d79a92b0d550f90be008f76e1edaee6d742ea", //234187
|
"e909465788b32047c472d73e882d79a92b0d550f90be008f76e1edaee6d742ea", //234187
|
||||||
"f56c6873748a327d0b92b8108f8ec8505a2843a541b1926022883678fb24f9dc", //234188
|
"f56c6873748a327d0b92b8108f8ec8505a2843a541b1926022883678fb24f9dc", //234188
|
||||||
@@ -645,8 +645,21 @@ const char *banned_txids[] =
|
|||||||
// all vouts banned
|
// all vouts banned
|
||||||
"c4ea1462c207547cd6fb6a4155ca6d042b22170d29801a465db5c09fec55b19d", //246748
|
"c4ea1462c207547cd6fb6a4155ca6d042b22170d29801a465db5c09fec55b19d", //246748
|
||||||
"305dc96d8bc23a69d3db955e03a6a87c1832673470c32fe25473a46cc473c7d1", //247204
|
"305dc96d8bc23a69d3db955e03a6a87c1832673470c32fe25473a46cc473c7d1", //247204
|
||||||
|
"43416a0c4da6b1a5c1d375bdbe8f7dc8d44d8f60df593d3376aa8221ec66357e", // vout0 only
|
||||||
|
"1eb295ed54c47f35cbccd7e7e40d03041f1853581da6d41102a9d8813782b6cb",
|
||||||
|
"db121e4012222adfc841824984a2a90b7e5b018dd71307822537d58160195e43",
|
||||||
|
"28f95b8148ac4ae6e09c7380e34422fab41d568a411e53dc94823e36a3d6f386",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int32_t komodo_checkvout(int32_t vout,int32_t k,int32_t indallvouts)
|
||||||
|
{
|
||||||
|
if ( k < indallvouts )
|
||||||
|
return(vout == 1);
|
||||||
|
else if ( k == indallvouts || k == indallvouts+1 )
|
||||||
|
return(1);
|
||||||
|
else return(vout == 0);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t komodo_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max)
|
int32_t komodo_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
@@ -657,7 +670,7 @@ int32_t komodo_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max)
|
|||||||
}
|
}
|
||||||
for (i=0; i<sizeof(banned_txids)/sizeof(*banned_txids); i++)
|
for (i=0; i<sizeof(banned_txids)/sizeof(*banned_txids); i++)
|
||||||
array[i] = uint256S(banned_txids[i]);
|
array[i] = uint256S(banned_txids[i]);
|
||||||
*indallvoutsp = i-2;
|
*indallvoutsp = i-6;
|
||||||
return(i);
|
return(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -691,7 +704,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim
|
|||||||
{
|
{
|
||||||
for (k=0; k<numbanned; k++)
|
for (k=0; k<numbanned; k++)
|
||||||
{
|
{
|
||||||
if ( block.vtx[i].vin[j].prevout.hash == array[k] && (block.vtx[i].vin[j].prevout.n == 1 || k >= indallvouts) )
|
if ( block.vtx[i].vin[j].prevout.hash == array[k] && komodo_checkvout(block.vtx[i].vin[j].prevout.n,k,indallvouts) != 0 ) //(block.vtx[i].vin[j].prevout.n == 1 || k >= indallvouts) )
|
||||||
{
|
{
|
||||||
printf("banned tx.%d being used at ht.%d txi.%d vini.%d\n",k,height,i,j);
|
printf("banned tx.%d being used at ht.%d txi.%d vini.%d\n",k,height,i,j);
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ uint64_t komodo_paxtotal();
|
|||||||
int32_t komodo_longestchain();
|
int32_t komodo_longestchain();
|
||||||
uint64_t komodo_maxallowed(int32_t baseid);
|
uint64_t komodo_maxallowed(int32_t baseid);
|
||||||
int32_t komodo_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max);
|
int32_t komodo_bannedset(int32_t *indallvoutsp,uint256 *array,int32_t max);
|
||||||
|
int32_t komodo_checkvout(int32_t vout,int32_t k,int32_t indallvouts);
|
||||||
|
|
||||||
pthread_mutex_t komodo_mutex,staked_mutex;
|
pthread_mutex_t komodo_mutex,staked_mutex;
|
||||||
|
|
||||||
|
|||||||
17
src/main.cpp
17
src/main.cpp
@@ -1341,16 +1341,19 @@ bool CheckTransaction(uint32_t tiptime,const CTransaction& tx, CValidationState
|
|||||||
if ( *(int32_t *)&array[0] == 0 )
|
if ( *(int32_t *)&array[0] == 0 )
|
||||||
numbanned = komodo_bannedset(&indallvouts,array,(int32_t)(sizeof(array)/sizeof(*array)));
|
numbanned = komodo_bannedset(&indallvouts,array,(int32_t)(sizeof(array)/sizeof(*array)));
|
||||||
n = tx.vin.size();
|
n = tx.vin.size();
|
||||||
for (j=0; j<n; j++)
|
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
||||||
{
|
{
|
||||||
for (k=0; k<numbanned; k++)
|
for (j=0; j<n; j++)
|
||||||
{
|
{
|
||||||
if ( tx.vin[j].prevout.hash == array[k] && (tx.vin[j].prevout.n == 1 || k >= indallvouts) )
|
for (k=0; k<numbanned; k++)
|
||||||
{
|
{
|
||||||
static uint32_t counter;
|
if ( tx.vin[j].prevout.hash == array[k] && komodo_checkvout(tx.vin[j].prevout.n,k,indallvouts) != 0 ) //(tx.vin[j].prevout.n == 1 || k >= indallvouts) )
|
||||||
if ( counter++ < 100 )
|
{
|
||||||
printf("MEMPOOL: banned tx.%d being used at ht.%d vout.%d\n",k,(int32_t)chainActive.Tip()->GetHeight(),j);
|
static uint32_t counter;
|
||||||
return(false);
|
if ( counter++ < 100 )
|
||||||
|
printf("MEMPOOL: banned tx.%d being used at ht.%d vout.%d\n",k,(int32_t)chainActive.Tip()->GetHeight(),j);
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user