diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 5e2ff0546..eae80f0fc 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -274,6 +274,7 @@ char *dex_response(int32_t *broadcastflagp,struct supernet_info *myinfo,struct d *broadcastflagp = 1; if ( retstr == 0 ) retstr = dpow_validateaddress(myinfo,coin,(char *)&dexp->packet[datalen]); + else printf("funcA.(%s)\n",retstr); } else if ( dexreq.func == 'V' ) { diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 166bfc463..8ee5caec2 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -441,6 +441,7 @@ char *dpow_importaddress(struct supernet_info *myinfo,struct iguana_info *coin,c { sprintf(buf,"[\"%s\", \"%s\", false]",address,address); retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"importaddress",buf); + printf("importaddress.(%s) -> (%s)\n",address,retstr); if ( (alladdresses= dpow_alladdresses(myinfo,coin)) != 0 ) { if ( (alljson= cJSON_Parse(alladdresses)) != 0 ) @@ -478,6 +479,7 @@ char *dpow_importaddress(struct supernet_info *myinfo,struct iguana_info *coin,c { sprintf(buf,"[\"%s\"]",address); sprintf(fname,"%s/alladdresses.%s",GLOBAL_CONFSDIR,coin->symbol), OS_compatible_path(fname); + printf("first importaddress.(%s) -> %s\n",fname); if ( (fp= fopen(fname,"wb")) != 0 ) { fwrite(buf,1,strlen(buf)+1,fp); diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 473e0231b..af9ece78f 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -837,23 +837,9 @@ void iguana_helper(void *arg) } } -/* -To add a new dPoW'ed assetchain with DEX* API support: - 1. add to komodo/src: assetchains, dpowassets, fiat-cli - 2. add to end of CURRENCIES[] array in fundnotaries (iguana_notary.c) - 3. create fiat/ - 4. add to NOTARYCHAINS[] array in iguana_callcoinstart - 5. add to m_notary coins/ get gen_acname from where komodod was launched, change RELAY:-1 and port to 7776 and make _7776 variant - 6. launch from a single node with -gen, launch a second node using -addnode= but without -gen - 7. from a single node, fundnotaries to get notaries able to dPoW -*/ - void iguana_callcoinstart(struct supernet_info *myinfo,struct iguana_info *coin) { - char NOTARYCHAINS[][16] = { "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", // major currencies - "CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK", - "KMD", "BTC", "REVS", "SUPERNET", "DEX", "PANGEA", "JUMBLR", "BET", "CRYPTO", "HODL", "SHARK", "BOTS", "MGW", "MVP" }; - struct iguana_bundle *bp; struct iguana_peer *addr; int32_t i,bundlei; bits256 zero; char dirname[512],*symbol; + struct iguana_bundle *bp; struct iguana_peer *addr; int32_t bundlei; bits256 zero; char dirname[512],*symbol; iguana_rwiAddrind(coin,0,0,0); //for (i=0; ichain); i++) // printf("%02x",((uint8_t *)coin->chain)[i]); @@ -883,17 +869,8 @@ void iguana_callcoinstart(struct supernet_info *myinfo,struct iguana_info *coin) memset(zero.bytes,0,sizeof(zero)); if ( (bp= iguana_bundlecreate(coin,&bundlei,0,*(bits256 *)coin->chain->genesis_hashdata,zero,1)) != 0 ) bp->bundleheight = 0; - coin->notarychain = -1; - if ( coin->FULLNODE == 0 ) - { - for (i=0; isymbol,NOTARYCHAINS[i]) == 0 ) - { - printf("SET NOTARYCHAIN.%d\n",i); - coin->notarychain = i; - break; - } - } + if ( coin->FULLNODE != 0 ) + coin->notarychain = -1; addr = &coin->peers->active[IGUANA_MAXPEERS-2]; iguana_initpeer(coin,addr,(uint32_t)calc_ipbits(coin->seedipaddr)); printf("SEED_IPADDR initpeer.(%s) notarychain.%d\n",addr->ipaddr,coin->notarychain); @@ -919,7 +896,6 @@ void iguana_coinloop(void *arg) if ( coin->didaddresses == 0 ) { coin->didaddresses = 1; - coin->notarychain = -1; if ( myinfo->IAMNOTARY != 0 && (alladdresses= _dex_alladdresses(myinfo,coin->symbol)) != 0 ) { if ( (alljson= cJSON_Parse(alladdresses)) != 0 ) diff --git a/iguana/iguana_init.c b/iguana/iguana_init.c index 961996a23..9f2622d74 100755 --- a/iguana/iguana_init.c +++ b/iguana/iguana_init.c @@ -15,6 +15,16 @@ #include "iguana777.h" +/* + To add a new dPoW'ed assetchain with DEX* API support: + 1. add to komodo/src: assetchains, dpowassets, fiat-cli + 2. add to end of NOTARY_CURRENCIES[] array in fundnotaries (iguana_notary.c) + 3. create fiat/ + 4. add to m_notary coins/ get gen_acname from where komodod was launched, change RELAY:-1 and port to 7776 and make _7776 variant + 5. launch from a single node with -gen, launch a second node using -addnode= but without -gen + 6. from a single node, fundnotaries to get notaries able to dPoW + */ + void iguana_initQ(queue_t *Q,char *name) { struct stritem *tst,*item; @@ -74,6 +84,7 @@ void iguana_initcoin(struct iguana_info *coin,cJSON *argjson) iguana_meminit(&coin->blockMEM,"blockMEM",coin->blockspace,coin->blockspacesize,0); iguana_initQs(coin); coin->bindsock = -1; + coin->notarychain = -1; OS_randombytes((unsigned char *)&coin->instance_nonce,sizeof(coin->instance_nonce)); coin->startutc = (uint32_t)time(NULL); while ( time(NULL) == coin->startutc ) @@ -516,7 +527,7 @@ void iguana_coinpurge(struct iguana_info *coin) struct iguana_info *iguana_coinstart(struct supernet_info *myinfo,struct iguana_info *coin,int32_t initialheight,int32_t mapflags) { - FILE *fp; char fname[512],*symbol; int32_t j,iter; long fpos; bits256 lastbundle; + FILE *fp; char fname[512],*symbol,*jsonstr; cJSON *chains; int32_t j,i,n,iter; long fpos; bits256 lastbundle; /*if ( coin->peers == 0 ) { printf("cant start privatechain directly\n"); @@ -564,6 +575,25 @@ struct iguana_info *iguana_coinstart(struct supernet_info *myinfo,struct iguana_ } } } + coin->notarychain = -1; + if ( (jsonstr= dpow_notarychains(0,0,0,0)) != 0 ) + { + if ( (chains= cJSON_Parse(jsonstr)) != 0 ) + { + if ( (n= cJSON_GetArraySize(chains)) > 0 ) + { + for (i=0; isymbol,jstri(chains,i)) == 0 ) + { + printf("SET %s NOTARYCHAIN.%d\n",coin->symbol,i); + coin->notarychain = i; + break; + } + } + free_json(chains); + } + free(jsonstr); + } if ( coin->notarychain >= 0 ) return(coin); //coin->firstblock = coin->blocks.parsedblocks + 1; diff --git a/iguana/tests/basilisk b/iguana/tests/basilisk deleted file mode 100755 index a4de1766d..000000000 --- a/iguana/tests/basilisk +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"basilisk\",\"method\":\"paxfiats\"}" diff --git a/iguana/tests/basilisks b/iguana/tests/basilisks new file mode 100755 index 000000000..078d2463e --- /dev/null +++ b/iguana/tests/basilisks @@ -0,0 +1,17 @@ +#!/bin/bash +../coins/basilisk/bet +../coins/basilisk/btc +../coins/basilisk/dex +../coins/basilisk/jumblr +../coins/basilisk/mgw +../coins/basilisk/pangea +../coins/basilisk/shark +../coins/basilisk/bots +../coins/basilisk/crypto +../coins/basilisk/hodl +../coins/basilisk/kmd +../coins/basilisk/mvp +../coins/basilisk/revs +../coins/basilisk/supernet + +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"basilisk\",\"method\":\"paxfiats\"}" diff --git a/iguana/tests/dexalladdresses b/iguana/tests/dexalladdresses index 24feefa9c..5141f8d1b 100755 --- a/iguana/tests/dexalladdresses +++ b/iguana/tests/dexalladdresses @@ -1,2 +1,4 @@ #!/bin/bash curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"alladdresses\",\"symbol\":\"BTC\"}" +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"alladdresses\",\"symbol\":\"MVP\"}" +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"alladdresses\",\"symbol\":\"USD\"}" diff --git a/iguana/tests/deximportaddress b/iguana/tests/deximportaddress index ae340b58e..6acb8ffd3 100755 --- a/iguana/tests/deximportaddress +++ b/iguana/tests/deximportaddress @@ -1,2 +1,4 @@ #!/bin/bash -curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"15R3C2ZKmak5pCc4duLY2jLtFD3o1jaeNd\",\"symbol\":\"BTC\"}" +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"1Hgzt5xsnbfc8UTWqWKSTLRm5bEYHYBoCE\",\"symbol\":\"BTC\"}" +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RRyBxbrAPRUBCUpiJgJZYrkxqrh8x5ta9Z\",\"symbol\":\"USD\"}" +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"importaddress\",\"address\":\"RRyBxbrAPRUBCUpiJgJZYrkxqrh8x5ta9Z\",\"symbol\":\"MVP\"}" diff --git a/iguana/tests/dexlistunspent b/iguana/tests/dexlistunspent index ac18edf80..4e353d69b 100755 --- a/iguana/tests/dexlistunspent +++ b/iguana/tests/dexlistunspent @@ -1,2 +1,2 @@ #!/bin/bash -curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"1E2ac2gxeFR2ir1H3vqETTperWkiXkwy99\",\"symbol\":\"BTC\"}" +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"dex\",\"method\":\"listunspent\",\"address\":\"1Hgzt5xsnbfc8UTWqWKSTLRm5bEYHYBoCE\",\"symbol\":\"BTC\"}"