|
@ -254,14 +254,17 @@ cJSON *LP_gettxout(char *symbol,char *coinaddr,bits256 txid,int32_t vout) |
|
|
return(cJSON_Parse("{\"error\":\"no coin\"}")); |
|
|
return(cJSON_Parse("{\"error\":\"no coin\"}")); |
|
|
if ( bits256_nonz(txid) == 0 ) |
|
|
if ( bits256_nonz(txid) == 0 ) |
|
|
return(cJSON_Parse("{\"error\":\"null txid\"}")); |
|
|
return(cJSON_Parse("{\"error\":\"null txid\"}")); |
|
|
if ( (tx= LP_transactionfind(coin,txid)) != 0 && vout < tx->numvouts ) |
|
|
|
|
|
{ |
|
|
|
|
|
if ( tx->outpoints[vout].spendheight > 0 ) |
|
|
|
|
|
return(0); |
|
|
|
|
|
//return(LP_gettxout_json(txid,vout,tx->height,tx->outpoints[vout].coinaddr,tx->outpoints[vout].value));
|
|
|
|
|
|
} |
|
|
|
|
|
if ( coin->electrum == 0 ) |
|
|
if ( coin->electrum == 0 ) |
|
|
{ |
|
|
{ |
|
|
|
|
|
if ( (tx= LP_transactionfind(coin,txid)) != 0 && vout < tx->numvouts ) |
|
|
|
|
|
{ |
|
|
|
|
|
if ( tx->outpoints[vout].spendheight > 0 ) |
|
|
|
|
|
{ |
|
|
|
|
|
//fprintf(stderr,"LP_gettxout (%s) tx->outpoints[vout].spendheight > 0\n",coinaddr);
|
|
|
|
|
|
return(0); |
|
|
|
|
|
} |
|
|
|
|
|
//return(LP_gettxout_json(txid,vout,tx->height,tx->outpoints[vout].coinaddr,tx->outpoints[vout].value));
|
|
|
|
|
|
} |
|
|
sprintf(buf,"[\"%s\", %d, true]",bits256_str(str,txid),vout); |
|
|
sprintf(buf,"[\"%s\", %d, true]",bits256_str(str,txid),vout); |
|
|
return(bitcoin_json(coin,"gettxout",buf)); |
|
|
return(bitcoin_json(coin,"gettxout",buf)); |
|
|
} |
|
|
} |
|
@ -281,7 +284,10 @@ cJSON *LP_gettxout(char *symbol,char *coinaddr,bits256 txid,int32_t vout) |
|
|
if ( (up= LP_address_utxofind(coin,coinaddr,txid,vout)) != 0 ) |
|
|
if ( (up= LP_address_utxofind(coin,coinaddr,txid,vout)) != 0 ) |
|
|
{ |
|
|
{ |
|
|
if ( up->spendheight > 0 ) |
|
|
if ( up->spendheight > 0 ) |
|
|
|
|
|
{ |
|
|
|
|
|
//fprintf(stderr,"LP_gettxout (%s) up->spendheight > 0\n",coinaddr);
|
|
|
return(0); |
|
|
return(0); |
|
|
|
|
|
} |
|
|
//return(LP_gettxout_json(txid,vout,up->U.height,coinaddr,up->U.value));
|
|
|
//return(LP_gettxout_json(txid,vout,up->U.height,coinaddr,up->U.value));
|
|
|
} |
|
|
} |
|
|
memset(zero.bytes,0,sizeof(zero)); |
|
|
memset(zero.bytes,0,sizeof(zero)); |
|
@ -1145,7 +1151,7 @@ int32_t LP_txhasnotarization(bits256 *notarizedhashp,struct iguana_info *coin,bi |
|
|
{ |
|
|
{ |
|
|
cJSON *txobj,*vins,*vin,*vouts,*vout,*spentobj,*sobj; char *hexstr; uint8_t script[1024]; bits256 spenttxid; uint64_t notarymask; int32_t i,j,numnotaries,len,spentvout,numvins,numvouts,hasnotarization = 0; |
|
|
cJSON *txobj,*vins,*vin,*vouts,*vout,*spentobj,*sobj; char *hexstr; uint8_t script[1024]; bits256 spenttxid; uint64_t notarymask; int32_t i,j,numnotaries,len,spentvout,numvins,numvouts,hasnotarization = 0; |
|
|
memset(notarizedhashp,0,sizeof(*notarizedhashp)); |
|
|
memset(notarizedhashp,0,sizeof(*notarizedhashp)); |
|
|
if ( (txobj= LP_gettx("LP_txhasnotarization",coin->symbol,txid,0)) != 0 ) |
|
|
if ( (txobj= LP_gettx("LP_txhasnotarization",coin->symbol,txid,1)) != 0 ) |
|
|
{ |
|
|
{ |
|
|
if ( (vins= jarray(&numvins,txobj,"vin")) != 0 ) |
|
|
if ( (vins= jarray(&numvins,txobj,"vin")) != 0 ) |
|
|
{ |
|
|
{ |
|
@ -1157,7 +1163,7 @@ int32_t LP_txhasnotarization(bits256 *notarizedhashp,struct iguana_info *coin,bi |
|
|
vin = jitem(vins,i); |
|
|
vin = jitem(vins,i); |
|
|
spenttxid = jbits256(vin,"txid"); |
|
|
spenttxid = jbits256(vin,"txid"); |
|
|
spentvout = jint(vin,"vout"); |
|
|
spentvout = jint(vin,"vout"); |
|
|
if ( (spentobj= LP_gettx("LP_txhasnotarization",coin->symbol,spenttxid,0)) != 0 ) |
|
|
if ( (spentobj= LP_gettx("LP_txhasnotarization",coin->symbol,spenttxid,1)) != 0 ) |
|
|
{ |
|
|
{ |
|
|
if ( (vouts= jarray(&numvouts,spentobj,"vout")) != 0 ) |
|
|
if ( (vouts= jarray(&numvouts,spentobj,"vout")) != 0 ) |
|
|
{ |
|
|
{ |
|
|