Browse Source

Merge pull request #395 from jl777/spvdex

getrawtransaction
tradestatus
etomic
jl777 7 years ago
committed by GitHub
parent
commit
a0a9bee2b0
  1. 11
      iguana/exchanges/LP_commands.c
  2. 4
      iguana/exchanges/LP_remember.c
  3. 6
      iguana/exchanges/LP_signatures.c
  4. 3
      iguana/exchanges/getrawtransaction

11
iguana/exchanges/LP_commands.c

@ -104,6 +104,7 @@ goal(coin=*, val=<autocalc>)\n\
myprice(base, rel)\n\
enable(coin)\n\
disable(coin)\n\
getrawtransaction(coin, txid)\n\
inventory(coin)\n\
bestfit(rel, relvolume)\n\
lastnonce()\n\
@ -329,6 +330,10 @@ stop()\n\
{
return(LP_sendrawtransaction(coin,jstr(argjson,"signedtx")));
}
else if ( strcmp(method,"getrawtransaction") == 0 )
{
return(jprint(LP_gettx(coin,jbits256(argjson,"txid")),0));
}
else if ( strcmp(method,"withdraw") == 0 )
{
if ( (ptr= LP_coinsearch(coin)) != 0 )
@ -448,6 +453,12 @@ stop()\n\
// end received response
// public access, even from http
else if ( strcmp(method,"tradestatus") == 0 )
{
LP_tradecommand_log(argjson);
printf("GOT TRADESTATUS! %s\n",jprint(argjson,0));
retstr = clonestr("{\"result\":\"success\"}");
}
else if ( strcmp(method,"balance") == 0 )
{
if ( (ptr= LP_coinsearch(jstr(argjson,"coin"))) != 0 )

4
iguana/exchanges/LP_remember.c

@ -1107,9 +1107,11 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti
sprintf(fname,"%s/SWAPS/%u-%u.finished",GLOBAL_DBDIR,rswap.requestid,rswap.quoteid), OS_compatible_path(fname);
if ( (fp= fopen(fname,"wb")) != 0 )
{
jaddstr(item,"method","tradestatus");
itemstr = jprint(item,0);
fprintf(fp,"%s\n",itemstr);
free(itemstr);
LP_reserved_msg(rswap.src,rswap.dest,zero,clonestr(itemstr));
LP_broadcast_message(LP_mypubsock,rswap.src,rswap.dest,zero,itemstr);
fclose(fp);
}
}

6
iguana/exchanges/LP_signatures.c

@ -250,7 +250,7 @@ bits256 LP_utxos_sighash(uint32_t timestamp,uint8_t *pubsecp,bits256 pubkey,bits
int32_t LP_utxos_sigcheck(uint32_t timestamp,char *sigstr,char *pubsecpstr,bits256 pubkey,bits256 utxoshash)
{
static void *ctx; int32_t retval=-1; uint8_t pub33[33],pubsecp[33],sig[65]; bits256 sighash;
static void *ctx; int32_t retval=-1; uint8_t pub33[33],pubsecp[33],sig[65]; bits256 sighash; char str[65];
if ( ctx == 0 )
ctx = bitcoin_ctx();
if ( sigstr != 0 && pubsecpstr != 0 && strlen(sigstr) == 65*2 && strlen(pubsecpstr) == 33 *2 )
@ -261,7 +261,9 @@ int32_t LP_utxos_sigcheck(uint32_t timestamp,char *sigstr,char *pubsecpstr,bits2
retval = bitcoin_recoververify(ctx,"utxos",sig,sighash,pub33,0);
if ( memcmp(pub33,pubsecp,33) != 0 || retval != 0 )
{
printf("LP_utxos_sigcheck failure, probably from node with older version\n");
static uint32_t counter;
if ( counter++ < 100 )
printf("LP_utxos_sigcheck failure, probably from %s with older version\n",bits256_str(str,pubkey));
retval = -1;
} else retval = 0;
}

3
iguana/exchanges/getrawtransaction

@ -0,0 +1,3 @@
#!/bin/bash
source userpass
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"getrawtransaction\",\"coin\":\"KMD\",\"txid\":\"107a2683abbfa9188f78e17d3bcba66ece5bd7cbe105ab5bbaae79364159e84d\"}"
Loading…
Cancel
Save