Browse Source

verushashv1_1, fix walletdb.h, proto version, cleanwallettransactions add

pull/4/head
blackjok3r 5 years ago
parent
commit
142744f22d
  1. 2
      src/chainparams.cpp
  2. 4
      src/init.cpp
  3. 6
      src/komodo_bitcoind.h
  4. 2
      src/komodo_defs.h
  5. 2
      src/komodo_globals.h
  6. 2
      src/metrics.cpp
  7. 4
      src/miner.cpp
  8. 2
      src/rpc/server.cpp
  9. 2
      src/rpc/server.h
  10. 2
      src/version.h
  11. 2
      src/wallet-utility.cpp
  12. 2
      src/wallet/db.h
  13. 6
      src/wallet/rpcwallet.cpp

2
src/chainparams.cpp

@ -297,7 +297,7 @@ void *chainparams_commandline(void *ptr)
mainParams.consensus.nPowAveragingWindow = 45;
mainParams.consensus.powAlternate = uint256S("00000f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f");
}
else if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV2)
else if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV1_1)
{
// this is only good for 60 second blocks with an averaging window of 45. for other parameters, use:
// nLwmaAjustedWeight = (N+1)/2 * (0.9989^(500/nPowAveragingWindow)) * nPowTargetSpacing

4
src/init.cpp

@ -1178,7 +1178,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// set the hash algorithm to use for this chain
// Again likely better solution here, than using long IF ELSE.
extern uint32_t ASSETCHAINS_ALGO, ASSETCHAINS_VERUSHASH, ASSETCHAINS_VERUSHASHV2;
extern uint32_t ASSETCHAINS_ALGO, ASSETCHAINS_VERUSHASH, ASSETCHAINS_VERUSHASHV1_1;
CVerusHash::init();
CVerusHashV2::init();
if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH)
@ -1186,7 +1186,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// initialize VerusHash
CBlockHeader::SetVerusHash();
}
else if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV2)
else if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV1_1)
{
// initialize VerusHashV2
CBlockHeader::SetVerusHashV2();

6
src/komodo_bitcoind.h

@ -1348,7 +1348,7 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he
if ( m+n < 100 )
{
// We do actual PoS % at the start. Requires coin distribution in first 10 blocks!
if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH || ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV2 )
if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH || ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV1_1 )
percPoS = (percPoS*100) / (m+n);
else
// This seems to be inverse. The actual PoS % is backwards in the first 100 blocks.
@ -1453,7 +1453,7 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh
if ( blocktime+iter+segid*2 < txtime+minage )
continue;
diff = (iter + blocktime - txtime - minage);
if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH || ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV2 )
if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH || ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV1_1 )
{
/*if ( PoSperc < ASSETCHAINS_STAKED )
{
@ -1481,7 +1481,7 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh
if ( iter > 0 )
diff += segid*2;
coinage = (value * diff);
if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH || ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV2 )
if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH || ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV1_1 )
{
if ( PoSperc < ASSETCHAINS_STAKED )
{

2
src/komodo_defs.h

@ -51,7 +51,7 @@ extern bool VERUS_MINTBLOCKS;
extern uint64_t ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_TIMELOCKGTE, ASSETCHAINS_NONCEMASK[];
extern const char *ASSETCHAINS_ALGORITHMS[];
extern int32_t VERUS_MIN_STAKEAGE;
extern uint32_t ASSETCHAINS_VERUSHASH, ASSETCHAINS_VERUSHASHV2, ASSETCHAINS_NONCESHIFT[], ASSETCHAINS_HASHESPERROUND[];
extern uint32_t ASSETCHAINS_VERUSHASH, ASSETCHAINS_VERUSHASHV1_1, ASSETCHAINS_NONCESHIFT[], ASSETCHAINS_HASHESPERROUND[];
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
extern std::string NOTARY_PUBKEY,ASSETCHAINS_OVERRIDE_PUBKEY,ASSETCHAINS_SCRIPTPUB;
extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_MARMARA;

2
src/komodo_globals.h

@ -76,7 +76,7 @@ uint8_t ASSETCHAINS_CCDISABLES[256];
uint32_t ASSETCHAINS_NUMALGOS = 3;
uint32_t ASSETCHAINS_EQUIHASH = _ASSETCHAINS_EQUIHASH;
uint32_t ASSETCHAINS_VERUSHASH = 1;
uint32_t ASSETCHAINS_VERUSHASHV2 = 2;
uint32_t ASSETCHAINS_VERUSHASHV1_1 = 2;
const char *ASSETCHAINS_ALGORITHMS[] = {"equihash", "verushash", "verushash11"};
uint64_t ASSETCHAINS_NONCEMASK[] = {0xffff,0xfffffff,0xfffffff};
uint32_t ASSETCHAINS_NONCESHIFT[] = {32,16,16};

2
src/metrics.cpp

@ -136,7 +136,7 @@ int64_t GetUptime()
double GetLocalSolPS()
{
if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH || ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV2)
if (ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH || ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV1_1)
{
return miningTimer.rate(nHashCount);
}

4
src/miner.cpp

@ -1436,7 +1436,7 @@ void static BitcoinMiner_noeq()
CVerusHashV2Writer ss2 = CVerusHashV2Writer(SER_GETHASH, PROTOCOL_VERSION);
ss2 << *((CBlockHeader *)pblock);
if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV2 )
if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV1_1 )
extraPtr = ss2.xI64p();
CVerusHashV2 &vh2 = ss2.GetState();
vh2.ClearExtra();
@ -1459,7 +1459,7 @@ void static BitcoinMiner_noeq()
*extraPtr = i;
if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASH )
vh.ExtraHash((unsigned char *)&hashResult);
else if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV2 )
else if ( ASSETCHAINS_ALGO == ASSETCHAINS_VERUSHASHV1_1 )
vh2.ExtraHash((unsigned char *)&hashResult);
if ( UintToArith256(hashResult) <= hashTarget )

2
src/rpc/server.cpp

@ -561,7 +561,7 @@ static const CRPCCommand vRPCCommands[] =
{ "wallet", "getaccountaddress", &getaccountaddress, true },
{ "wallet", "getaccount", &getaccount, true },
{ "wallet", "getaddressesbyaccount", &getaddressesbyaccount, true },
// { "wallet", "cleanwallettransactions", &cleanwallettransactions, false },
{ "wallet", "cleanwallettransactions", &cleanwallettransactions, false },
{ "wallet", "getbalance", &getbalance, false },
{ "wallet", "getbalance64", &getbalance64, false },
{ "wallet", "getnewaddress", &getnewaddress, true },

2
src/rpc/server.h

@ -353,7 +353,7 @@ extern UniValue signmessage(const UniValue& params, bool fHelp);
extern UniValue verifymessage(const UniValue& params, bool fHelp);
extern UniValue getreceivedbyaddress(const UniValue& params, bool fHelp);
extern UniValue getreceivedbyaccount(const UniValue& params, bool fHelp);
//extern UniValue cleanwallettransactions(const UniValue& params, bool fHelp);
extern UniValue cleanwallettransactions(const UniValue& params, bool fHelp);
extern UniValue getbalance(const UniValue& params, bool fHelp);
extern UniValue getbalance64(const UniValue& params, bool fHelp);
extern UniValue getunconfirmedbalance(const UniValue& params, bool fHelp);

2
src/version.h

@ -33,7 +33,7 @@ static const int INIT_PROTO_VERSION = 209;
static const int GETHEADERS_VERSION = 31800;
//! disconnect from peers older than this proto version
static const int MIN_PEER_PROTO_VERSION = 170007;
static const int MIN_PEER_PROTO_VERSION = 170002;
static const int STAKEDMIN_PEER_PROTO_VERSION = 170007;
//! nTime field added to CAddress, starting with this version;

2
src/wallet-utility.cpp

@ -18,7 +18,7 @@ uint32_t ASSETCHAIN_INIT,ASSETCHAINS_CC;
uint32_t ASSETCHAINS_MAGIC = 2387029918;
uint32_t ASSETCHAINS_EQUIHASH = 0;
uint32_t ASSETCHAINS_VERUSHASH = 1;
uint32_t ASSETCHAINS_VERUSHASHV2 = 2;
uint32_t ASSETCHAINS_VERUSHASHV1_1 = 2;
uint32_t ASSETCHAINS_ALGO = 0;
int32_t ASSETCHAINS_LWMAPOS = 0;
int32_t VERUS_BLOCK_POSUNITS = 1000;

2
src/wallet/db.h

@ -33,7 +33,7 @@
#include <boost/filesystem/path.hpp>
#include "../depends/x86_64-unknown-linux-gnu/include/db_cxx.h"
#include <db_cxx.h>
extern unsigned int nWalletDBUpdated;

6
src/wallet/rpcwallet.cpp

@ -1031,9 +1031,7 @@ CAmount GetAccountBalance(const string& strAccount, int nMinDepth, const isminef
}
// for cleaning wallets, many main net notaries are using this to gain a MASSIVE advantage.
// Disabled here. but they can enable it a bit easier now, then using their own forks.
/*UniValue cleanwallettransactions(const UniValue& params, bool fHelp)
UniValue cleanwallettransactions(const UniValue& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
return NullUniValue;
@ -1134,7 +1132,7 @@ CAmount GetAccountBalance(const string& strAccount, int nMinDepth, const isminef
ret.push_back(Pair("remaining_transactons", (int)remaining));
ret.push_back(Pair("removed_transactions", (int)(txs-remaining)));
return (ret);
} */
}
UniValue getbalance(const UniValue& params, bool fHelp)
{

Loading…
Cancel
Save