jl777 7 years ago
parent
commit
1443d6d6ac
  1. 6
      iguana/exchanges/LP_instantdex.c
  2. 4
      iguana/exchanges/LP_ordermatch.c
  3. 6
      iguana/exchanges/LP_transaction.c

6
iguana/exchanges/LP_instantdex.c

@ -508,12 +508,12 @@ int64_t LP_dynamictrust(int64_t credits,bits256 pubkey,int64_t kmdvalue)
return(0); return(0);
} }
int64_t LP_instantdex_proofcheck(char *coinaddr,cJSON *proof,int32_t num) int64_t LP_instantdex_proofcheck(char *symbol,char *coinaddr,cJSON *proof,int32_t num)
{ {
uint8_t rmd160[20],addrtype; int64_t credits=0; int32_t i,j; bits256 prevtxid,txid; char othersmartaddr[64]; struct iguana_info *coin; struct LP_address *ap = 0; uint8_t rmd160[20],addrtype; int64_t credits=0; int32_t i,j; bits256 prevtxid,txid; char othersmartaddr[64]; struct iguana_info *coin; struct LP_address *ap = 0;
if ( (coin= LP_coinfind("KMD")) != 0 ) if ( (coin= LP_coinfind("KMD")) != 0 )
{ {
bitcoin_addr2rmd160(coin->symbol,0,&addrtype,rmd160,coinaddr); bitcoin_addr2rmd160(symbol,0,&addrtype,rmd160,coinaddr);
bitcoin_address("KMD",othersmartaddr,0,60,rmd160,20); bitcoin_address("KMD",othersmartaddr,0,60,rmd160,20);
//printf("proofcheck addrtype.%d (%s) -> %s\n",addrtype,coinaddr,othersmartaddr); //printf("proofcheck addrtype.%d (%s) -> %s\n",addrtype,coinaddr,othersmartaddr);
if ((ap= LP_address(coin,othersmartaddr)) != 0 ) if ((ap= LP_address(coin,othersmartaddr)) != 0 )
@ -547,7 +547,7 @@ int64_t LP_myzcredits()
{ {
if ( (proof= LP_instantdex_txids(0,coin->smartaddr)) != 0 ) if ( (proof= LP_instantdex_txids(0,coin->smartaddr)) != 0 )
{ {
zcredits = LP_instantdex_proofcheck(coin->smartaddr,proof,cJSON_GetArraySize(proof)); zcredits = LP_instantdex_proofcheck(coin->symbol,coin->smartaddr,proof,cJSON_GetArraySize(proof));
free_json(proof); free_json(proof);
return(zcredits); return(zcredits);
} }

4
iguana/exchanges/LP_ordermatch.c

@ -1211,7 +1211,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
{ {
//printf("CONNECTED.(%s)\n",jprint(argjson,0)); //printf("CONNECTED.(%s)\n",jprint(argjson,0));
if ( (proof= jarray(&num,argjson,"proof")) != 0 && num > 0 ) if ( (proof= jarray(&num,argjson,"proof")) != 0 && num > 0 )
Q.othercredits = LP_instantdex_proofcheck(Q.coinaddr,proof,num); Q.othercredits = LP_instantdex_proofcheck(Q.srccoin,Q.coinaddr,proof,num);
if ( Qtrades == 0 ) if ( Qtrades == 0 )
LP_trades_gotconnected(ctx,&Q,&Q2,jstr(argjson,"pair")); LP_trades_gotconnected(ctx,&Q,&Q2,jstr(argjson,"pair"));
else LP_tradecommandQ(&Q,jstr(argjson,"pair"),LP_CONNECTED); else LP_tradecommandQ(&Q,jstr(argjson,"pair"),LP_CONNECTED);
@ -1249,7 +1249,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
{ {
printf("CONNECT.(%s)\n",jprint(argjson,0)); printf("CONNECT.(%s)\n",jprint(argjson,0));
if ( (proof= jarray(&num,argjson,"proof")) != 0 && num > 0 ) if ( (proof= jarray(&num,argjson,"proof")) != 0 && num > 0 )
Q.othercredits = LP_instantdex_proofcheck(Q.destaddr,proof,num); Q.othercredits = LP_instantdex_proofcheck(Q.destcoin,Q.destaddr,proof,num);
if ( Qtrades == 0 ) if ( Qtrades == 0 )
LP_trades_gotconnect(ctx,&Q,&Q2,jstr(argjson,"pair")); LP_trades_gotconnect(ctx,&Q,&Q2,jstr(argjson,"pair"));
else LP_tradecommandQ(&Q,jstr(argjson,"pair"),LP_CONNECT); else LP_tradecommandQ(&Q,jstr(argjson,"pair"),LP_CONNECT);

6
iguana/exchanges/LP_transaction.c

@ -850,7 +850,6 @@ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,ch
jaddbits256(item,"txid",utxotxid); jaddbits256(item,"txid",utxotxid);
jaddnum(item,"vout",utxovout); jaddnum(item,"vout",utxovout);
bitcoin_address(symbol,tmpaddr,taddr,pubtype,pubkey33,33); bitcoin_address(symbol,tmpaddr,taddr,pubtype,pubkey33,33);
printf("%s tmpaddr.%s\n",symbol,tmpaddr);
bitcoin_addr2rmd160(symbol,taddr,&addrtype,rmd160,tmpaddr); bitcoin_addr2rmd160(symbol,taddr,&addrtype,rmd160,tmpaddr);
if ( redeemlen != 0 ) if ( redeemlen != 0 )
{ {
@ -859,7 +858,7 @@ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,ch
if ( vinaddr != 0 ) if ( vinaddr != 0 )
bitcoin_addr2rmd160(symbol,taddr,&addrtype,rmd160,vinaddr); bitcoin_addr2rmd160(symbol,taddr,&addrtype,rmd160,vinaddr);
spendlen = bitcoin_p2shspend(spendscript,0,rmd160); spendlen = bitcoin_p2shspend(spendscript,0,rmd160);
printf("P2SH path.%s\n",vinaddr!=0?vinaddr:0); //printf("P2SH path.%s\n",vinaddr!=0?vinaddr:0);
} else spendlen = bitcoin_standardspend(spendscript,0,rmd160); } else spendlen = bitcoin_standardspend(spendscript,0,rmd160);
init_hexbytes_noT(hexstr,spendscript,spendlen); init_hexbytes_noT(hexstr,spendscript,spendlen);
jaddstr(item,"scriptPubKey",hexstr); jaddstr(item,"scriptPubKey",hexstr);
@ -868,7 +867,6 @@ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,ch
jaddi(vins,item); jaddi(vins,item);
jdelete(txobj,"vin"); jdelete(txobj,"vin");
jadd(txobj,"vin",vins); jadd(txobj,"vin",vins);
printf("destaddrs %s\n",symbol);
if ( destaddr == 0 ) if ( destaddr == 0 )
{ {
destaddr = _destaddr; destaddr = _destaddr;
@ -892,14 +890,12 @@ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,ch
changelen = bitcoin_standardspend(changescript,0,changermd160); changelen = bitcoin_standardspend(changescript,0,changermd160);
txobj = bitcoin_txoutput(txobj,changescript,changelen,change); txobj = bitcoin_txoutput(txobj,changescript,changelen,change);
} }
printf("bitcoin_json2hex %s\n",symbol);
if ( (rawtxbytes= bitcoin_json2hex(symbol,isPoS,&txid,txobj,V)) != 0 ) if ( (rawtxbytes= bitcoin_json2hex(symbol,isPoS,&txid,txobj,V)) != 0 )
{ {
char str[65]; char str[65];
completed = 0; completed = 0;
memset(signedtxidp,0,sizeof(*signedtxidp)); memset(signedtxidp,0,sizeof(*signedtxidp));
//printf("locktime.%u sequenceid.%x rawtx.(%s) vins.(%s)\n",locktime,sequenceid,rawtxbytes,jprint(vins,0)); //printf("locktime.%u sequenceid.%x rawtx.(%s) vins.(%s)\n",locktime,sequenceid,rawtxbytes,jprint(vins,0));
printf("iguana_signrawtransaction %s\n",symbol);
if ( (completed= iguana_signrawtransaction(ctx,symbol,wiftaddr,taddr,pubtype,p2shtype,isPoS,1000000,&msgtx,&signedtx,signedtxidp,V,1,rawtxbytes,vins,privkeys,zcash)) < 0 ) if ( (completed= iguana_signrawtransaction(ctx,symbol,wiftaddr,taddr,pubtype,p2shtype,isPoS,1000000,&msgtx,&signedtx,signedtxidp,V,1,rawtxbytes,vins,privkeys,zcash)) < 0 )
//if ( (signedtx= LP_signrawtx(symbol,signedtxidp,&completed,vins,rawtxbytes,privkeys,V)) == 0 ) //if ( (signedtx= LP_signrawtx(symbol,signedtxidp,&completed,vins,rawtxbytes,privkeys,V)) == 0 )
printf("couldnt sign transaction.%s %s\n",name,bits256_str(str,*signedtxidp)); printf("couldnt sign transaction.%s %s\n",name,bits256_str(str,*signedtxidp));

Loading…
Cancel
Save