From 4e5bd03c8f5a7e67340383dd21de8c36d81f7d34 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 21 Apr 2018 18:26:14 +0300 Subject: [PATCH] Add txblast to commands --- iguana/exchanges/LP_commands.c | 7 +++++++ iguana/exchanges/LP_transaction.c | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 8263111c6..3278e03f2 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -120,6 +120,7 @@ cancel(uuid)\n\ buy(base, rel, price, relvolume, timeout=10, duration=3600, nonce)\n\ sell(base, rel, price, basevolume, timeout=10, duration=3600, nonce)\n\ withdraw(coin, outputs[], broadcast=0)\n\ +txblast(coin, utxotxid, utxovout, utxovalue, txfee, passphrase, outputs[], broadcast=0)\n\ sendrawtransaction(coin, signedtx)\n\ swapstatus(pending=0, fast=0)\n\ swapstatus(coin, limit=10)\n\ @@ -649,6 +650,12 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\ { return(jprint(LP_gettx("stats_JSON",coin,jbits256(argjson,"txid"),0),1)); } + else if ( strcmp(method,"txblast") == 0 ) + { + if ( (ptr= LP_coinsearch(coin)) != 0 ) + return(LP_txblast(ptr,argjson)); + else return(clonestr("{\"error\":\"cant find coind\"}")); + } else if ( strcmp(method,"withdraw") == 0 ) { if ( (ptr= LP_coinsearch(coin)) != 0 ) diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 3ad1796fa..990c374bc 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -1640,7 +1640,7 @@ char *LP_createblasttransaction(uint64_t *changep,int32_t *changeoutp,cJSON **tx char *LP_txblast(struct iguana_info *coin,cJSON *argjson) { static void *ctx; - int32_t broadcast,i,num,numblast,utxovout,completed=0,numvouts,changeout; char *passphrase,changeaddr[64],vinaddr[64],wifstr[65],str[65],*signret,*signedtx=0,*rawtx=0; struct vin_info V; uint32_t locktime,starttime; uint8_t pubkey33[33]; cJSON *retjson,*item,*outputs,*vins=0,*txobj=0,*privkeys=0; struct iguana_msgtx msgtx; bits256 privkey,pubkey,checktxid,utxotxid,signedtxid; uint64_t txfee,utxovalue,change; + int32_t broadcast,i,num,numblast,utxovout,completed=0,numvouts,changeout; char *passphrase,changeaddr[64],vinaddr[64],wifstr[65],blastaddr[65],str[65],*signret,*signedtx=0,*rawtx=0; struct vin_info V; uint32_t locktime,starttime; uint8_t pubkey33[33]; cJSON *retjson,*item,*outputs,*vins=0,*txobj=0,*privkeys=0; struct iguana_msgtx msgtx; bits256 privkey,pubkey,checktxid,utxotxid,signedtxid; uint64_t txfee,utxovalue,change; if ( ctx == 0 ) ctx = bitcoin_ctx(); if ( (passphrase= jstr(argjson,"passphrase")) == 0 ) @@ -1651,7 +1651,7 @@ char *LP_txblast(struct iguana_info *coin,cJSON *argjson) numblast = jint(argjson,"numblast"); utxovalue = j64bits(argjson,"utxovalue"); txfee = juint(argjson,"txfee"); - conv_NXTpassword(privkey.bytes,pubkeyp->bytes,(uint8_t *)passphrase,(int32_t)strlen(passphrase)); + conv_NXTpassword(privkey.bytes,pubkey.bytes,(uint8_t *)passphrase,(int32_t)strlen(passphrase)); privkey.bytes[0] &= 248, privkey.bytes[31] &= 127, privkey.bytes[31] |= 64; bitcoin_priv2wif(coin->symbol,coin->wiftaddr,wifstr,privkey,coin->wiftype); bitcoin_priv2pub(ctx,coin->symbol,pubkey33,blastaddr,privkey,coin->taddr,coin->pubtype); @@ -1710,6 +1710,7 @@ char *LP_txblast(struct iguana_info *coin,cJSON *argjson) free_json(privkeys), privkeys = 0; retjson = cJSON_CreateObject(); jaddstr(retjson,"result","success"); + jaddstr(retjson,"blastaddr",blastaddr); jaddnum(retjson,"numblast",numblast); jaddnum(retjson,"completed",i); jaddbits256(retjson,"lastutxo",utxotxid);