Remove -exchange option which jl777 used to steal from KMD miners and notary node ops

This commit is contained in:
Duke Leto
2020-12-04 19:31:03 -05:00
parent d1ed93a703
commit 6c70956f4f
4 changed files with 20 additions and 57 deletions

View File

@@ -527,7 +527,6 @@ extern uint8_t ASSETCHAINS_CCDISABLES[256];
extern int32_t USE_EXTERNAL_PUBKEY; extern int32_t USE_EXTERNAL_PUBKEY;
extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS;
extern int32_t KOMODO_EXCHANGEWALLET;
extern std::string DONATION_PUBKEY; extern std::string DONATION_PUBKEY;
extern uint8_t ASSETCHAINS_PRIVATE; extern uint8_t ASSETCHAINS_PRIVATE;
extern int32_t USE_EXTERNAL_PUBKEY; extern int32_t USE_EXTERNAL_PUBKEY;

View File

@@ -50,7 +50,7 @@ int COINBASE_MATURITY = _COINBASE_MATURITY;//100;
unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+10; unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+10;
uint256 KOMODO_EARLYTXID; uint256 KOMODO_EARLYTXID;
int32_t KOMODO_MININGTHREADS = -1,IS_HUSH_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,HUSH_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1,KOMODO_DEALERNODE,KOMODO_EXTRASATOSHI,ASSETCHAINS_FOUNDERS,ASSETCHAINS_CBMATURITY,KOMODO_NSPV; int32_t KOMODO_MININGTHREADS = -1,IS_HUSH_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,HUSH_PASSPORT_INITDONE,KOMODO_PAX,HUSH_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1,KOMODO_DEALERNODE,KOMODO_EXTRASATOSHI,ASSETCHAINS_FOUNDERS,ASSETCHAINS_CBMATURITY,KOMODO_NSPV;
int32_t HUSH_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1; int32_t HUSH_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1;
std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY,ASSETCHAINS_SCRIPTPUB,NOTARY_ADDRESS,ASSETCHAINS_SELFIMPORT,ASSETCHAINS_CCLIB; std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY,ASSETCHAINS_SCRIPTPUB,NOTARY_ADDRESS,ASSETCHAINS_SELFIMPORT,ASSETCHAINS_CCLIB;
uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEYHASH[20],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW,ASSETCHAINS_MARMARA; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEYHASH[20],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW,ASSETCHAINS_MARMARA;

View File

