Browse Source

Merge branch 'dev' of https://github.com/jl777/SuperNET into etomic

pass-iguana-arg
Artem Pikulin 7 years ago
parent
commit
f928bfea2a
  1. 2
      iguana/dpow/dpow_fsm.c
  2. 15
      iguana/dpow/dpow_rpc.c
  3. 26
      iguana/exchanges/LP_commands.c
  4. 2
      iguana/exchanges/coins
  5. 1
      iguana/iguana777.h
  6. 1
      iguana/m_notary_run
  7. 4
      iguana/main.c

2
iguana/dpow/dpow_fsm.c

@ -143,7 +143,7 @@ int32_t dpow_checkutxo(struct supernet_info *myinfo,struct dpow_info *dp,struct
{ {
addresses = cJSON_CreateArray(); addresses = cJSON_CreateArray();
jaddistr(addresses,coinaddr); jaddistr(addresses,coinaddr);
if ( (rawtx= iguana_utxoduplicates(myinfo,coin,dp->minerkey33,DPOW_UTXOSIZE,n,&completed,&signedtxid,0,addresses)) != 0 ) if ( myinfo->nosplit == 0 && (rawtx= iguana_utxoduplicates(myinfo,coin,dp->minerkey33,DPOW_UTXOSIZE,n,&completed,&signedtxid,0,addresses)) != 0 )
{ {
if ( (sendtx= dpow_sendrawtransaction(myinfo,coin,rawtx)) != 0 ) if ( (sendtx= dpow_sendrawtransaction(myinfo,coin,rawtx)) != 0 )
{ {

15
iguana/dpow/dpow_rpc.c

@ -277,10 +277,10 @@ int32_t dpow_paxpending(uint8_t *hex,int32_t hexsize,uint32_t *paxwdcrcp,bits256
{ {
n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes); n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes);
n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth);
if ( strcmp(bp->srccoin->symbol,"PIZZA") == 0 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) if ( strncmp(bp->srccoin->symbol,"TXSCL",5) == 0 && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 )
{ {
kmdcoin = bp->destcoin; kmdcoin = bp->destcoin;
if ( (bp->height % 10) == 0 && kmdcoin->lastbestheight > 100 && (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,(kmdcoin->lastbestheight/10)*10 - 5)) != 0 ) if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,(kmdcoin->lastbestheight/10)*10 - 5)) != 0 )
{ {
if ( (hexstr= jstr(retjson,"data")) != 0 && (hexlen= (int32_t)strlen(hexstr)) > 0 && n+hexlen/2 <= hexsize ) if ( (hexstr= jstr(retjson,"data")) != 0 && (hexlen= (int32_t)strlen(hexstr)) > 0 && n+hexlen/2 <= hexsize )
{ {
@ -380,6 +380,13 @@ cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits2
return(json); return(json);
} }
int32_t dpow_is015(char *symbol)
{
if ( strcmp("CHIPS",symbol) == 0 || strcmp("GAME",symbol) == 0 ) //strcmp("BTC",symbol) == 0 ||
return(1);
else return(0);
}
char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address) char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address)
{ {
char buf[128],*retstr=0; cJSON *retjson; char buf[128],*retstr=0; cJSON *retjson;
@ -391,7 +398,7 @@ char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin
//printf("%s -> (%s)\n",buf,retstr!=0?retstr:"null"); //printf("%s -> (%s)\n",buf,retstr!=0?retstr:"null");
if ( (retjson= cJSON_Parse(retstr)) != 0 ) if ( (retjson= cJSON_Parse(retstr)) != 0 )
{ {
if ( strcmp(coin->symbol,"BTC") == 0 && jobj(retjson,"error") == 0 && jobj(retjson,"ismine") == 0 && strcmp(coin->validateaddress,"validateaddress") == 0 ) if ( dpow_is015(coin->symbol) != 0 && jobj(retjson,"error") == 0 && jobj(retjson,"ismine") == 0 && strcmp(coin->validateaddress,"validateaddress") == 0 )
{ {
printf("autochange %s validateaddress -> getaddressinfo\n",coin->symbol); printf("autochange %s validateaddress -> getaddressinfo\n",coin->symbol);
strcpy(coin->validateaddress,"getaddressinfo"); strcpy(coin->validateaddress,"getaddressinfo");
@ -581,7 +588,7 @@ char *dpow_signrawtransaction(struct supernet_info *myinfo,struct iguana_info *c
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,coin->signtxstr,paramstr); retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,coin->signtxstr,paramstr);
if ( strcmp(coin->signtxstr,"signrawtransaction") == 0 && (retjson= cJSON_Parse(retstr)) != 0 ) if ( strcmp(coin->signtxstr,"signrawtransaction") == 0 && (retjson= cJSON_Parse(retstr)) != 0 )
{ {
if ( jobj(retjson,"error") != 0 ) if ( jobj(retjson,"error") != 0 && dpow_is015(coin->symbol) != 0 )
{ {
strcpy(coin->signtxstr,"signrawtransactionwithwallet"); strcpy(coin->signtxstr,"signrawtransactionwithwallet");
free(retstr); free(retstr);

26
iguana/exchanges/LP_commands.c

@ -477,6 +477,32 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
{ {
return(jprint(LP_tradesarray(base,rel,juint(argjson,"starttime"),juint(argjson,"endtime"),jint(argjson,"timescale")),1)); return(jprint(LP_tradesarray(base,rel,juint(argjson,"starttime"),juint(argjson,"endtime"),jint(argjson,"timescale")),1));
} }
else if ( strcmp(method,"getprice") == 0 || strcmp(method,"getmyprice") == 0 )
{
double price,bid,ask;
if ( strcmp(method,"getprice") == 0 )
{
ask = LP_price(base,rel);
if ( (bid= LP_price(rel,base)) > SMALLVAL )
bid = 1./bid;
}
else
{
ask = LP_getmyprice(base,rel);
if ( (bid= LP_getmyprice(rel,base)) > SMALLVAL )
bid = 1./bid;
}
price = _pairaved(bid,ask);
retjson = cJSON_CreateObject();
jaddstr(retjson,"result","success");
jaddstr(retjson,"base",base);
jaddstr(retjson,"rel",rel);
jaddnum(retjson,"timestamp",time(NULL));
jaddnum(retjson,"bid",bid);
jaddnum(retjson,"ask",ask);
jaddnum(retjson,"price",price);
return(jprint(retjson,1));
}
if ( IAMLP == 0 && LP_isdisabled(base,rel) != 0 ) if ( IAMLP == 0 && LP_isdisabled(base,rel) != 0 )
return(clonestr("{\"error\":\"at least one of coins disabled\"}")); return(clonestr("{\"error\":\"at least one of coins disabled\"}"));
price = jdouble(argjson,"price"); price = jdouble(argjson,"price");

2
iguana/exchanges/coins

File diff suppressed because one or more lines are too long

1
iguana/iguana777.h

@ -193,6 +193,7 @@ struct supernet_info
FILE *swapsfp; FILE *swapsfp;
double DEXratio; double DEXratio;
struct smartaddress smartaddrs[64]; int32_t numsmartaddrs,cancelrefresh,runsilent,DEXtrades; struct smartaddress smartaddrs[64]; int32_t numsmartaddrs,cancelrefresh,runsilent,DEXtrades;
int32_t nosplit;
}; };
struct basilisk_swapmessage struct basilisk_swapmessage

1
iguana/m_notary_run

@ -20,7 +20,6 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"ad
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"82.202.193.98\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"82.202.193.98\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"54.95.68.31\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"54.95.68.31\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"142.54.164.114\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"142.54.164.114\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"45.7.229.33\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"103.6.12.111\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"103.6.12.111\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"155.254.17.21\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"155.254.17.21\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"138.121.203.210\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"138.121.203.210\"}"

4
iguana/main.c

@ -2212,8 +2212,10 @@ void iguana_main(void *arg)
myinfo->rpcport = atoi(&((char *)arg)[6]); myinfo->rpcport = atoi(&((char *)arg)[6]);
printf("OVERRIDE IGUANA port <- %u\n",myinfo->rpcport); printf("OVERRIDE IGUANA port <- %u\n",myinfo->rpcport);
} }
else if ( strcmp((char *)arg,"notary") == 0 ) // must be second to last else if ( strncmp((char *)arg,"notary",strlen("notary")) == 0 ) // must be second to last
{ {
if ( strcmp((char *)arg,"notary_nosplit") == 0 )
myinfo->nosplit = 1;
myinfo->rpcport = IGUANA_NOTARYPORT; myinfo->rpcport = IGUANA_NOTARYPORT;
myinfo->IAMNOTARY = 1; myinfo->IAMNOTARY = 1;
myinfo->DEXEXPLORER = 0;//1; disable as SPV is used now myinfo->DEXEXPLORER = 0;//1; disable as SPV is used now

Loading…
Cancel
Save