Browse Source

Cleanup

master
Duke Leto 3 years ago
parent
commit
482990936f
  1. 5
      ISSUE_TEMPLATE.md
  2. 2
      src/cc/CCPrices.h
  3. 10
      src/cc/prices.cpp
  4. 2
      src/hush_bitcoind.h
  5. 2
      src/hush_defs.h
  6. 10
      src/hush_events.h
  7. 4
      src/hush_globals.h
  8. 2
      src/hush_structs.h
  9. 6
      src/hush_utils.h
  10. 6
      src/main.cpp
  11. 6
      src/miner.cpp
  12. 2
      src/miner.h
  13. 4
      src/rpc/mining.cpp
  14. 2
      src/rpc/misc.cpp

5
ISSUE_TEMPLATE.md

@ -23,7 +23,7 @@ Tell us what should happen
Tell us what happens instead including any noticable error output (any messages displayed on-screen when e.g. a crash occurred)
### The version of Komodo you were using:
### The version of Hush you were using:
Run `hushd --version` to find out
@ -41,5 +41,4 @@ Run `hushd --version` to find out
This includes the relevant contents of `~/.komodo/HUSH3/debug.log`. You can paste raw text, attach the file directly in the issue or link to the text via a pastebin type site.
Please also include any non-standard things you did during compilation (extra flags, dependency version changes etc.) if applicable.
Beware that usernames and IP addresses and other metadata may be in this log file.
Beware that usernames and IP addresses and other metadata is definitely in this log file!

2
src/cc/CCPrices.h

@ -24,7 +24,7 @@
#include "CCinclude.h"
int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks);
extern void GetKomodoEarlytxidScriptPub();
extern void GetHushEarlytxidScriptPub();
extern CScript HUSH_EARLYTXID_SCRIPTPUB;
// #define PRICES_DAYWINDOW ((3600*24/ASSETCHAINS_BLOCKTIME) + 1) // defined in hush_defs.h

10
src/cc/prices.cpp

