Jl777 (#1317)
* Remove voutsum check * Teach RPC interface about dpow-enabled minconfs (#1231) * Make minconfs dpow-aware in z_listunspent + z_listreceivedbyaddress * Add dpow-related test files to test suite * Add dpow simulation to regtest every 7 blocks * Fix compiler errors * Fix link error * Fix stdout spam when running regtests * Dpowminconfs for listreceivedbyaddress * dpowconfs tests * Start adding specific tests for dpowminconfs in listreceivedbyaddress * Get dpowminconfs tests for listreceivedbyaddress working * Add dpowminconfs to getreceivedbyaddress + listunspent * Add test for listtransactions + getreceivedbyaddress support * Reliably passing dpowminconf tests. We only check for notarized-ness now, not exact confirmation numbers, to avoid race conditions * Poll for the expected notarization info before running further tests; add support for getbalance * Migrate tx_height() to a place where asyncrpcoperation_sendmany.cpp can use it * fix * Teach GetFilteredNotes about dpowconfs Many RPCs rely on this internal function, which now correctly uses dpowconfs to filter by the minconf/maxconf parameters. * Fix sendmany when using non-default minconf * inline seems to make things happy * cleanup * Add some code to test z_sendmany, which points out https://github.com/jl777/komodo/issues/1247 * try this * Use already calculated value of dpowconfs instead of calculating it again * Cleanup .pack file * Remove * Remove .pack * Disable passkeys * Rvalidate * Syntax * Allow overwrite by same pub33 * Tx * Declare variables * Allow replacement handle * Grandfather existing handles * Test * Handleinfo * Char * * Begin * Add mutex * CCaddr * Casts for windows * +debugs * Syntax * Item * Skeet * +print * Error check things * +prints * -sleep * Brute force inventory check * Revert * num_packitems * Log file * Test * ABC * Test * Add help docs for all -ac_* params of komodod (#1313) * Remove myAddress from roc * +print * Test * Test * Leave pack all * Dont discard unless last o_count * Prevent pack corruption * -ddebugs * Merge branch 'FSM' into jl777 # Conflicts: # src/cc/rogue/main.c * Enable keystrokes test * +debug * Fix rogue results processing * Resobj * Enable keystrokes sending * Test * Print * Sendrawtransaction result * Resobj * Fix crash
This commit is contained in:
@@ -711,16 +711,11 @@ char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port)
|
||||
|
||||
int32_t rogue_sendrawtransaction(char *rawtx)
|
||||
{
|
||||
char params[512],*retstr; cJSON *retjson; int32_t numconfs = -1;
|
||||
char *params,*retstr,*hexstr; cJSON *retjson,*resobj; int32_t retval = -1;
|
||||
params = (char *)malloc(strlen(rawtx) + 16);
|
||||
sprintf(params,"[\"%s\"]",rawtx);
|
||||
if ( (retstr= komodo_issuemethod(USERPASS,"sendrawtransaction",params,ROGUE_PORT)) != 0 )
|
||||
{
|
||||
//fprintf(stderr,"params.(%s) -> %s\n",params,retstr);
|
||||
if ( is_hexstr(retstr,64) == 64 )
|
||||
{
|
||||
free(retstr);
|
||||
return(0);
|
||||
}
|
||||
{
|
||||
static FILE *fp;
|
||||
if ( fp == 0 )
|
||||
@@ -733,16 +728,22 @@ int32_t rogue_sendrawtransaction(char *rawtx)
|
||||
}
|
||||
if ( (retjson= cJSON_Parse(retstr)) != 0 )
|
||||
{
|
||||
if ( (resobj= jobj(retjson,"result")) != 0 )
|
||||
{
|
||||
if ( (hexstr= jstr(resobj,0)) != 0 && is_hexstr(hexstr,64) == 64 )
|
||||
retval = 0;
|
||||
}
|
||||
free_json(retjson);
|
||||
}
|
||||
free(retstr);
|
||||
}
|
||||
return(-1);
|
||||
free(params);
|
||||
return(retval);
|
||||
}
|
||||
|
||||
void rogue_progress(struct rogue_state *rs,int32_t waitflag,uint64_t seed,char *keystrokes,int32_t num)
|
||||
{
|
||||
char cmd[16384],hexstr[16384],params[32768],*retstr,*rawtx,*pastkeys,*pastcmp,*keys; int32_t i,len,numpastkeys; cJSON *retjson;
|
||||
char cmd[16384],hexstr[16384],params[32768],*retstr,*rawtx,*pastkeys,*pastcmp,*keys; int32_t i,len,numpastkeys; cJSON *retjson,*resobj;
|
||||
//fprintf(stderr,"rogue_progress num.%d\n",num);
|
||||
if ( rs->guiflag != 0 && Gametxidstr[0] != 0 )
|
||||
{
|
||||
@@ -763,8 +764,6 @@ void rogue_progress(struct rogue_state *rs,int32_t waitflag,uint64_t seed,char *
|
||||
}
|
||||
free(rs->keystrokeshex), rs->keystrokeshex = 0;
|
||||
}
|
||||
// extract and get keystrokes field and compare it to pastkeys
|
||||
// if not matching... panic?
|
||||
if ( 0 && (pastkeys= rogue_keystrokesload(&numpastkeys,seed,1)) != 0 )
|
||||
{
|
||||
sprintf(params,"[\"extract\",\"17\",\"[%%22%s%%22]\"]",Gametxidstr);
|
||||
@@ -772,22 +771,28 @@ void rogue_progress(struct rogue_state *rs,int32_t waitflag,uint64_t seed,char *
|
||||
{
|
||||
if ( (retjson= cJSON_Parse(retstr)) != 0 )
|
||||
{
|
||||
if ( (keys= jstr(retjson,"keystrokes")) != 0 )
|
||||
if ( (resobj= jobj(retjson,"result")) != 0 && (keys= jstr(resobj,"keystrokes")) != 0 )
|
||||
{
|
||||
len = strlen(keys) / 2;
|
||||
pastcmp = (char *)malloc(len + 1);
|
||||
decode_hex(pastcmp,len,keys);
|
||||
fprintf(stderr,"keystrokes.(%s) vs pastkeys\n",keys);
|
||||
for (i=0; i<numpastkeys; i++)
|
||||
fprintf(stderr,"%02x",pastkeys[i]);
|
||||
fprintf(stderr,"\n");
|
||||
if ( len != numpastkeys || memcmp(pastcmp,pastkeys,len) != 0 )
|
||||
{
|
||||
fprintf(stderr,"pastcmp[%d] != pastkeys[%d]?\n",len,numpastkeys);
|
||||
}
|
||||
free(pastcmp);
|
||||
}
|
||||
} else fprintf(stderr,"no keystrokes in (%s)\n",retstr);
|
||||
free_json(retjson);
|
||||
}
|
||||
}
|
||||
} else fprintf(stderr,"error parsing.(%s)\n",retstr);
|
||||
fprintf(stderr,"extracted.(%s)\n",retstr);
|
||||
free(retstr);
|
||||
} else fprintf(stderr,"error extracting game\n");
|
||||
free(pastkeys);
|
||||
}
|
||||
} // else fprintf(stderr,"no pastkeys\n");
|
||||
|
||||
for (i=0; i<num; i++)
|
||||
sprintf(&hexstr[i<<1],"%02x",keystrokes[i]&0xff);
|
||||
@@ -814,13 +819,13 @@ void rogue_progress(struct rogue_state *rs,int32_t waitflag,uint64_t seed,char *
|
||||
}
|
||||
if ( (retjson= cJSON_Parse(retstr)) != 0 )
|
||||
{
|
||||
if ( (rawtx= jstr(retjson,"hex")) != 0 )
|
||||
if ( (resobj= jobj(retjson,"result")) != 0 && (rawtx= jstr(resobj,"hex")) != 0 )
|
||||
{
|
||||
if ( rs->keystrokeshex != 0 )
|
||||
free(rs->keystrokeshex);
|
||||
rs->keystrokeshex = (char *)malloc(strlen(rawtx)+1);
|
||||
strcpy(rs->keystrokeshex,rawtx);
|
||||
//fprintf(stderr,"set keystrokestx <- %s\n",rs->keystrokeshex);
|
||||
//fprintf(stderr,"set keystrokestx <- %s\n",rs->keystrokeshex);
|
||||
}
|
||||
free_json(retjson);
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ char *rogue_keystrokesload(int32_t *numkeysp,uint64_t seed,int32_t counter)
|
||||
if ( (fsize= get_filesize(fp)) <= 0 )
|
||||
{
|
||||
fclose(fp);
|
||||
printf("fsize.%ld\n",fsize);
|
||||
//printf("fsize.%ld\n",fsize);
|
||||
break;
|
||||
}
|
||||
if ( (keystrokes= (char *)realloc(keystrokes,num+fsize)) == 0 )
|
||||
|
||||
Reference in New Issue
Block a user