|
|
@ -595,7 +595,7 @@ void LP_initpeers(int32_t pubsock,struct LP_peerinfo *mypeer,char *myipaddr,uint |
|
|
|
|
|
|
|
void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybusport,char *passphrase,int32_t amclient,char *userhome,cJSON *argjson) |
|
|
|
{ |
|
|
|
char *myipaddr=0; long filesize,n; int32_t timeout,pubsock=-1; struct LP_peerinfo *mypeer=0; char pushaddr[128],subaddr[128],bindaddr[128]; void *ctx = bitcoin_ctx(); |
|
|
|
char *myipaddr=0; long filesize,n; int32_t timeout,pubsock=-1; struct LP_peerinfo *mypeer=0; char pushaddr[128],subaddr[128],bindaddr[128],*coins_str=0; cJSON *coinsjson=0; void *ctx = bitcoin_ctx(); |
|
|
|
LP_showwif = juint(argjson,"wif"); |
|
|
|
if ( passphrase == 0 || passphrase[0] == 0 ) |
|
|
|
{ |
|
|
@ -701,7 +701,23 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu |
|
|
|
//LP_deadman_switch = (uint32_t)time(NULL);
|
|
|
|
printf("canbind.%d my command address is (%s) pullsock.%d pullport.%u\n",LP_canbind,pushaddr,LP_mypullsock,mypullport); |
|
|
|
printf("initcoins\n"); |
|
|
|
LP_initcoins(ctx,pubsock,jobj(argjson,"coins")); |
|
|
|
if ( (coinsjson= jobj(argjson,"coins")) == 0 ) |
|
|
|
{ |
|
|
|
if ( (coins_str= OS_filestr(&filesize,"coins")) != 0 ) |
|
|
|
{ |
|
|
|
unstringify(coins_str); |
|
|
|
printf("UNSTRINGIFIED.(%s)\n",coins_str); |
|
|
|
coinsjson = cJSON_Parse(coins_str); |
|
|
|
free(coins_str); |
|
|
|
// yes I know this coinsjson is not freed, not sure about if it is referenced
|
|
|
|
} |
|
|
|
} |
|
|
|
if ( coinsjson == 0 ) |
|
|
|
{ |
|
|
|
printf("no coins object or coins file, must abort\n"); |
|
|
|
exit(-1); |
|
|
|
} |
|
|
|
LP_initcoins(ctx,pubsock,coinsjson); |
|
|
|
G.waiting = 1; |
|
|
|
LP_passphrase_init(passphrase,jstr(argjson,"gui")); |
|
|
|
if ( IAMLP != 0 && OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_psockloop,(void *)&myipaddr) != 0 ) |
|
|
|