@ -65,7 +65,7 @@ mine the chain past block 100, preventing anyone else, creating another payments
We call the following in Validation and RPC where the address is needed.
if ( ASSETCHAINS_EARLYTXIDCONTRACT == EVAL_PRICES && HUSH_EARLYTXID_SCRIPTPUB.size() == 0 )
GetKomodoEarlytxidScriptPub();
GetHushEarlytxidScriptPub();
This will fetch the op_return, calculate the scriptPubKey and save it to the global.
On daemon restart as soon as validation for BETTX happens the global will be filled, after this the transaction never needs to be looked up again.
@ -245,7 +245,7 @@ static bool ValidateBetTx(struct CCcontract_info *cp, Eval *eval, const CTransac
// check payment cc config:
if ( ASSETCHAINS_EARLYTXIDCONTRACT == EVAL_PRICES && HUSH_EARLYTXID_SCRIPTPUB.size() == 0 )
GetKomodoEarlytxidScriptPub();
GetHushEarlytxidScriptPub();
if (bettx.vout.size() < 6 || bettx.vout.size() > 7)
return eval->Invalid("incorrect vout number for bet tx");
@ -298,7 +298,7 @@ static bool ValidateAddFundingTx(struct CCcontract_info *cp, Eval *eval, const C
// check payment cc config:
if (ASSETCHAINS_EARLYTXIDCONTRACT == EVAL_PRICES && HUSH_EARLYTXID_SCRIPTPUB.size() == 0)
GetKomodoEarlytxidScriptPub();
GetHushEarlytxidScriptPub();
if (addfundingtx.vout.size() < 4 || addfundingtx.vout.size() > 5)
return eval->Invalid("incorrect vout number for add funding tx");
@ -1510,7 +1510,7 @@ UniValue PricesBet(int64_t txfee, int64_t amount, int16_t leverage, std::vector<
// Lock here, as in validation we cannot call lock in the function itself.
// may not be needed as the validation call to update the global, is called in a LOCK already, and it can only update there and here.
LOCK(cs_main);
GetKomodoEarlytxidScriptPub();
GetHushEarlytxidScriptPub();
}
mtx.vout.push_back(CTxOut(amount-betamount, HUSH_EARLYTXID_SCRIPTPUB));
//test: mtx.vout.push_back(CTxOut(amount - betamount, CScript() << ParseHex("037c803ec82d12da939ac04379bbc1130a9065c53d8244a61eece1db942cf0efa7") << OP_CHECKSIG)); // vout4 test revshare fee
@ -1581,7 +1581,7 @@ UniValue PricesAddFunding(int64_t txfee, uint256 bettxid, int64_t amount)
// Lock here, as in validation we cannot call lock in the function itself.
// may not be needed as the validation call to update the global, is called in a LOCK already, and it can only update there and here.
LOCK(cs_main);
GetKomodoEarlytxidScriptPub();
GetHushEarlytxidScriptPub();
}
mtx.vout.push_back(CTxOut(amount - betamount, HUSH_EARLYTXID_SCRIPTPUB));
// test: mtx.vout.push_back(CTxOut(amount - betamount, CScript() << ParseHex("037c803ec82d12da939ac04379bbc1130a9065c53d8244a61eece1db942cf0efa7") << OP_CHECKSIG)); //vout2 test revshare fee

2
src/hush_bitcoind.h

@ -1803,7 +1803,7 @@ bool komodo_appendACscriptpub()
return false;
}
void GetKomodoEarlytxidScriptPub()
void GetHushEarlytxidScriptPub()
{
if ( HUSH_EARLYTXID == zeroid )
{

2
src/hush_defs.h

@ -481,7 +481,7 @@ static const char *notaries_elected[NUM_HUSH_SEASONS][NUM_HUSH_NOTARIES][2] =
#define HUSH_MAXNVALUE (((uint64_t)1 << 63) - 1)
#define KOMODO_BIT63SET(x) ((x) & ((uint64_t)1 << 63))
#define KOMODO_VALUETOOBIG(x) ((x) > (uint64_t)10000000001*COIN)
#define HUSH_VALUETOOBIG(x) ((x) > (uint64_t)10000000001*COIN)
//#ifndef TESTMODE
#define PRICES_DAYWINDOW ((3600*24/ASSETCHAINS_BLOCKTIME) + 1)

10
src/hush_events.h

@ -33,8 +33,8 @@ struct hush_event *hush_eventadd(struct hush_state *sp,int32_t height,char *symb
strcpy(ep->symbol,symbol);
if ( datalen != 0 )
memcpy(ep->space,data,datalen);
sp->Hush_events = (struct hush_event **)realloc(sp->Hush_events,(1 + sp->Komodo_numevents) * sizeof(*sp->Hush_events));
sp->Hush_events[sp->Komodo_numevents++] = ep;
sp->Hush_events = (struct hush_event **)realloc(sp->Hush_events,(1 + sp->Hush_numeventss) * sizeof(*sp->Hush_events));
sp->Hush_events[sp->Hush_numeventss++] = ep;
portable_mutex_unlock(&komodo_mutex);
}
return(ep);
@ -141,15 +141,15 @@ void hush_event_rewind(struct hush_state *sp,char *symbol,int32_t height)
KOMODO_LASTMINED = prevKOMODO_LASTMINED;
prevKOMODO_LASTMINED = 0;
}
while ( sp->Hush_events != 0 && sp->Komodo_numevents > 0 )
while ( sp->Hush_events != 0 && sp->Hush_numeventss > 0 )
{
if ( (ep= sp->Hush_events[sp->Komodo_numevents-1]) != 0 )
if ( (ep= sp->Hush_events[sp->Hush_numeventss-1]) != 0 )
{
if ( ep->height < height )
break;
//printf("[%s] undo %s event.%c ht.%d for rewind.%d\n",SMART_CHAIN_SYMBOL,symbol,ep->type,ep->height,height);
hush_event_undo(sp,ep);
sp->Komodo_numevents--;
sp->Hush_numeventss--;
}
}
}

