diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 1620cbe2f..8fec237e6 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -167,7 +167,7 @@ instantdex_claim()\n\ timelock(coin, duration, destaddr=(tradeaddr), amount)\n\ unlockedspend(coin, txid)\n\ opreturndecrypt(coin, txid, passphrase)\n\ -getendpoint()\n\ +getendpoint(port=5555)\n\ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ \"}")); //sell(base, rel, price, basevolume, timeout=10, duration=3600)\n\ @@ -234,22 +234,25 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ } else if ( strcmp(method,"getendpoint") == 0 ) { - int32_t err,mode; + int32_t err,mode; uint16_t wsport = 5555; char endpoint[64],bindpoint[64]; + if ( juint(argjson,"port") != 0 ) + wsport = juint(argjson,"port"); retjson = cJSON_CreateObject(); if ( IPC_ENDPOINT >= 0 ) { jaddstr(retjson,"error","IPC endpoint already exists"); - jaddstr(retjson,"endpoint","ws://*:5555"); jaddnum(retjson,"socket",IPC_ENDPOINT); } else { if ( (IPC_ENDPOINT= nn_socket(AF_SP,NN_PAIR)) >= 0 ) { - if ( (err= nn_bind(IPC_ENDPOINT,"ws://*:5555")) >= 0 ) + sprintf(bindpoint,"ws://*:%u",port); + sprintf(endpoint,"ws://127.0.0.1:%u",port); + if ( (err= nn_bind(IPC_ENDPOINT,bindpoint)) >= 0 ) { jaddstr(retjson,"result","success"); - jaddstr(retjson,"endpoint","ws://127.0.0.1:5555"); + jaddstr(retjson,"endpoint",endpoint); jaddnum(retjson,"socket",IPC_ENDPOINT); mode = NN_WS_MSG_TYPE_TEXT; err = nn_setsockopt(IPC_ENDPOINT,NN_SOL_SOCKET,NN_WS_MSG_TYPE,&mode,sizeof(mode)); diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index b0f5a46a5..974b5b6de 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -1491,7 +1491,9 @@ char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel memset(&A,0,sizeof(A)); LP_address_utxo_reset(relcoin); if ( (autxo= LP_address_myutxopair(&A,0,utxos,max,relcoin,relcoin->smartaddr,txfee,dstr(destsatoshis),maxprice,desttxfee)) == 0 ) + { return(clonestr("{\"error\":\"cant find a deposit that is close enough in size. make another deposit that is just a bit larger than what you want to trade\"}")); + } //printf("bestfit selected alice (%.8f %.8f) for %.8f sats %.8f\n",dstr(autxo->payment.value),dstr(autxo->fee.value),dstr(destsatoshis),dstr(autxo->swap_satoshis)); if ( destsatoshis - desttxfee < autxo->swap_satoshis ) {