@@ -1779,12 +1779,16 @@ void hush_args(char *argv0)
{ {
KOMODO_MININGTHREADS = GetArg("-genproclimit",-1); KOMODO_MININGTHREADS = GetArg("-genproclimit",-1);
} }
if ( (KOMODO_EXCHANGEWALLET= GetBoolArg("-exchange", false)) != 0 ) if ( (GetBoolArg("-exchange", false)) != 0 ) {
fprintf(stderr,"KOMODO_EXCHANGEWALLET mode active\n"); printf("The KMD-only feature -exchange is not supported by HUSH!\n");
DONATION_PUBKEY = GetArg("-donation", ""); printf("jl777 uses this \"feature\" to steal from his own users!\n");
NOTARY_PUBKEY = GetArg("-pubkey", ""); printf("Learn more at https://duke.hush.is :)\n");
StartShutdown();
}
DONATION_PUBKEY = GetArg("-donation", "");
NOTARY_PUBKEY = GetArg("-pubkey", "");
KOMODO_DEALERNODE = GetArg("-dealer",0); KOMODO_DEALERNODE = GetArg("-dealer",0);
KOMODO_TESTNODE = GetArg("-testnode",0); KOMODO_TESTNODE = GetArg("-testnode",0);
if ( strlen(NOTARY_PUBKEY.c_str()) == 66 ) if ( strlen(NOTARY_PUBKEY.c_str()) == 66 )
{ {
decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str());

View File

@@ -3242,8 +3242,7 @@ void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const
!IsLockedCoin((*it).first, i) && (pcoin->vout[i].nValue > 0 || fIncludeZeroValue) && !IsLockedCoin((*it).first, i) && (pcoin->vout[i].nValue > 0 || fIncludeZeroValue) &&
(!coinControl || !coinControl->HasSelected() || coinControl->IsSelected((*it).first, i))) (!coinControl || !coinControl->HasSelected() || coinControl->IsSelected((*it).first, i)))
{ {
if ( KOMODO_EXCHANGEWALLET == 0 ) if ( 1 ) {
{
uint32_t locktime; int32_t txheight; CBlockIndex *tipindex; uint32_t locktime; int32_t txheight; CBlockIndex *tipindex;
if ( SMART_CHAIN_SYMBOL[0] == 0 && chainActive.LastTip() != 0 && chainActive.LastTip()->GetHeight() >= 60000 ) if ( SMART_CHAIN_SYMBOL[0] == 0 && chainActive.LastTip() != 0 && chainActive.LastTip()->GetHeight() >= 60000 )
{ {
@@ -3257,28 +3256,18 @@ void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const
//interest = komodo_interestnew(chainActive.LastTip()->GetHeight()+1,pcoin->vout[i].nValue,pcoin->nLockTime,chainActive.LastTip()->nTime); //interest = komodo_interestnew(chainActive.LastTip()->GetHeight()+1,pcoin->vout[i].nValue,pcoin->nLockTime,chainActive.LastTip()->nTime);
if ( interest != 0 ) if ( interest != 0 )
{ {
//printf("wallet nValueRet %.8f += interest %.8f ht.%d lock.%u/%u tip.%u\n",(double)pcoin->vout[i].nValue/COIN,(double)interest/COIN,txheight,locktime,pcoin->nLockTime,tipindex->nTime);
//fprintf(stderr,"wallet nValueRet %.8f += interest %.8f ht.%d lock.%u tip.%u\n",(double)pcoin->vout[i].nValue/COIN,(double)interest/COIN,chainActive.LastTip()->GetHeight()+1,pcoin->nLockTime,chainActive.LastTip()->nTime);
//ptr = (uint64_t *)&pcoin->vout[i].nValue;
//(*ptr) += interest;
ptr = (uint64_t *)&pcoin->vout[i].interest; ptr = (uint64_t *)&pcoin->vout[i].interest;
(*ptr) = interest; (*ptr) = interest;
//pcoin->vout[i].nValue += interest; //pcoin->vout[i].nValue += interest;
} } else {
else
{
ptr = (uint64_t *)&pcoin->vout[i].interest; ptr = (uint64_t *)&pcoin->vout[i].interest;
(*ptr) = 0; (*ptr) = 0;
} }
} } else {
else
{
ptr = (uint64_t *)&pcoin->vout[i].interest; ptr = (uint64_t *)&pcoin->vout[i].interest;
(*ptr) = 0; (*ptr) = 0;
} }
} } else {
else
{
ptr = (uint64_t *)&pcoin->vout[i].interest; ptr = (uint64_t *)&pcoin->vout[i].interest;
(*ptr) = 0; (*ptr) = 0;
} }
@@ -3369,30 +3358,20 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
{ {
setCoinsRet.insert(coin.second); setCoinsRet.insert(coin.second);
nValueRet += coin.first; nValueRet += coin.first;
//if ( KOMODO_EXCHANGEWALLET == 0 )
// *interestp += pcoin->vout[i].interest;
return true; return true;
} }
else if (n < nTargetValue + CENT) else if (n < nTargetValue + CENT)
{ {
vValue.push_back(coin); vValue.push_back(coin);
nTotalLower += n; nTotalLower += n;
//if ( KOMODO_EXCHANGEWALLET == 0 && count < sizeof(interests)/sizeof(*interests) )
//{
//fprintf(stderr,"count.%d %.8f\n",count,(double)pcoin->vout[i].interest/COIN);
//interests[count++] = pcoin->vout[i].interest;
//}
if ( nTotalLower > 4*nTargetValue + CENT ) if ( nTotalLower > 4*nTargetValue + CENT )
{ {
//fprintf(stderr,"why bother with all the utxo if we have double what is needed?\n"); //fprintf(stderr,"why bother with all the utxo if we have double what is needed?\n");
break; break;
} }
} } else if (n < coinLowestLarger.first)
else if (n < coinLowestLarger.first)
{ {
coinLowestLarger = coin; coinLowestLarger = coin;
//if ( KOMODO_EXCHANGEWALLET == 0 )
// lowest_interest = pcoin->vout[i].interest;
} }
} }
@@ -3402,8 +3381,6 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
{ {
setCoinsRet.insert(vValue[i].second); setCoinsRet.insert(vValue[i].second);
nValueRet += vValue[i].first; nValueRet += vValue[i].first;
//if ( KOMODO_EXCHANGEWALLET == 0 && i < count )
// *interestp += interests[i];
} }
return true; return true;
} }
@@ -3414,8 +3391,6 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
return false; return false;
setCoinsRet.insert(coinLowestLarger.second); setCoinsRet.insert(coinLowestLarger.second);
nValueRet += coinLowestLarger.first; nValueRet += coinLowestLarger.first;
//if ( KOMODO_EXCHANGEWALLET == 0 )
// *interestp += lowest_interest;
return true; return true;
} }
@@ -3435,17 +3410,12 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
{ {
setCoinsRet.insert(coinLowestLarger.second); setCoinsRet.insert(coinLowestLarger.second);
nValueRet += coinLowestLarger.first; nValueRet += coinLowestLarger.first;
//if ( KOMODO_EXCHANGEWALLET == 0 ) } else {
// *interestp += lowest_interest;
}
else {
for (unsigned int i = 0; i < vValue.size(); i++) for (unsigned int i = 0; i < vValue.size(); i++)
if (vfBest[i]) if (vfBest[i])
{ {
setCoinsRet.insert(vValue[i].second); setCoinsRet.insert(vValue[i].second);
nValueRet += vValue[i].first; nValueRet += vValue[i].first;
//if ( KOMODO_EXCHANGEWALLET == 0 && i < count )
// *interestp += interests[i];
} }
LogPrint("selectcoins", "SelectCoins() best subset: "); LogPrint("selectcoins", "SelectCoins() best subset: ");
@@ -3484,8 +3454,7 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
continue; continue;
} }
value += out.tx->vout[out.i].nValue; value += out.tx->vout[out.i].nValue;
if ( KOMODO_EXCHANGEWALLET == 0 ) value += out.tx->vout[out.i].interest;
value += out.tx->vout[out.i].interest;
} }
if (value <= nTargetValue) { if (value <= nTargetValue) {
CAmount valueWithCoinbase = 0; CAmount valueWithCoinbase = 0;
@@ -3494,8 +3463,7 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
continue; continue;
} }
valueWithCoinbase += out.tx->vout[out.i].nValue; valueWithCoinbase += out.tx->vout[out.i].nValue;
if ( KOMODO_EXCHANGEWALLET == 0 ) valueWithCoinbase += out.tx->vout[out.i].interest;
valueWithCoinbase += out.tx->vout[out.i].interest;
} }
fNeedCoinbaseCoinsRet = (valueWithCoinbase >= nTargetValue); fNeedCoinbaseCoinsRet = (valueWithCoinbase >= nTargetValue);
} }
@@ -3508,8 +3476,6 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
if (!out.fSpendable) if (!out.fSpendable)
continue; continue;
nValueRet += out.tx->vout[out.i].nValue; nValueRet += out.tx->vout[out.i].nValue;
//if ( KOMODO_EXCHANGEWALLET == 0 )
// *interestp += out.tx->vout[out.i].interest;
setCoinsRet.insert(make_pair(out.tx, out.i)); setCoinsRet.insert(make_pair(out.tx, out.i));
} }
return (nValueRet >= nTargetValue); return (nValueRet >= nTargetValue);
@@ -3531,8 +3497,7 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
if (pcoin->vout.size() <= outpoint.n) if (pcoin->vout.size() <= outpoint.n)
return false; return false;
nValueFromPresetInputs += pcoin->vout[outpoint.n].nValue; nValueFromPresetInputs += pcoin->vout[outpoint.n].nValue;
if ( KOMODO_EXCHANGEWALLET == 0 ) nValueFromPresetInputs += pcoin->vout[outpoint.n].interest;
nValueFromPresetInputs += pcoin->vout[outpoint.n].interest;
setPresetCoins.insert(make_pair(pcoin, outpoint.n)); setPresetCoins.insert(make_pair(pcoin, outpoint.n));
} else } else
return false; // TODO: Allow non-wallet inputs return false; // TODO: Allow non-wallet inputs
@@ -3747,7 +3712,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
//a chance at a free transaction. //a chance at a free transaction.
//But mempool inputs might still be in the mempool, so their age stays 0 //But mempool inputs might still be in the mempool, so their age stays 0
//fprintf(stderr,"nCredit %.8f interest %.8f\n",(double)nCredit/COIN,(double)pcoin.first->vout[pcoin.second].interest/COIN); //fprintf(stderr,"nCredit %.8f interest %.8f\n",(double)nCredit/COIN,(double)pcoin.first->vout[pcoin.second].interest/COIN);
if ( KOMODO_EXCHANGEWALLET == 0 && SMART_CHAIN_SYMBOL[0] == 0 ) if ( SMART_CHAIN_SYMBOL[0] == 0 )
{ {
interest2 += pcoin.first->vout[pcoin.second].interest; interest2 += pcoin.first->vout[pcoin.second].interest;
//fprintf(stderr,"%.8f ",(double)pcoin.first->vout[pcoin.second].interest/COIN); //fprintf(stderr,"%.8f ",(double)pcoin.first->vout[pcoin.second].interest/COIN);
@@ -3757,11 +3722,6 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
age += 1; age += 1;
dPriority += (double)nCredit * age; dPriority += (double)nCredit * age;
} }
//if ( KOMODO_EXCHANGEWALLET != 0 )
//{
//fprintf(stderr,"KOMODO_EXCHANGEWALLET disable interest sum %.8f, interest2 %.8f\n",(double)interest/COIN,(double)interest2/COIN);
//interest = 0; // interest2 also
//}
if ( SMART_CHAIN_SYMBOL[0] == 0 && DONATION_PUBKEY.size() == 66 && interest2 > 5000 ) if ( SMART_CHAIN_SYMBOL[0] == 0 && DONATION_PUBKEY.size() == 66 && interest2 > 5000 )
{ {
CScript scriptDonation = CScript() << ParseHex(DONATION_PUBKEY) << OP_CHECKSIG; CScript scriptDonation = CScript() << ParseHex(DONATION_PUBKEY) << OP_CHECKSIG;