4
src/hush_globals.h

@ -40,7 +40,7 @@ pthread_mutex_t komodo_mutex,staked_mutex;
struct pax_transaction *PAX;
int32_t NUM_PRICES; uint32_t *PVALS;
struct knotaries_entry *Pubkeys;
struct hush_state KOMODO_STATES[34];
struct hush_state HUSH_STATES[34];
#define _COINBASE_MATURITY 100
int COINBASE_MATURITY = _COINBASE_MATURITY;//100;
@ -48,7 +48,7 @@ unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+10;
uint256 HUSH_EARLYTXID;
int32_t HUSH_MININGTHREADS = -1,IS_HUSH_NOTARY,USE_EXTERNAL_PUBKEY,HUSH_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,HUSH_EXTERNAL_NOTARIES,HUSH_PASSPORT_INITDONE,KOMODO_PAX,HUSH_EXCHANGEWALLET,HUSH_REWIND,HUSH_CONNECTING = -1,KOMODO_DEALERNODE,HUSH_EXTRASATOSHI,ASSETCHAINS_FOUNDERS,ASSETCHAINS_CBMATURITY,HUSH_NSPV;
int32_t HUSH_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,HUSH_CCACTIVATE,JUMBLR_PAUSE = 1;
int32_t HUSH_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,HUSH_CCACTIVATE;
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;
int8_t ASSETCHAINS_ADAPTIVEPOW;

2
src/hush_structs.h

@ -122,7 +122,7 @@ struct hush_state
uint32_t SAVEDTIMESTAMP;
uint64_t deposited,issued,withdrawn,approved,redeemed,shorted;
struct notarized_checkpoint *NPOINTS; int32_t NUM_NPOINTS,last_NPOINTSi;
struct hush_event **Hush_events; int32_t Komodo_numevents;
struct hush_event **Hush_events; int32_t Hush_numeventss;
uint32_t RTbufs[64][3]; uint64_t RTmask;
};

6
src/hush_utils.h

@ -2467,10 +2467,10 @@ struct hush_state *hush_stateptrget(char *base)
{
int32_t baseid;
if ( base == 0 || base[0] == 0 || strcmp(base,(char *)"KYCSELLOUTS") == 0 )
return(&KOMODO_STATES[33]);
return(&HUSH_STATES[33]);
else if ( (baseid= komodo_baseid(base)) >= 0 )
return(&KOMODO_STATES[baseid+1]);
else return(&KOMODO_STATES[0]);
return(&HUSH_STATES[baseid+1]);
else return(&HUSH_STATES[0]);
}
struct hush_state *hush_stateptr(char *symbol,char *dest)

6
src/main.cpp

