Browse Source

Merge pull request #122 from jl777/acspeed

Acspeed
dPoW
jl777 8 years ago
committed by GitHub
parent
commit
c166e3c617
  1. 2
      deprecated/iguana_instantdex.c
  2. 8
      iguana/dPoW.h
  3. 26
      iguana/dpow/dpow_fsm.c
  4. 9
      iguana/dpow/dpow_network.c
  5. 74
      iguana/dpow/dpow_prices.c
  6. 22
      iguana/dpow/dpow_rpc.c
  7. 19
      iguana/dpow/dpow_tx.c
  8. 11
      iguana/iguana_notary.c
  9. 2
      iguana/iguana_payments.c
  10. 5
      iguana/iguana_wallet.c
  11. 2
      iguana/tests/listtransactions
  12. 2
      iguana/tests/listunspent
  13. 2
      iguana/tests/listunspent2

2
deprecated/iguana_instantdex.c

@ -877,7 +877,7 @@ struct instantdex_accept *instantdex_quotefind(struct supernet_info *myinfo,stru
struct iguana_bundlereq *instantdex_recvquotes(struct iguana_info *coin,struct iguana_bundlereq *req,bits256 *quotes,int32_t n)
{
int32_t i,len,state,m = 0; uint8_t serialized[10000]; struct instantdex_accept *ap; struct exchange_info *exchange;
int32_t i,len,state,m = 0; uint8_t serialized[16384]; struct instantdex_accept *ap; struct exchange_info *exchange;
exchange = exchanges777_find("bitcoin");
if ( req->addr == 0 )
return(0);

8
iguana/dPoW.h

@ -19,10 +19,10 @@
#define DPOW_FIRSTRATIFY 1000
#define DPOW_CHECKPOINTFREQ 10
#define DPOW_MINSIGS 7
#define DPOW_MINSIGS 11 //((height < 90000) ? 7 : 11)
//#define DPOW_M(bp) ((bp)->minsigs) // (((bp)->numnotaries >> 1) + 1)
#define DPOW_MODIND(bp,offset) (((((bp)->height / DPOW_CHECKPOINTFREQ) % (bp)->numnotaries) + (offset)) % (bp)->numnotaries)
#define DPOW_VERSION 0x0757
#define DPOW_VERSION 0x0768
#define DPOW_UTXOSIZE 10000
#define DPOW_MINOUTPUT 6000
#define DPOW_DURATION 300
@ -102,9 +102,9 @@ struct dpow_block
struct dpow_entry notaries[DPOW_MAXRELAYS];
uint32_t state,starttime,timestamp,waiting,sigcrcs[2],txidcrcs[2],utxocrcs[2],lastepoch;
int32_t rawratifiedlens[2],height,numnotaries,numerrors,completed,minsigs,duration,numratified,isratify,require0,scores[DPOW_MAXRELAYS];
int8_t bestk,ratifybestk,pendingbestk,pendingratifybestk;
int8_t myind,bestk,ratifybestk,pendingbestk,pendingratifybestk;
cJSON *ratified;
uint8_t myind,ratified_pubkeys[DPOW_MAXRELAYS][33],ratifysigs[2][DPOW_MAXSIGLEN],ratifysiglens[2];
uint8_t ratified_pubkeys[DPOW_MAXRELAYS][33],ratifysigs[2][DPOW_MAXSIGLEN],ratifysiglens[2];
char handles[DPOW_MAXRELAYS][32];
char signedtx[32768]; uint8_t ratifyrawtx[2][32768]; uint32_t pendingcrcs[2];
};

26
iguana/dpow/dpow_fsm.c

@ -169,7 +169,6 @@ void dpow_statemachinestart(void *ptr)
jsonstr = ptrs[4];
kmdheight = -1;
memcpy(&checkpoint,&ptrs[5],sizeof(checkpoint));
printf("statemachinestart %s->%s %s ht.%d minsigs.%d duration.%d start.%u\n",dp->symbol,dp->dest,bits256_str(str,checkpoint.blockhash.hash),checkpoint.blockhash.height,minsigs,duration,checkpoint.timestamp);
src = iguana_coinfind(dp->symbol);
dest = iguana_coinfind(dp->dest);
dpow_getchaintip(myinfo,&srchash,&srctime,dp->srctx,&dp->numsrctx,src);
@ -190,6 +189,7 @@ void dpow_statemachinestart(void *ptr)
bp->duration = duration;
bp->srccoin = src;
bp->destcoin = dest;
bp->myind = -1;
bp->opret_symbol = dp->symbol;
if ( jsonstr != 0 && (ratified= cJSON_Parse(jsonstr)) != 0 )
{
@ -270,9 +270,16 @@ void dpow_statemachinestart(void *ptr)
if ( kmdheight >= 0 )
{
ht = kmdheight;///strcmp("KMD",src->symbol) == 0 ? kmdheight : bp->height;
if ( ht == 0 )
ht = strcmp("KMD",src->symbol) == 0 ? src->longestchain : dest->longestchain;
bp->numnotaries = komodo_notaries(src->symbol,pubkeys,ht);
if ( strcmp("KMD",dest->symbol) == 0 )
{
bp->numnotaries = komodo_notaries(dest->symbol,pubkeys,ht);
}
else
{
if ( ht == 0 )
ht = strcmp("KMD",src->symbol) == 0 ? src->longestchain : dest->longestchain;
bp->numnotaries = komodo_notaries(src->symbol,pubkeys,ht);
}
for (i=0; i<bp->numnotaries; i++)
{
//int32_t j; for (j=0; j<33; j++)
@ -298,6 +305,7 @@ void dpow_statemachinestart(void *ptr)
dp->ratifying -= bp->isratify;
return;
}
printf("myind.%d\n",myind);
}
else
{
@ -306,6 +314,8 @@ void dpow_statemachinestart(void *ptr)
dp->ratifying -= bp->isratify;
return;
}
bp->myind = myind;
printf("[%d] statemachinestart %s->%s %s ht.%d minsigs.%d duration.%d start.%u\n",bp->myind,dp->symbol,dp->dest,bits256_str(str,checkpoint.blockhash.hash),checkpoint.blockhash.height,minsigs,duration,checkpoint.timestamp);
if ( bp->isratify != 0 && memcmp(bp->notaries[0].pubkey,bp->ratified_pubkeys[0],33) != 0 )
{
for (i=0; i<33; i++)
@ -317,7 +327,7 @@ void dpow_statemachinestart(void *ptr)
dp->ratifying -= bp->isratify;
return;
}
printf(" myind.%d myaddr.(%s %s)\n",myind,srcaddr,destaddr);
//printf(" myind.%d myaddr.(%s %s)\n",myind,srcaddr,destaddr);
if ( myind == 0 && bits256_nonz(destprevtxid0) != 0 && bits256_nonz(srcprevtxid0) != 0 && destprevvout0 >= 0 && srcprevvout0 >= 0 )
{
ep->dest.prev_hash = destprevtxid0;
@ -365,7 +375,7 @@ void dpow_statemachinestart(void *ptr)
{
if ( dp->checkpoint.blockhash.height > checkpoint.blockhash.height )
{
printf("abort ht.%d due to new checkpoint.%d\n",checkpoint.blockhash.height,dp->checkpoint.blockhash.height);
printf("abort %s ht.%d due to new checkpoint.%d\n",dp->symbol,checkpoint.blockhash.height,dp->checkpoint.blockhash.height);
dp->ratifying -= bp->isratify;
return;
}
@ -373,7 +383,7 @@ void dpow_statemachinestart(void *ptr)
}
if ( bp->isratify == 0 || (starttime= checkpoint.timestamp) == 0 )
bp->starttime = starttime = (uint32_t)time(NULL);
printf("isratify.%d DPOW.%s statemachine checkpoint.%d %s start.%u\n",bp->isratify,src->symbol,checkpoint.blockhash.height,bits256_str(str,checkpoint.blockhash.hash),checkpoint.timestamp);
printf("myind.%d isratify.%d DPOW.%s statemachine checkpoint.%d %s start.%u\n",bp->myind,bp->isratify,src->symbol,checkpoint.blockhash.height,bits256_str(str,checkpoint.blockhash.hash),checkpoint.timestamp);
for (i=0; i<sizeof(srchash); i++)
srchash.bytes[i] = dp->minerkey33[i+1];
//printf("start utxosync start.%u %u\n",starttime,(uint32_t)time(NULL));
@ -386,7 +396,7 @@ void dpow_statemachinestart(void *ptr)
{
if ( bp->isratify == 0 )
{
printf("abort ht.%d due to new checkpoint.%d\n",checkpoint.blockhash.height,dp->checkpoint.blockhash.height);
printf("abort %s ht.%d due to new checkpoint.%d\n",dp->symbol,checkpoint.blockhash.height,dp->checkpoint.blockhash.height);
break;
}
}

9
iguana/dpow/dpow_network.c

@ -560,7 +560,7 @@ void dpow_nanomsg_update(struct supernet_info *myinfo)
dpow_ipbitsadd(myinfo,dp,np->ipbits,np->numipbits,np->senderind,np->myipbits);
if ( (bp= dpow_heightfind(myinfo,dp,np->height)) != 0 && bp->state != 0xffffffff )
{
if ( np->senderind >= 0 && np->senderind < bp->numnotaries && memcmp(bp-> notaries[np->senderind].pubkey+1,np->srchash.bytes,32) == 0 )
if ( np->senderind >= 0 && np->senderind < bp->numnotaries && memcmp(bp-> notaries[np->senderind].pubkey+1,np->srchash.bytes,32) == 0 && bits256_nonz(np->srchash) != 0 )
{
if ( bp->isratify == 0 )
dpow_nanoutxoget(myinfo,dp,bp,&np->notarize,0,np->senderind);
@ -617,7 +617,7 @@ int32_t dpow_opreturnscript(uint8_t *script,uint8_t *opret,int32_t opretlen)
return(opretlen + offset);
}
int32_t dpow_rwopret(int32_t rwflag,uint8_t *opret,bits256 *hashmsg,int32_t *heightmsgp,char *src,struct dpow_block *bp,int32_t src_or_dest)
int32_t dpow_rwopret(int32_t rwflag,uint8_t *opret,bits256 *hashmsg,int32_t *heightmsgp,char *src,uint8_t *extras,int32_t extralen,struct dpow_block *bp,int32_t src_or_dest)
{
int32_t i,opretlen = 0; //bits256 beacon,beacons[DPOW_MAXRELAYS];
opretlen += iguana_rwbignum(rwflag,&opret[opretlen],sizeof(*hashmsg),hashmsg->bytes);
@ -651,6 +651,11 @@ int32_t dpow_rwopret(int32_t rwflag,uint8_t *opret,bits256 *hashmsg,int32_t *hei
opret[opretlen++] = src[i];
}
opret[opretlen++] = 0;
if ( extras != 0 && extralen > 0 )
{
memcpy(&opret[opretlen],extras,extralen);
opretlen += extralen;
}
}
else
{

74
iguana/dpow/dpow_prices.c

@ -102,7 +102,7 @@ struct PAX_data
char edate[128]; double ecbmatrix[MAX_CURRENCIES][MAX_CURRENCIES],dailyprices[MAX_CURRENCIES * MAX_CURRENCIES],metals[4];
uint32_t lastupdate;
int32_t ecbdatenum,ecbyear,ecbmonth,ecbday; double RTmatrix[MAX_CURRENCIES][MAX_CURRENCIES],RTprices[128],RTmetals[4];
double basevals[MAX_CURRENCIES],cryptovols[2][9][2],BTCUSD,KMDBTC,CNYUSD,btcusd,kmdbtc,cryptos[8];
double basevals[MAX_CURRENCIES],cryptovols[2][9][2],BTCDBTC,BTCUSD,KMDBTC,CNYUSD,btcusd,kmdbtc,cryptos[8];
struct PAX_spline splines[128];
};
@ -1182,12 +1182,13 @@ double PAX_yahoo(char *metal)
void PAX_btcprices(struct PAX_data *dp,int32_t enddatenum,int32_t numdates)
{
int32_t i,n,year,month,day,seconds,datenum; char url[1024],date[64],*dstr,*str;
int32_t i,n,year,month,day,seconds,datenum; char url[1024],url2[1024],date[64],*dstr,*str;
uint32_t timestamp,utc32[MAX_SPLINES]; struct tai t;
cJSON *coindesk,*quandl,*kmdhist,*bpi,*array,*item;
double kmddaily[MAX_SPLINES],cdaily[MAX_SPLINES],qdaily[MAX_SPLINES],ask,high,low,bid,close,vol,quotevol,open,price = 0.;
coindesk = url_json("http://api.coindesk.com/v1/bpi/historical/close.json");
sprintf(url,"https://poloniex.com/public?command=returnChartData&currencyPair=BTC_KMD&start=%ld&end=9999999999&period=86400",(long)(time(NULL)-numdates*3600*24));
sprintf(url2,"https://poloniex.com/public?command=returnChartData&currencyPair=BTC_BTCD&start=%ld&end=9999999999&period=86400",(long)(time(NULL)-numdates*3600*24));
if ( (bpi= jobj(coindesk,"bpi")) != 0 )
{
datenum = enddatenum;
@ -1415,7 +1416,7 @@ int32_t ecb_matrix(double basevals[MAX_CURRENCIES],double matrix[MAX_CURRENCIES]
void PAX_update(struct PAX_data *dp,double *btcusdp,double *kmdbtcp)
{
int32_t i,n,seconds,datenum; uint32_t timestamp; char url[1024],*dstr,*str;
int32_t i,n,iter,seconds,datenum; uint32_t timestamp; char url[1024],url2[1024],*dstr,*str;
double kmddaily=0.,btcusd=0.,ask,high,low,bid,close,vol,quotevol,open,price = 0.;
//cJSON *kmdtrades,*kmdtrades2,*,*bitcoincharts,;
cJSON *quandl,*kmdhist,*array,*item,*bitcoinave,*blockchaininfo,*btctrades,*coindesk=0;
@ -1423,12 +1424,13 @@ void PAX_update(struct PAX_data *dp,double *btcusdp,double *kmdbtcp)
btctrades = url_json(url);
//kmdtrades = url_json("https://poloniex.com/public?command=returnTradeHistory&currencyPair=USDT_BTC");
//kmdtrades2 = url_json("https://bittrex.com/api/v1.1/public/getmarkethistory?market=BTC-KMD&count=50");
*kmdbtcp = 0.0001;
*kmdbtcp = 0;
bitcoinave = 0;//url_json("https://api.bitcoinaverage.com/ticker/USD/");
//bitcoincharts = url_json("http://api.bitcoincharts.com/v1/weighted_prices.json");
blockchaininfo = 0;//url_json("https://blockchain.info/ticker");
coindesk = 0;//url_json("http://api.coindesk.com/v1/bpi/historical/close.json");
sprintf(url,"https://poloniex.com/public?command=returnChartData&currencyPair=BTC_KMD&start=%ld&end=9999999999&period=86400",(long)(time(NULL)-2*3600*24));
sprintf(url,"https://poloniex.com/public?command=returnChartData&currencyPair=BTC_KMD&start=%ld&end=9999999999&period=86400",(long)(time(NULL)-3600*24));
sprintf(url2,"https://poloniex.com/public?command=returnChartData&currencyPair=BTC_BTCD&start=%ld&end=9999999999&period=86400",(long)(time(NULL)-3600*24));
quandl = 0;//url_json("https://www.quandl.com/api/v1/datasets/BAVERAGE/USD.json?rows=1");
if ( 0 && (str= jstr(quandl,"updated_at")) != 0 && (datenum= conv_date(&seconds,str)) > 0 && (array= jarray(&n,quandl,"data")) != 0 )
{
@ -1446,13 +1448,12 @@ void PAX_update(struct PAX_data *dp,double *btcusdp,double *kmdbtcp)
}
}
}
if ( 0 )
if ( 1 )
{
double avebid,aveask,bidvol,askvol; struct exchange_quote sortbuf[512];
struct supernet_info *myinfo = SuperNET_MYINFO(0); cJSON *argjson = cJSON_Parse("{}");
aveask = instantdex_aveprice(myinfo,sortbuf,(int32_t)(sizeof(sortbuf)/sizeof(*sortbuf)),&askvol,"KMD","BTC",1,argjson);
avebid = instantdex_aveprice(myinfo,sortbuf,(int32_t)(sizeof(sortbuf)/sizeof(*sortbuf)),&bidvol,"KMD","BTC",-1,argjson);
if ( avebid > SMALLVAL && aveask > SMALLVAL )
double avebid,aveask,bidvol,askvol; //struct exchange_quote sortbuf[512]; struct supernet_info *myinfo = SuperNET_MYINFO(0); cJSON *argjson = cJSON_Parse("{}");
//aveask = instantdex_aveprice(myinfo,sortbuf,(int32_t)(sizeof(sortbuf)/sizeof(*sortbuf)),&askvol,"KMD","BTC",1,argjson);
//avebid = instantdex_aveprice(myinfo,sortbuf,(int32_t)(sizeof(sortbuf)/sizeof(*sortbuf)),&bidvol,"KMD","BTC",-1,argjson);
if ( 0 && avebid > SMALLVAL && aveask > SMALLVAL )
{
price = (avebid*bidvol + aveask*askvol) / (bidvol + askvol);
*kmdbtcp = price;
@ -1461,28 +1462,38 @@ void PAX_update(struct PAX_data *dp,double *btcusdp,double *kmdbtcp)
}
else
{
kmdhist = url_json(url);
//{"date":1406160000,"high":0.01,"low":0.00125,"open":0.01,"close":0.001375,"volume":1.50179994,"quoteVolume":903.58818412,"weightedAverage":0.00166204},
if ( kmdhist != 0 && (array= jarray(&n,kmdhist,0)) != 0 )
for (iter=0; iter<2; iter++)
{
//printf("GOT.(%s)\n",cJSON_Print(array));
for (i=0; i<1; i++)
kmdhist = url_json(iter == 0 ? url : url2);
//{"date":1406160000,"high":0.01,"low":0.00125,"open":0.01,"close":0.001375,"volume":1.50179994,"quoteVolume":903.58818412,"weightedAverage":0.00166204},
if ( kmdhist != 0 && (array= jarray(&n,kmdhist,0)) != 0 )
{
item = jitem(array,i);
timestamp = juint(item,"date"), high = jdouble(item,"high"), low = jdouble(item,"low"), open = jdouble(item,"open");
close = jdouble(item,"close"), vol = jdouble(item,"volume"), quotevol = jdouble(item,"quoteVolume"), price = jdouble(item,"weightedAverage");
//printf("[%u %f %f %f %f %f %f %f]",timestamp,high,low,open,close,vol,quotevol,price);
//printf("[%u %d %f]",timestamp,OS_conv_unixtime(&seconds,timestamp),price);
kmddaily = price;
if ( kmddaily != 0 )
dp->KMDBTC = *kmdbtcp = kmddaily;
//printf("GOT.(%s)\n",cJSON_Print(array));
for (i=0; i<1; i++)
{
item = jitem(array,i);
timestamp = juint(item,"date"), high = jdouble(item,"high"), low = jdouble(item,"low"), open = jdouble(item,"open");
close = jdouble(item,"close"), vol = jdouble(item,"volume"), quotevol = jdouble(item,"quoteVolume"), price = jdouble(item,"weightedAverage");
//printf("[%u %f %f %f %f %f %f %f]",timestamp,high,low,open,close,vol,quotevol,price);
//printf("[%u %d %f]",timestamp,OS_conv_unixtime(&seconds,timestamp),price);
if ( price != 0 )
{
if ( iter == 0 )
dp->KMDBTC = *kmdbtcp = kmddaily;
else dp->BTCDBTC = price;
}
}
//printf("poloniex.%d\n",n);
}
//printf("poloniex.%d\n",n);
if ( kmdhist != 0 )
free_json(kmdhist);
}
if ( kmdhist != 0 )
free_json(kmdhist);
}
}
if ( (*kmdbtcp= dp->KMDBTC) == 0. )
*kmdbtcp = dp->BTCDBTC / 50.22;
if ( (rand() % 100) == 0 )
printf("KMD/BTC %.8f\n",*kmdbtcp);
if ( btctrades != 0 && (array= jarray(&n,btctrades,0)) != 0 )
{
//printf("GOT.(%s)\n",cJSON_Print(array));
@ -1565,8 +1576,9 @@ void _crypto_update(double cryptovols[2][9][2],struct PAX_data *dp,int32_t selec
cnyusd = dp->CNYUSD;
btcusd = dp->BTCUSD;
if ( (kmdbtc= dp->KMDBTC) == 0. )
kmdbtc = 0.0001;
//printf("update with btcusd %f kmd %f cnyusd %f cnybtc %f\n",btcusd,kmdbtc,cnyusd,cnyusd/btcusd);
;//kmdbtc = dp->BTCDBTC / 50.22;
printf("DEPRECATED: update with btcusd %f kmd %f cnyusd %f cnybtc %f\n",btcusd,kmdbtc,cnyusd,cnyusd/btcusd);
return;
if ( btcusd < SMALLVAL || kmdbtc < SMALLVAL )
{
PAX_update(dp,&btcusd,&kmdbtc);
@ -1826,11 +1838,11 @@ int32_t PAX_idle(struct supernet_info *myinfo)//struct PAX_data *argdp,int32_t i
}
dp = myinfo->PAXDATA;
if ( 0 && time(NULL) > dp->lastupdate+10 )
/*if ( 0 && time(NULL) > dp->lastupdate+10 )
{
_crypto_update(dp->cryptovols,dp,1);
dp->lastupdate = (uint32_t)time(NULL);
}
}*/
if ( OS_milliseconds() > lastupdate + (1000*idlegap) )
{
lastupdate = OS_milliseconds();

22
iguana/dpow/dpow_rpc.c

@ -42,7 +42,7 @@ int32_t komodo_notaries(char *symbol,uint8_t pubkeys[64][33],int32_t height)
decode_hex(pubkeys[i],33,pubkeystr);
else printf("error i.%d of %d (%s)\n",i,num,pubkeystr!=0?pubkeystr:"");
}
printf("notaries.[%d] <- ht.%d\n",num,height);
//printf("notaries.[%d] <- ht.%d\n",num,height);
}
free_json(retjson);
}
@ -93,18 +93,22 @@ int32_t dpow_paxpending(uint8_t *hex)
{
if ( coin->FULLNODE < 0 )
{
if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"paxwithdraw","")) != 0 )
if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"paxpending","")) != 0 )
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
if ( (hexstr= jstr(retjson,"withdraws")) != 0 && (n= is_hexstr(hexstr,0)) > 0 )
if ( (hexstr= jstr(retjson,"withdraws")) != 0 && (n= is_hexstr(hexstr,0)) > 1 )
{
n >>= 1;
printf("PAXPENDING.(%s)\n",retstr);
decode_hex(hex,n,hexstr);
}
free_json(retjson);
}
free(retstr);
}
}
}
} else printf("dpow_paxpending: paxwithdraw null return\n");
} else printf("dpow_paxpending: KMD FULLNODE.%d\n",coin->FULLNODE);
} else printf("dpow_paxpending: cant find KMD\n");
return(n);
}
@ -445,10 +449,10 @@ int32_t dpow_haveutxo(struct supernet_info *myinfo,struct iguana_info *coin,bits
}
if ( haveutxo == 0 )
printf("no utxo: need to fund address.(%s) or wait for splitfund to confirm\n",coinaddr);
} else printf("null utxo array size\n");
} //else printf("null utxo array size\n");
free_json(unspents);
} else printf("null return from dpow_listunspent\n");
if ( haveutxo > 0 )
if ( 0 && haveutxo > 0 )
printf("%s haveutxo.%d\n",coin->symbol,haveutxo);
return(haveutxo);
}
@ -780,7 +784,7 @@ void dpow_issuer_voutupdate(struct dpow_info *dp,char *symbol,int32_t isspecial,
int32_t dpow_issuer_tx(struct dpow_info *dp,struct iguana_info *coin,int32_t height,int32_t txi,char *txidstr,uint32_t port)
{
char *retstr,params[256],*hexstr; uint8_t script[10000]; cJSON *json,*oldpub,*newpub,*result,*vouts,*item,*sobj; int32_t vout,n,len,isspecial,retval = -1; uint64_t value; bits256 txid;
char *retstr,params[256],*hexstr; uint8_t script[16384]; cJSON *json,*oldpub,*newpub,*result,*vouts,*item,*sobj; int32_t vout,n,len,isspecial,retval = -1; uint64_t value; bits256 txid;
sprintf(params,"[\"%s\", 1]",txidstr);
if ( (retstr= dpow_issuemethod(coin->chain->userpass,(char *)"getrawtransaction",params,port)) != 0 )
{

19
iguana/dpow/dpow_tx.c

@ -165,7 +165,7 @@ struct dpow_block *dpow_heightfind(struct supernet_info *myinfo,struct dpow_info
int32_t dpow_voutstandard(struct dpow_block *bp,uint8_t *serialized,int32_t m,int32_t src_or_dest,uint8_t pubkeys[][33],int32_t numratified)
{
uint32_t locktime=0,numvouts; uint64_t satoshis,satoshisB; int32_t i,n,opretlen,len=0; uint8_t opret[1024],data[4096];
uint32_t locktime=0,numvouts; uint64_t satoshis,satoshisB; int32_t i,n=0,opretlen,len=0; uint8_t opret[16384],data[16384],extras[16384];
numvouts = 2;
if ( pubkeys == 0 || numratified <= 0 )
{
@ -197,24 +197,23 @@ int32_t dpow_voutstandard(struct dpow_block *bp,uint8_t *serialized,int32_t m,in
}
printf("numvouts.%d len.%d RATIFY vouts\n",numvouts,len);
}
if ( (src_or_dest == 0 || strcmp(bp->destcoin->symbol,"BTC") != 0) && (n= dpow_paxpending(extras)) > 0 )
{
for (i=0; i<n; i++)
printf("%02x",extras[i]);
printf(" <- withdraw.%d\n",n);
}
satoshis = 0;
len += iguana_rwnum(1,&serialized[len],sizeof(satoshis),&satoshis);
if ( src_or_dest != 0 )
opretlen = dpow_rwopret(1,opret,&bp->hashmsg,&bp->height,bp->srccoin->symbol,bp,src_or_dest);
else opretlen = dpow_rwopret(1,opret,&bp->hashmsg,&bp->height,bp->srccoin->symbol,bp,src_or_dest);
opretlen = dpow_rwopret(1,opret,&bp->hashmsg,&bp->height,bp->srccoin->symbol,extras,n,bp,src_or_dest);
else opretlen = dpow_rwopret(1,opret,&bp->hashmsg,&bp->height,bp->srccoin->symbol,extras,n,bp,src_or_dest);
if ( opretlen < 0 )
{
printf("negative opretlen src_or_dest.%d\n",src_or_dest);
return(-1);
}
opretlen = dpow_opreturnscript(data,opret,opretlen);
if ( (n= dpow_paxpending(&opret[opretlen])) > 0 )
{
for (i=0; i<n; i++)
printf("%02x",opret[opretlen+i]);
printf(" <- withdraw.%d\n",n);
opretlen += n;
}
if ( opretlen < 0xfd )
serialized[len++] = opretlen;
else

11
iguana/iguana_notary.c

@ -60,7 +60,7 @@ void dpow_checkpointset(struct supernet_info *myinfo,struct dpow_checkpoint *che
void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t height,bits256 hash,uint32_t timestamp,uint32_t blocktime)
{
void **ptrs; char str[65]; struct dpow_checkpoint checkpoint; int32_t freq,minsigs; uint8_t pubkeys[64][33];
void **ptrs; char str[65]; struct dpow_checkpoint checkpoint; int32_t freq,minsigs; //uint8_t pubkeys[64][33];
dpow_checkpointset(myinfo,&dp->last,height,hash,timestamp,blocktime);
checkpoint = dp->srcfifo[dp->srcconfirms];
if ( strcmp("BTC",dp->dest) == 0 )
@ -71,9 +71,9 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he
else
{
freq = 1;
minsigs = (komodo_notaries(dp->symbol,pubkeys,height) >> 1) + 1;
if ( minsigs > DPOW_MINSIGS )
minsigs = DPOW_MINSIGS;
minsigs = 7;//(komodo_notaries(dp->symbol,pubkeys,height) >> 1) + 1;
//if ( minsigs < DPOW_MINSIGS )
// minsigs = DPOW_MINSIGS;
}
printf("%s/%s src ht.%d dest.%u nonz.%d %s minsigs.%d\n",dp->symbol,dp->dest,checkpoint.blockhash.height,dp->destupdated,bits256_nonz(checkpoint.blockhash.hash),bits256_str(str,dp->last.blockhash.hash),minsigs);
dpow_fifoupdate(myinfo,dp->srcfifo,dp->last);
@ -275,6 +275,9 @@ TWO_STRINGS(iguana,dpow,symbol,pubkey)
myinfo->numdpows++;
PAX_init();
portable_mutex_init(&dp->mutex);
//printf(">>>>>>>>>>>>>>> call paxpending\n");
//uint8_t buf[32768];
//dpow_paxpending(buf);
return(clonestr("{\"result\":\"success\"}"));
}

2
iguana/iguana_payments.c

@ -1238,7 +1238,7 @@ cJSON *iguana_listunspents(struct supernet_info *myinfo,struct iguana_info *coin
{
array = iguana_getaddressesbyaccount(myinfo,coin,"*");
flag = 1;
//printf("listunspent.(%s)\n",jprint(array,0));
printf("listunspent.(%s)\n",jprint(array,0));
}
if ( minconf == 0 )
minconf = 1;

5
iguana/iguana_wallet.c

@ -1731,7 +1731,7 @@ STRING_AND_THREEINTS(bitcoinrpc,listtransactions,account,count,skip,includewatch
return(clonestr("{\"error\":\"need to unlock wallet\"}"));
retjson = cJSON_CreateObject();
retarray = cJSON_CreateArray();
if ( (wacct= iguana_waccountfind(myinfo,account)) != 0 )
if ( account == 0 || account[0] == 0 || (wacct= iguana_waccountfind(myinfo,account)) != 0 )
{
if ( (array= iguana_getaddressesbyaccount(myinfo,coin,account)) != 0 )
{
@ -1768,7 +1768,8 @@ STRING_AND_THREEINTS(bitcoinrpc,listtransactions,account,count,skip,includewatch
"blocktime": 1448045745,
}*/
item = cJSON_CreateObject();
jaddstr(item,"account",wacct->account);
if ( wacct != 0 )
jaddstr(item,"account",wacct->account);
iguana_txdetails(myinfo,coin,item,txid,vout,iguana_txidheight(myinfo,coin,txid));
jaddi(retarray,item);
}

2
iguana/tests/listtransactions

@ -1,2 +1,2 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"listtransactions\",\"params\":[1, 9999999, [\"RUXwXF37SMA63vL4bUPnytP3KUwp69PCVv\"]]}"
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"listtransactions\",\"params\":[1, 9999999, []]}"

2
iguana/tests/listunspent

@ -1,2 +1,2 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTC\",\"method\":\"listunspent\",\"params\":[1, 9999999, []]}"
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"listunspent\",\"params\":[1, 9999999, []]}"

2
iguana/tests/listunspent2

@ -1,2 +1,2 @@
#!/bin/bash
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"listunspent\",\"params\":[1, 9999999, []]}"
curl --url "http://127.0.0.1:7778" --data "{\"coin\":\"BTCD\",\"method\":\"listunspent\",\"params\":[1, 9999999, [\"RNJmgYaFF5DbnrNUX6pMYz9rcnDKC2tuAc\"]]}"

Loading…
Cancel
Save