|
|
@ -217,6 +217,8 @@ cJSON *LP_inventoryjson(cJSON *item,struct LP_utxoinfo *utxo) |
|
|
|
{ |
|
|
|
struct _LP_utxoinfo u; |
|
|
|
jaddstr(item,"method","notified"); |
|
|
|
if ( utxo->gui[0] != 0 ) |
|
|
|
jaddstr(item,"gui",utxo->gui); |
|
|
|
jaddstr(item,"coin",utxo->coin); |
|
|
|
jaddnum(item,"now",time(NULL)); |
|
|
|
jaddnum(item,"iambob",utxo->iambob); |
|
|
@ -406,7 +408,7 @@ char *LP_spentcheck(cJSON *argjson) |
|
|
|
return(clonestr("{\"error\":\"cant find txid to check spent status\"}")); |
|
|
|
} |
|
|
|
|
|
|
|
struct LP_utxoinfo *LP_utxoadd(int32_t iambob,int32_t mypubsock,char *symbol,bits256 txid,int32_t vout,int64_t value,bits256 txid2,int32_t vout2,int64_t value2,char *spendscript,char *coinaddr,bits256 pubkey,double profitmargin) |
|
|
|
struct LP_utxoinfo *LP_utxoadd(int32_t iambob,int32_t mypubsock,char *symbol,bits256 txid,int32_t vout,int64_t value,bits256 txid2,int32_t vout2,int64_t value2,char *spendscript,char *coinaddr,bits256 pubkey,double profitmargin,char *gui) |
|
|
|
{ |
|
|
|
uint64_t val,val2=0,tmpsatoshis,bigtxfee = 100000; int32_t spendvini,selector; bits256 spendtxid; char *msg; struct _LP_utxoinfo u; struct LP_utxoinfo *utxo = 0; |
|
|
|
if ( symbol == 0 || symbol[0] == 0 || spendscript == 0 || spendscript[0] == 0 || coinaddr == 0 || coinaddr[0] == 0 || bits256_nonz(txid) == 0 || bits256_nonz(txid2) == 0 || vout < 0 || vout2 < 0 || value <= 0 || value2 <= 0 ) |
|
|
@ -469,6 +471,7 @@ struct LP_utxoinfo *LP_utxoadd(int32_t iambob,int32_t mypubsock,char *symbol,bit |
|
|
|
utxo = calloc(1,sizeof(*utxo)); |
|
|
|
utxo->S.profitmargin = profitmargin; |
|
|
|
utxo->pubkey = pubkey; |
|
|
|
safecopy(utxo->gui,gui,sizeof(utxo->gui)); |
|
|
|
safecopy(utxo->coin,symbol,sizeof(utxo->coin)); |
|
|
|
safecopy(utxo->coinaddr,coinaddr,sizeof(utxo->coinaddr)); |
|
|
|
safecopy(utxo->spendscript,spendscript,sizeof(utxo->spendscript)); |
|
|
@ -517,7 +520,7 @@ struct LP_utxoinfo *LP_utxoaddjson(int32_t iambob,int32_t pubsock,cJSON *argjson |
|
|
|
return(0); |
|
|
|
} |
|
|
|
portable_mutex_lock(&LP_UTXOmutex); |
|
|
|
utxo = LP_utxoadd(iambob,pubsock,jstr(argjson,"coin"),jbits256(argjson,"txid"),jint(argjson,"vout"),j64bits(argjson,"value"),jbits256(argjson,"txid2"),jint(argjson,"vout2"),j64bits(argjson,"value2"),jstr(argjson,"script"),jstr(argjson,"address"),jbits256(argjson,"pubkey"),jdouble(argjson,"profit")); |
|
|
|
utxo = LP_utxoadd(iambob,pubsock,jstr(argjson,"coin"),jbits256(argjson,"txid"),jint(argjson,"vout"),j64bits(argjson,"value"),jbits256(argjson,"txid2"),jint(argjson,"vout2"),j64bits(argjson,"value2"),jstr(argjson,"script"),jstr(argjson,"address"),jbits256(argjson,"pubkey"),jdouble(argjson,"profit"),jstr(argjson,"gui")); |
|
|
|
portable_mutex_unlock(&LP_UTXOmutex); |
|
|
|
return(utxo); |
|
|
|
} |
|
|
@ -709,13 +712,13 @@ uint64_t LP_privkey_init(int32_t mypubsock,struct iguana_info *coin,bits256 mypr |
|
|
|
portable_mutex_lock(&LP_UTXOmutex); |
|
|
|
if ( iambob != 0 ) |
|
|
|
{ |
|
|
|
if ( (utxo= LP_utxoadd(1,mypubsock,coin->symbol,txid,vout,value,deposittxid,depositvout,depositval,script,coin->smartaddr,mypub,LP_mypeer != 0 ? LP_mypeer->profitmargin : 0.01)) != 0 ) |
|
|
|
if ( (utxo= LP_utxoadd(1,mypubsock,coin->symbol,txid,vout,value,deposittxid,depositvout,depositval,script,coin->smartaddr,mypub,LP_mypeer != 0 ? LP_mypeer->profitmargin : 0.01,LP_gui)) != 0 ) |
|
|
|
{ |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if ( (utxo= LP_utxoadd(0,mypubsock,coin->symbol,deposittxid,depositvout,depositval,txid,vout,value,script,coin->smartaddr,mypub,0.)) != 0 ) |
|
|
|
if ( (utxo= LP_utxoadd(0,mypubsock,coin->symbol,deposittxid,depositvout,depositval,txid,vout,value,script,coin->smartaddr,mypub,0.,LP_gui)) != 0 ) |
|
|
|
{ |
|
|
|
} |
|
|
|
} |
|
|
|