Remove unused code
This commit is contained in:
@@ -612,7 +612,6 @@ extern int32_t HUSH_PAX;
|
||||
int32_t hush_is_issuer();
|
||||
int32_t dragon_rwnum(int32_t rwflag,uint8_t *serialized,int32_t len,void *endianedp);
|
||||
int32_t hush_isrealtime(int32_t *hushheightp);
|
||||
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 hush_kvsearch(uint256 *refpubkeyp,int32_t current_height,uint32_t *flagsp,int32_t *heightp,uint8_t value[DRAGON_MAXSCRIPTSIZE],uint8_t *key,int32_t keylen);
|
||||
int32_t hush_kvcmp(uint8_t *refvalue,uint16_t refvaluesize,uint8_t *value,uint16_t valuesize);
|
||||
uint64_t hush_kvfee(uint32_t flags,int32_t opretlen,int32_t keylen);
|
||||
@@ -763,86 +762,6 @@ UniValue kvupdate(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
return ret;
|
||||
}
|
||||
|
||||
UniValue paxdeposit(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
{
|
||||
uint64_t available,deposited,issued,withdrawn,approved,redeemed,seed,puposhis = 0; int32_t height; char destaddr[64]; uint8_t i,pubkey37[33];
|
||||
bool fSubtractFeeFromAmount = false;
|
||||
if ( HUSH_PAX == 0 )
|
||||
{
|
||||
throw runtime_error("paxdeposit disabled without -pax");
|
||||
}
|
||||
if ( hush_is_issuer() != 0 )
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "paxdeposit only from KYC");
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
throw runtime_error("paxdeposit needs wallet"); //return Value::null;
|
||||
if (fHelp || params.size() != 3)
|
||||
throw runtime_error("paxdeposit address fiatoshis base");
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
CBitcoinAddress address(params[0].get_str());
|
||||
if (!address.IsValid())
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
|
||||
int64_t fiatoshis = atof(params[1].get_str().c_str()) * COIN;
|
||||
std::string base = params[2].get_str();
|
||||
std::string dest;
|
||||
height = chainActive.LastTip()->GetHeight();
|
||||
if ( pax_fiatstatus(&available,&deposited,&issued,&withdrawn,&approved,&redeemed,(char *)base.c_str()) != 0 || available < fiatoshis )
|
||||
{
|
||||
fprintf(stderr,"available %llu vs fiatoshis %llu\n",(long long)available,(long long)fiatoshis);
|
||||
throw runtime_error("paxdeposit not enough available inventory");
|
||||
}
|
||||
puposhis = PAX_fiatdest(&seed,0,destaddr,pubkey37,(char *)params[0].get_str().c_str(),height,(char *)base.c_str(),fiatoshis);
|
||||
dest.append(destaddr);
|
||||
CBitcoinAddress destaddress(CRYPTO555_HUSHADDR);
|
||||
if (!destaddress.IsValid())
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid dest Bitcoin address");
|
||||
for (i=0; i<33; i++)
|
||||
fprintf(stderr,"%02x",pubkey37[i]);
|
||||
fprintf(stderr," ht.%d srcaddr.(%s) %s fiatoshis.%lld -> dest.(%s) puposhis.%llu seed.%llx\n",height,(char *)params[0].get_str().c_str(),(char *)base.c_str(),(long long)fiatoshis,destaddr,(long long)puposhis,(long long)seed);
|
||||
EnsureWalletIsUnlocked();
|
||||
CWalletTx wtx;
|
||||
uint8_t opretbuf[64]; int32_t opretlen; uint64_t fee = puposhis / 1000;
|
||||
if ( fee < 10000 )
|
||||
fee = 10000;
|
||||
dragon_rwnum(1,&pubkey37[33],sizeof(height),&height);
|
||||
opretlen = hush_opreturnscript(opretbuf,'D',pubkey37,37);
|
||||
SendMoney(address.Get(),fee,fSubtractFeeFromAmount,wtx,opretbuf,opretlen,puposhis);
|
||||
return wtx.GetHash().GetHex();
|
||||
}
|
||||
|
||||
UniValue paxwithdraw(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
{
|
||||
CWalletTx wtx; std::string dest; int32_t hushheight; uint64_t seed,puposhis = 0; char destaddr[64]; uint8_t i,pubkey37[37]; bool fSubtractFeeFromAmount = false;
|
||||
if ( SMART_CHAIN_SYMBOL[0] == 0 )
|
||||
return(0);
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return 0;
|
||||
throw runtime_error("paxwithdraw deprecated");
|
||||
if (fHelp || params.size() != 2)
|
||||
throw runtime_error("paxwithdraw address fiatamount");
|
||||
if ( hush_isrealtime(&hushheight) == 0 )
|
||||
return(0);
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
CBitcoinAddress address(params[0].get_str());
|
||||
if (!address.IsValid())
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
|
||||
int64_t fiatoshis = atof(params[1].get_str().c_str()) * COIN;
|
||||
puposhis = PAX_fiatdest(&seed,1,destaddr,pubkey37,(char *)params[0].get_str().c_str(),hushheight,SMART_CHAIN_SYMBOL,fiatoshis);
|
||||
dest.append(destaddr);
|
||||
CBitcoinAddress destaddress(CRYPTO555_HUSHADDR);
|
||||
if (!destaddress.IsValid())
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid dest Bitcoin address");
|
||||
for (i=0; i<33; i++)
|
||||
printf("%02x",pubkey37[i]);
|
||||
printf(" hushheight.%d srcaddr.(%s) %s fiatoshis.%lld -> dest.(%s) puposhis.%llu seed.%llx\n",hushheight,(char *)params[0].get_str().c_str(),SMART_CHAIN_SYMBOL,(long long)fiatoshis,destaddr,(long long)puposhis,(long long)seed);
|
||||
EnsureWalletIsUnlocked();
|
||||
uint8_t opretbuf[64]; int32_t opretlen; uint64_t fee = fiatoshis / 1000;
|
||||
if ( fee < 10000 )
|
||||
fee = 10000;
|
||||
dragon_rwnum(1,&pubkey37[33],sizeof(hushheight),&hushheight);
|
||||
opretlen = hush_opreturnscript(opretbuf,'W',pubkey37,37);
|
||||
SendMoney(destaddress.Get(),fee,fSubtractFeeFromAmount,wtx,opretbuf,opretlen,fiatoshis);
|
||||
return wtx.GetHash().GetHex();
|
||||
}
|
||||
|
||||
UniValue listaddressgroupings(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user