Remove unused code

This commit is contained in:
Duke
2023-06-17 21:22:41 -04:00
parent 8f7e53a6fe
commit 31cc5ee901
4 changed files with 2 additions and 356 deletions

View File

@@ -18,40 +18,9 @@
// paxdeposit equivalent in reverse makes opreturn and HUSH does the same in reverse
#include "hush_defs.h"
/*#include "secp256k1/include/secp256k1.h"
#include "secp256k1/include/secp256k1_schnorrsig.h"
#include "secp256k1/include/secp256k1_musig.h"
int32_t dummy_linker_tricker()
{
secp256k1_context *ctx = 0; std::vector<uint8_t> musig64; CPubKey pk; secp256k1_schnorrsig musig; secp256k1_pubkey combined_pk;
if ( secp256k1_schnorrsig_parse((const secp256k1_context *)ctx,&musig,(const uint8_t *)&musig64[0]) > 0 && secp256k1_ec_pubkey_parse(ctx,&combined_pk,pk.begin(),33) > 0 )
return(1);
}*/
int32_t pax_fiatstatus(uint64_t *available,uint64_t *deposited,uint64_t *issued,uint64_t *withdrawn,uint64_t *approved,uint64_t *redeemed,char *base)
{
int32_t baseid; struct hush_state *sp; int64_t netliability,maxallowed,maxval;
*available = *deposited = *issued = *withdrawn = *approved = *redeemed = 0;
if ( (baseid= hush_baseid(base)) >= 0 )
{
if ( (sp= hush_stateptrget(base)) != 0 )
{
*deposited = sp->deposited;
*issued = sp->issued;
*withdrawn = sp->withdrawn;
*approved = sp->approved;
*redeemed = sp->redeemed;
maxval = sp->approved;
if ( sp->withdrawn > maxval )
maxval = sp->withdrawn;
netliability = (sp->issued - maxval) - sp->shorted;
maxallowed = hush_maxallowed(baseid);
if ( netliability < maxallowed )
*available = (maxallowed - netliability);
//printf("%llu - %llu %s %.8f %.8f %.8f %.8f %.8f\n",(long long)maxallowed,(long long)netliability,base,dstr(*deposited),dstr(*issued),dstr(*withdrawn),dstr(*approved),dstr(*redeemed));
return(0);
} else printf("pax_fiatstatus cant get basesp.%s\n",base);
} // else printf("pax_fiatstatus illegal base.%s\n",base);
return(-1);
}
@@ -210,71 +179,7 @@ int32_t hush_rwapproval(int32_t rwflag,uint8_t *opretbuf,struct pax_transaction
int32_t hush_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t *values,int64_t *srcvalues,int32_t *hushheights,int32_t *otherheights,int8_t *baseids,uint8_t *rmd160s,uint8_t *opretbuf,int32_t opretlen,int32_t iskomodo)
{
struct pax_transaction p,*pax; int32_t i,n=0,j,len=0,incr,height,otherheight; uint8_t type,rmd160[20]; uint64_t fiatoshis; char symbol[HUSH_SMART_CHAIN_MAXLEN];
//if ( HUSH_PAX == 0 )
// return(0);
incr = 34 + (iskomodo * (2*sizeof(fiatoshis) + 2*sizeof(height) + 20 + 4));
//41e77b91cb68dc2aa02fa88550eae6b6d44db676a7e935337b6d1392d9718f03cb0200305c90660400000000fbcbeb1f000000bde801006201000058e7945ad08ddba1eac9c9b6c8e1e97e8016a2d152
// 41e94d736ec69d88c08b5d238abeeca609c02357a8317e0d56c328bcb1c259be5d0200485bc80200000000404b4c000000000059470200b80b000061f22ba7d19fe29ac3baebd839af8b7127d1f9075553440046bb4cc7a3b5cd39dffe7206507a3482a00780e617f68b273cce9817ed69298d02001069ca1b0000000080f0fa02000000005b470200b90b000061f22ba7d19fe29ac3baebd839af8b7127d1f90755
//for (i=0; i<opretlen; i++)
// printf("%02x",opretbuf[i]);
//printf(" opretlen.%d (%s)\n",opretlen,base);
//printf(" opretlen.%d vs %d incr.%d (%d)\n",opretlen,(int32_t)(2*sizeof(fiatoshis) + 2*sizeof(height) + 20 + 2),incr,opretlen/incr);
//if ( SMART_CHAIN_SYMBOL[0] == 0 || strncmp(SMART_CHAIN_SYMBOL,base,strlen(base)) == 0 )
{
type = opretbuf[0];
opretbuf++, opretlen--;
for (n=0; n<opretlen/incr; n++)
{
if ( iskomodo != 0 )
{
memset(&p,0,sizeof(p));
len += hush_rwapproval(0,&opretbuf[len],&p);
if ( values != 0 && srcvalues != 0 && hushheights != 0 && otherheights != 0 && baseids != 0 && rmd160s != 0 )
{
txids[n] = p.txid;
vouts[n] = p.vout;
values[n] = (strcmp("HUSH3",base) == 0) ? p.puposhis : p.fiatoshis;
srcvalues[n] = (strcmp("HUSH3",base) == 0) ? p.fiatoshis : p.puposhis;
hushheights[n] = p.height;
otherheights[n] = p.otherheight;
memcpy(&rmd160s[n * 20],p.rmd160,20);
baseids[n] = hush_baseid(p.source);
if ( 0 )
{
char coinaddr[64];
bitcoin_address(coinaddr,60,&rmd160s[n * 20],20);
printf(">>>>>>> %s: (%s) fiat %.8f hushheight.%d other.%d -> %s %.8f\n",type=='A'?"approvedA":"issuedX",baseids[n]>=0?CURRENCIES[baseids[n]]:"???",dstr(p.fiatoshis),hushheights[n],otherheights[n],coinaddr,dstr(values[n]));
}
}
}
else
{
for (i=0; i<4; i++)
base[i] = opretbuf[opretlen-4+i];
for (j=0; j<32; j++)
{
((uint8_t *)&txids[n])[j] = opretbuf[len++];
//printf("%02x",((uint8_t *)&txids[n])[j]);
}
vouts[n] = opretbuf[len++];
vouts[n] = (opretbuf[len++] << 8) | vouts[n];
baseids[n] = hush_baseid(base);
if ( (pax= hush_paxfinds(txids[n],vouts[n])) != 0 )
{
values[n] = (strcmp("HUSH3",base) == 0) ? pax->puposhis : pax->fiatoshis;
srcvalues[n] = (strcmp("HUSH3",base) == 0) ? pax->fiatoshis : pax->puposhis;
hushheights[n] = pax->height;
otherheights[n] = pax->otherheight;
memcpy(&rmd160s[n * 20],pax->rmd160,20);
}
}
//printf(" hush_issued_opreturn issuedtxid v%d i.%d opretlen.%d\n",vouts[n],n,opretlen);
}
}
return(n);
return 0;
}
int32_t hush_paxcmp(char *symbol,int32_t hushheight,uint64_t value,uint64_t checkvalue,uint64_t seed)