@ -1817,7 +1817,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
CAmount nValueOut = tx.GetValueOut();
CAmount nFees = nValueIn-nValueOut;
double dPriority = view.GetPriority(tx, chainActive.Height());
if ( nValueOut > 777777*COIN && KOMODO_VALUETOOBIG(nValueOut - 777777*COIN) != 0 ) // some room for blockreward and txfees
if ( nValueOut > 777777*COIN && HUSH_VALUETOOBIG(nValueOut - 777777*COIN) != 0 ) // some room for blockreward and txfees
return state.DoS(100, error("AcceptToMemoryPool: GetValueOut too big"),REJECT_INVALID,"tx valueout is too big");
// Keep track of transactions that spend a coinbase, which we re-scan
@ -3380,14 +3380,14 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
txdata.emplace_back(tx);
valueout = tx.GetValueOut();
if ( KOMODO_VALUETOOBIG(valueout) != 0 )
if ( HUSH_VALUETOOBIG(valueout) != 0 )
{
fprintf(stderr,"valueout %.8f too big\n",(double)valueout/COIN);
return state.DoS(100, error("ConnectBlock(): GetValueOut too big"),REJECT_INVALID,"tx valueout is too big");
}
//prevsum = voutsum;
//voutsum += valueout;
/*if ( KOMODO_VALUETOOBIG(voutsum) != 0 )
/*if ( HUSH_VALUETOOBIG(voutsum) != 0 )
{
fprintf(stderr,"voutsum %.8f too big\n",(double)voutsum/COIN);
return state.DoS(100, error("ConnectBlock(): voutsum too big"),REJECT_INVALID,"tx valueout is too big");

6
src/miner.cpp

@ -174,7 +174,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
//fprintf(stderr,"create new block\n");
// Create new block
if ( gpucount < 0 )
gpucount = KOMODO_MAXGPUCOUNT;
gpucount = HUSH_MAXGPUCOUNT;
std::unique_ptr<CBlockTemplate> pblocktemplate(new CBlockTemplate());
if(!pblocktemplate.get())
{
@ -286,7 +286,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
continue;
}
txvalue = tx.GetValueOut();
if ( KOMODO_VALUETOOBIG(txvalue) != 0 )
if ( HUSH_VALUETOOBIG(txvalue) != 0 )
continue;
COrphan* porphan = NULL;
@ -1072,7 +1072,7 @@ void static BitcoinMiner()
unsigned int n = chainparams.EquihashN();
unsigned int k = chainparams.EquihashK();
uint8_t *script; uint64_t total; int32_t i,j,gpucount=KOMODO_MAXGPUCOUNT,notaryid = -1;
uint8_t *script; uint64_t total; int32_t i,j,gpucount=HUSH_MAXGPUCOUNT,notaryid = -1;
while ( (ASSETCHAIN_INIT == 0 || HUSH_INITDONE == 0) )
{
sleep(1);

2
src/miner.h

@ -39,7 +39,7 @@ struct CBlockTemplate
std::vector<CAmount> vTxFees;
std::vector<int64_t> vTxSigOps;
};
#define KOMODO_MAXGPUCOUNT 65
#define HUSH_MAXGPUCOUNT 65
/** Generate a new block, without valid proof-of-work */
CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& scriptPubKeyIn, int32_t gpucount, bool isStake = false);

4
src/rpc/mining.cpp

@ -255,7 +255,7 @@ UniValue generate(const UniValue& params, bool fHelp, const CPubKey& mypk)
lastTime = GetTime();
#ifdef ENABLE_WALLET
std::unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey,nHeight,KOMODO_MAXGPUCOUNT));
std::unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey,nHeight,HUSH_MAXGPUCOUNT));
#else
std::unique_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey());
#endif
@ -753,7 +753,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp, const CPubKey& myp
#ifdef ENABLE_WALLET
CReserveKey reservekey(pwalletMain);
LEAVE_CRITICAL_SECTION(cs_main);
pblocktemplate = CreateNewBlockWithKey(reservekey,pindexPrevNew->GetHeight()+1,KOMODO_MAXGPUCOUNT,false);
pblocktemplate = CreateNewBlockWithKey(reservekey,pindexPrevNew->GetHeight()+1,HUSH_MAXGPUCOUNT,false);
#else
pblocktemplate = CreateNewBlockWithKey();
#endif

2
src/rpc/misc.cpp

@ -62,7 +62,7 @@ int32_t hush_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *tx
bool komodo_txnotarizedconfirmed(uint256 txid);
uint32_t hush_chainactive_timestamp();
int32_t hush_whoami(char *pubkeystr,int32_t height,uint32_t timestamp);
extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE,HUSH_LONGESTCHAIN,IS_HUSH_NOTARY,HUSH_INSYNC;
extern int32_t KOMODO_LASTMINED,HUSH_LONGESTCHAIN,IS_HUSH_NOTARY,HUSH_INSYNC;
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
uint32_t komodo_segid32(char *coinaddr);
int64_t hush_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height);

Loading…
Cancel
Save