From 5f26e29d4d62fd8e489dd791e465c91c396594c5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 31 Oct 2017 21:49:43 +0200 Subject: [PATCH 1/6] Test --- iguana/dpow/dpow_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index 6da004617..5f695f84a 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -820,7 +820,7 @@ 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); + printf("no %s utxo: need to fund address.(%s) or wait for splitfund to confirm\n",coin->symbol,coinaddr); } //else printf("null utxo array size\n"); free_json(unspents); } else printf("null return from dpow_listunspent\n"); From e9da3e786e390e45d599239fe9c3979808b8cc85 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 31 Oct 2017 22:37:17 +0200 Subject: [PATCH 2/6] Server.version --- iguana/exchanges/LP_socket.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index af5cfb11e..9749f2273 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -454,7 +454,16 @@ cJSON *electrum_hasharg(char *symbol,struct electrum_info *ep,cJSON **retjsonp,c return(electrum_submit(symbol,ep,retjsonp,method,params,timeout)); } -cJSON *electrum_version(char *symbol,struct electrum_info *ep,cJSON **retjsonp) { return(electrum_noargs(symbol,ep,retjsonp,"server.version",ELECTRUM_TIMEOUT)); } +cJSON *electrum_version(char *symbol,struct electrum_info *ep,cJSON **retjsonp) +{ + char params[128]; cJSON *retjson; + if ( retjsonp == 0 ) + retjsonp = &retjson; + sprintf(params,"[\"client_name\":\"barterDEX\", \"protocol_version\":[\"1.1\", \"1.1\"]]"); + return(electrum_submit(symbol,ep,retjsonp,"server.version",params,ELECTRUM_TIMEOUT)); +} + + cJSON *electrum_banner(char *symbol,struct electrum_info *ep,cJSON **retjsonp) { return(electrum_noargs(symbol,ep,retjsonp,"server.banner",ELECTRUM_TIMEOUT)); } cJSON *electrum_donation(char *symbol,struct electrum_info *ep,cJSON **retjsonp) { return(electrum_noargs(symbol,ep,retjsonp,"server.donation_address",ELECTRUM_TIMEOUT)); } cJSON *electrum_peers(char *symbol,struct electrum_info *ep,cJSON **retjsonp) { return(electrum_noargs(symbol,ep,retjsonp,"server.peers.subscribe",ELECTRUM_TIMEOUT)); } @@ -767,7 +776,7 @@ void electrum_test() struct electrum_info *LP_electrum_info(int32_t *alreadyp,char *symbol,char *ipaddr,uint16_t port,int32_t bufsize) { - struct electrum_info *ep=0; int32_t i,sock; struct stritem *sitem; char name[512],*str = "init string"; + struct electrum_info *ep=0; cJSON *retjson; int32_t i,sock; struct stritem *sitem; char name[512],*str = "init string"; *alreadyp = 0; portable_mutex_lock(&LP_electrummutex); for (i=0; ipendingQ)) == 0 && strcmp(sitem->str,str) != 0 ) printf("error with string pendingQ sitem.%p (%s)\n",sitem,sitem==0?0:sitem->str); electrum_server(symbol,ep); + if ( (retjson= electrum_version(symbol,ep,0)) != 0 ) + printf("electrum_version %s\n",jprint(retjson,1)); } return(ep); } From 98b04c7b44778198e81e240806538a8b441709fb Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 31 Oct 2017 22:45:05 +0200 Subject: [PATCH 3/6] Test --- iguana/exchanges/LP_socket.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index 9749f2273..45f2d73f7 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -776,7 +776,7 @@ void electrum_test() struct electrum_info *LP_electrum_info(int32_t *alreadyp,char *symbol,char *ipaddr,uint16_t port,int32_t bufsize) { - struct electrum_info *ep=0; cJSON *retjson; int32_t i,sock; struct stritem *sitem; char name[512],*str = "init string"; + struct electrum_info *ep=0; int32_t i,sock; struct stritem *sitem; char name[512],*str = "init string"; *alreadyp = 0; portable_mutex_lock(&LP_electrummutex); for (i=0; ipendingQ)) == 0 && strcmp(sitem->str,str) != 0 ) printf("error with string pendingQ sitem.%p (%s)\n",sitem,sitem==0?0:sitem->str); electrum_server(symbol,ep); - if ( (retjson= electrum_version(symbol,ep,0)) != 0 ) - printf("electrum_version %s\n",jprint(retjson,1)); } return(ep); } @@ -904,9 +902,11 @@ void LP_dedicatedloop(void *arg) struct pollfd fds; int32_t i,len,flag,timeout = 10; struct iguana_info *coin; cJSON *retjson; struct stritem *sitem; struct electrum_info *ep = arg; if ( (coin= LP_coinfind(ep->symbol)) != 0 ) ep->heightp = &coin->height, ep->heighttimep = &coin->heighttime; - if ( (retjson= electrum_headers_subscribe(ep->symbol,ep,0)) != 0 ) + if ( (retjson= electrum_headers_subscribe(ep->symbol,ep,&retjson)) != 0 ) free_json(retjson); - printf("LP_dedicatedloop ep.%p sock.%d for %s:%u num.%d %p %s ht.%d\n",ep,ep->sock,ep->ipaddr,ep->port,Num_electrums,&Num_electrums,ep->symbol,*ep->heightp); + if ( (retjson= electrum_version(ep->symbol,ep,&retjson)) != 0 ) + printf("electrum_version %s\n",jprint(retjson,1)); + printf("LP_dedicatedloop ep.%p sock.%d for %s:%u num.%d %p %s ht.%d\n",ep,ep->sock,ep->ipaddr,ep->port,Num_electrums,&Num_electrums,ep->symbol,*ep->heightp); while ( ep->sock >= 0 ) { flag = 0; From c5eb47ce8d9a5720ca25a74a68424977089e3969 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 31 Oct 2017 22:46:54 +0200 Subject: [PATCH 4/6] Test --- iguana/exchanges/LP_socket.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index 45f2d73f7..e6b51ae6c 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -459,7 +459,7 @@ cJSON *electrum_version(char *symbol,struct electrum_info *ep,cJSON **retjsonp) char params[128]; cJSON *retjson; if ( retjsonp == 0 ) retjsonp = &retjson; - sprintf(params,"[\"client_name\":\"barterDEX\", \"protocol_version\":[\"1.1\", \"1.1\"]]"); + sprintf(params,"[\"barterDEX\", [\"1.1\", \"1.1\"]]"); return(electrum_submit(symbol,ep,retjsonp,"server.version",params,ELECTRUM_TIMEOUT)); } @@ -902,11 +902,11 @@ void LP_dedicatedloop(void *arg) struct pollfd fds; int32_t i,len,flag,timeout = 10; struct iguana_info *coin; cJSON *retjson; struct stritem *sitem; struct electrum_info *ep = arg; if ( (coin= LP_coinfind(ep->symbol)) != 0 ) ep->heightp = &coin->height, ep->heighttimep = &coin->heighttime; - if ( (retjson= electrum_headers_subscribe(ep->symbol,ep,&retjson)) != 0 ) - free_json(retjson); if ( (retjson= electrum_version(ep->symbol,ep,&retjson)) != 0 ) printf("electrum_version %s\n",jprint(retjson,1)); - printf("LP_dedicatedloop ep.%p sock.%d for %s:%u num.%d %p %s ht.%d\n",ep,ep->sock,ep->ipaddr,ep->port,Num_electrums,&Num_electrums,ep->symbol,*ep->heightp); + if ( (retjson= electrum_headers_subscribe(ep->symbol,ep,&retjson)) != 0 ) + free_json(retjson); + printf("LP_dedicatedloop ep.%p sock.%d for %s:%u num.%d %p %s ht.%d\n",ep,ep->sock,ep->ipaddr,ep->port,Num_electrums,&Num_electrums,ep->symbol,*ep->heightp); while ( ep->sock >= 0 ) { flag = 0; From c5b1b8b9a4b796bb69da0b15b3d818778fbafea8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 31 Oct 2017 22:56:12 +0200 Subject: [PATCH 5/6] Test --- iguana/exchanges/LP_socket.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index e6b51ae6c..ca409527a 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -902,6 +902,7 @@ void LP_dedicatedloop(void *arg) struct pollfd fds; int32_t i,len,flag,timeout = 10; struct iguana_info *coin; cJSON *retjson; struct stritem *sitem; struct electrum_info *ep = arg; if ( (coin= LP_coinfind(ep->symbol)) != 0 ) ep->heightp = &coin->height, ep->heighttimep = &coin->heighttime; + sleep(2); if ( (retjson= electrum_version(ep->symbol,ep,&retjson)) != 0 ) printf("electrum_version %s\n",jprint(retjson,1)); if ( (retjson= electrum_headers_subscribe(ep->symbol,ep,&retjson)) != 0 ) From d3fed6994fd25224f57958cb4208693336c19b77 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 31 Oct 2017 23:03:35 +0200 Subject: [PATCH 6/6] Test --- iguana/iguana_notary.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 65d42428e..c8808191b 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -145,8 +145,10 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he } else { - freq = 1; minsigs = DPOW_MIN_ASSETCHAIN_SIGS; + if ( strcmp("CHIPS",dp->symbol) == 0 ) + freq = 100; + else freq = 1; } dpow_fifoupdate(myinfo,dp->srcfifo,dp->last); if ( strcmp(dp->dest,"KMD") == 0 )