jl777 8 years ago
parent
commit
748d3646a3
  1. 4
      iguana/dpow/dpow_prices.c
  2. 10
      iguana/iguana_notary.c
  3. 23
      iguana/main.c
  4. 2
      iguana/tests/ratifyC_7776

4
iguana/dpow/dpow_prices.c

@ -1363,7 +1363,7 @@ int32_t ecb_matrix(double basevals[MAX_CURRENCIES],double matrix[MAX_CURRENCIES]
loaded = 1; loaded = 1;
else printf("fread error\n"); else printf("fread error\n");
fclose(fp); fclose(fp);
} else printf("ecb_matrix.(%s) load error fp.%p\n",fname,fp); } //else printf("ecb_matrix.(%s) load error fp.%p\n",fname,fp);
datenum = conv_date(&seconds,date); datenum = conv_date(&seconds,date);
year = datenum / 10000, month = (datenum / 100) % 100, day = (datenum % 100); year = datenum / 10000, month = (datenum / 100) % 100, day = (datenum % 100);
if ( loaded == 0 ) if ( loaded == 0 )
@ -1409,7 +1409,7 @@ int32_t ecb_matrix(double basevals[MAX_CURRENCIES],double matrix[MAX_CURRENCIES]
//"2000-01-03" //"2000-01-03"
if ( (datenum= conv_date(&seconds,date)) < 0 ) if ( (datenum= conv_date(&seconds,date)) < 0 )
return(-1); return(-1);
printf("loaded.(%s) nonz.%d (%d %d %d) datenum.%d\n",date,n,year,month,day,datenum); //printf("loaded.(%s) nonz.%d (%d %d %d) datenum.%d\n",date,n,year,month,day,datenum);
return(datenum); return(datenum);
} }

10
iguana/iguana_notary.c

@ -373,14 +373,22 @@ ZERO_ARGS(dpow,cancelratify)
TWOINTS_AND_ARRAY(dpow,ratify,minsigs,timestamp,ratified) TWOINTS_AND_ARRAY(dpow,ratify,minsigs,timestamp,ratified)
{ {
void **ptrs; bits256 zero; struct dpow_checkpoint checkpoint; void **ptrs; bits256 zero; int32_t i; char *source; struct dpow_checkpoint checkpoint;
if ( ratified == 0 ) if ( ratified == 0 )
return(clonestr("{\"error\":\"no ratified list for dpow ratify\"}")); return(clonestr("{\"error\":\"no ratified list for dpow ratify\"}"));
memset(zero.bytes,0,sizeof(zero)); memset(zero.bytes,0,sizeof(zero));
dpow_checkpointset(myinfo,&checkpoint,0,zero,timestamp,timestamp); dpow_checkpointset(myinfo,&checkpoint,0,zero,timestamp,timestamp);
ptrs = calloc(1,sizeof(void *)*5 + sizeof(struct dpow_checkpoint)); ptrs = calloc(1,sizeof(void *)*5 + sizeof(struct dpow_checkpoint));
ptrs[0] = (void *)myinfo; ptrs[0] = (void *)myinfo;
if ( (source= jstr(json,"source")) == 0 )
source = "KMD";
ptrs[1] = (void *)&myinfo->DPOWS[0]; ptrs[1] = (void *)&myinfo->DPOWS[0];
for (i=0; i<myinfo->numdpows; i++)
if ( strcmp(myinfo->DPOWS[0].symbol,source) == 0 )
{
ptrs[1] = (void *)&myinfo->DPOWS[i];
break;
}
ptrs[2] = (void *)(long)minsigs; ptrs[2] = (void *)(long)minsigs;
ptrs[3] = (void *)DPOW_RATIFYDURATION; ptrs[3] = (void *)DPOW_RATIFYDURATION;
ptrs[4] = (void *)jprint(ratified,0); ptrs[4] = (void *)jprint(ratified,0);

23
iguana/main.c

@ -1637,18 +1637,21 @@ void iguana_main(void *arg)
#endif #endif
} }
} else basilisks_init(myinfo); } else basilisks_init(myinfo);
char *jsonstr = "[\"03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828\", \"02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344\", \"03750cf30d739cd7632f77c1c02812dd7a7181628b0558058d4755838117e05339\", \"0394f3529d2e8cc69ffa7a2b55f3761e7be978fa1896ef4c55dc9c275e77e5bf5e\", \"0243c1eeb3777af47187d542e5f8c84f0ac4b05cf5a7ad77faa8cb6d2d56db7823\", \"02bb298844175640a34e908ffdfa2839f77aba3d5edadefee16beb107826e00063\", \"02fa88e549b4b871498f892e527a5d57287916809f8cc3163f641d71c535e8df5a\", \"032f799e370f06476793a122fcd623db7804898fe5aef5572095cfee6353df34bf\", \"02c06fe5401faff4442ef87b7d1b56c2e5a214166615f9a2f2030c71b0cb067ae8\", \"038ac67ca49a8169bcc5de83fe020071095a2c3b2bc4d1c17386977329758956d5\"]"; if ( 0 )
int32_t i,n; char coinaddr[64]; uint8_t pubkey33[33]; double val = 0.1; cJSON *array;
if ( (array= cJSON_Parse(jsonstr)) != 0 )
{ {
n = cJSON_GetArraySize(array); char *jsonstr = "[\"03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828\", \"02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344\", \"03750cf30d739cd7632f77c1c02812dd7a7181628b0558058d4755838117e05339\", \"0394f3529d2e8cc69ffa7a2b55f3761e7be978fa1896ef4c55dc9c275e77e5bf5e\", \"0243c1eeb3777af47187d542e5f8c84f0ac4b05cf5a7ad77faa8cb6d2d56db7823\", \"02bb298844175640a34e908ffdfa2839f77aba3d5edadefee16beb107826e00063\", \"02fa88e549b4b871498f892e527a5d57287916809f8cc3163f641d71c535e8df5a\", \"032f799e370f06476793a122fcd623db7804898fe5aef5572095cfee6353df34bf\", \"02c06fe5401faff4442ef87b7d1b56c2e5a214166615f9a2f2030c71b0cb067ae8\", \"038ac67ca49a8169bcc5de83fe020071095a2c3b2bc4d1c17386977329758956d5\"]";
for (i=0; i<n; i++) int32_t i,n; char coinaddr[64]; uint8_t pubkey33[33]; double val = 0.1; cJSON *array;
if ( (array= cJSON_Parse(jsonstr)) != 0 )
{ {
decode_hex(pubkey33,33,jstri(array,i)); n = cJSON_GetArraySize(array);
bitcoin_address(coinaddr,60,pubkey33,33); for (i=0; i<n; i++)
printf("./komodo-cli -ac_name=REVS sendtoaddress %s %f\n",coinaddr,val); {
} decode_hex(pubkey33,33,jstri(array,i));
} else printf("couldnt parse.(%s)\n",jsonstr); bitcoin_address(coinaddr,60,pubkey33,33);
printf("./komodo-cli -ac_name=REVS sendtoaddress %s %f\n",coinaddr,val);
}
} else printf("couldnt parse.(%s)\n",jsonstr);
}
iguana_launchdaemons(myinfo); iguana_launchdaemons(myinfo);
} }

2
iguana/tests/ratifyC_7776

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save