Browse Source

We call them Hush Smart Chains around here

pull/305/head
Duke Leto 4 years ago
parent
commit
c737c0dfaf
  1. 4
      src/bitcoin-cli.cpp
  2. 10
      src/bitcoind.cpp
  3. 2
      src/cc/CCtokens.cpp
  4. 2
      src/cc/CCutils.cpp
  5. 8
      src/cc/assets.cpp
  6. 6
      src/cc/dapps/dappstd.c
  7. 2
      src/cc/dice.cpp
  8. 2
      src/cc/eval.cpp
  9. 4
      src/cc/eval.h
  10. 4
      src/cc/gamescc.cpp
  11. 2
      src/cc/import.cpp
  12. 2
      src/cc/prices.cpp
  13. 6
      src/cc/rogue/main.c
  14. 6
      src/cc/rogue_rpc.cpp
  15. 8
      src/cc/sudoku.cpp
  16. 2
      src/chain.h
  17. 6
      src/chainparams.cpp
  18. 4
      src/coins.cpp
  19. 2
      src/crosschain.cpp
  20. 4
      src/deprecation.cpp
  21. 134
      src/hush.h
  22. 4
      src/hush_defs.h
  23. 32
      src/hush_notary.h
  24. 68
      src/hush_utils.h
  25. 2
      src/init.cpp
  26. 44
      src/komodo_bitcoind.h
  27. 6
      src/komodo_ccdata.h
  28. 12
      src/komodo_events.h
  29. 136
      src/komodo_gateway.h
  30. 8
      src/komodo_globals.h
  31. 4
      src/komodo_interest.h
  32. 2
      src/komodo_kv.h
  33. 2
      src/komodo_nSPV.h
  34. 4
      src/komodo_nSPV_fullnode.h
  35. 4
      src/komodo_nSPV_superlite.h
  36. 6
      src/komodo_nSPV_wallet.h
  37. 4
      src/komodo_pax.h
  38. 6
      src/komodo_structs.h
  39. 48
      src/main.cpp
  40. 62
      src/miner.cpp
  41. 2
      src/net.cpp
  42. 4
      src/policy/fees.cpp
  43. 6
      src/pow.cpp
  44. 6
      src/rpc/blockchain.cpp
  45. 38
      src/rpc/crosschain.cpp
  46. 2
      src/rpc/mining.cpp
  47. 27
      src/rpc/misc.cpp
  48. 2
      src/rpc/net.cpp
  49. 6
      src/rpc/rawtransaction.cpp
  50. 16
      src/rpc/server.cpp
  51. 4
      src/test-hush/testutils.cpp
  52. 8
      src/txmempool.cpp
  53. 12
      src/util.cpp
  54. 2
      src/util.h
  55. 2
      src/wallet-utility.cpp
  56. 6
      src/wallet/asyncrpcoperation_sendmany.cpp
  57. 18
      src/wallet/rpcwallet.cpp
  58. 8
      src/wallet/wallet.cpp

4
src/bitcoin-cli.cpp

@ -33,7 +33,7 @@
#include <event2/keyvalq_struct.h>
#include "support/events.h"
uint16_t BITCOIND_RPCPORT = 7771;
char ASSETCHAINS_SYMBOL[65];
char SMART_CHAIN_SYMBOL[65];
#include <univalue.h>
@ -99,7 +99,7 @@ static int AppInitRPC(int argc, char* argv[])
std:string name;
name = GetArg("-ac_name","");
if ( !name.empty() )
strncpy(ASSETCHAINS_SYMBOL,name.c_str(),sizeof(ASSETCHAINS_SYMBOL)-1);
strncpy(SMART_CHAIN_SYMBOL,name.c_str(),sizeof(SMART_CHAIN_SYMBOL)-1);
if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version")) {
std::string strUsage = _("Hush RPC client version") + " " + FormatFullVersion() + "\n" + PrivacyInfo();

10
src/bitcoind.cpp

@ -56,8 +56,8 @@
static bool fDaemon;
#include "hush_defs.h"
#define KOMODO_ASSETCHAIN_MAXLEN 65
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
#define HUSH_SMART_CHAIN_MAXLEN 65
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
extern int32_t ASSETCHAINS_BLOCKTIME;
extern uint64_t ASSETCHAINS_CBOPRET;
void komodo_passport_iteration();
@ -78,7 +78,7 @@ void WaitForShutdown(boost::thread_group* threadGroup)
while (!fShutdown)
{
//fprintf(stderr,"call passport iteration\n");
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
{
if ( KOMODO_NSPV_FULLNODE )
komodo_passport_iteration();
@ -172,7 +172,7 @@ bool AppInit(int argc, char* argv[])
chainparams_commandline();
fprintf(stderr,"call komodo_args.(%s) NOTARY_PUBKEY.(%s)\n",argv[0],NOTARY_PUBKEY.c_str());
printf("initialized %s at %u\n",ASSETCHAINS_SYMBOL,(uint32_t)time(NULL));
printf("initialized %s at %u\n",SMART_CHAIN_SYMBOL,(uint32_t)time(NULL));
if (!boost::filesystem::is_directory(GetDataDir(false)))
{
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str());
@ -225,7 +225,7 @@ bool AppInit(int argc, char* argv[])
fDaemon = GetBoolArg("-daemon", false);
if (fDaemon)
{
fprintf(stdout, "Komodo %s server starting\n",ASSETCHAINS_SYMBOL);
fprintf(stdout, "Komodo %s server starting\n",SMART_CHAIN_SYMBOL);
// Daemonize
pid_t pid = fork();

2
src/cc/CCtokens.cpp

@ -56,7 +56,7 @@ bool TokensValidate(struct CCcontract_info *cp, Eval* eval, const CTransaction &
char destaddr[64], origaddr[64], CCaddr[64];
std::vector<CPubKey> voutTokenPubkeys, vinTokenPubkeys;
if (strcmp(ASSETCHAINS_SYMBOL, "ROGUE") == 0 && chainActive.Height() <= 12500)
if (strcmp(SMART_CHAIN_SYMBOL, "ROGUE") == 0 && chainActive.Height() <= 12500)
return true;
numvins = tx.vin.size();

2
src/cc/CCutils.cpp

@ -682,7 +682,7 @@ bool komodo_txnotarizedconfirmed(uint256 txid)
CTransaction tx;
uint256 hashBlock;
CBlockIndex *pindex;
char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp;
char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct komodo_state *sp;
if ( KOMODO_NSPV_SUPERLITE )
{

8
src/cc/assets.cpp

@ -148,17 +148,17 @@ bool AssetsValidate(struct CCcontract_info *cpAssets,Eval* eval,const CTransacti
preventCCvins = preventCCvouts = -1;
// add specific chains exceptions for old token support:
if (strcmp(ASSETCHAINS_SYMBOL, "SEC") == 0 && chainActive.Height() <= 144073)
if (strcmp(SMART_CHAIN_SYMBOL, "SEC") == 0 && chainActive.Height() <= 144073)
return true;
if (strcmp(ASSETCHAINS_SYMBOL, "MGNX") == 0 && chainActive.Height() <= 210190)
if (strcmp(SMART_CHAIN_SYMBOL, "MGNX") == 0 && chainActive.Height() <= 210190)
return true;
// add specific chains exceptions for old token support:
if (strcmp(ASSETCHAINS_SYMBOL, "SEC") == 0 && chainActive.Height() <= 144073)
if (strcmp(SMART_CHAIN_SYMBOL, "SEC") == 0 && chainActive.Height() <= 144073)
return true;
if (strcmp(ASSETCHAINS_SYMBOL, "MGNX") == 0 && chainActive.Height() <= 210190)
if (strcmp(SMART_CHAIN_SYMBOL, "MGNX") == 0 && chainActive.Height() <= 210190)
return true;
if (numvouts == 0)

6
src/cc/dapps/dappstd.c

@ -36,8 +36,8 @@ char whoami[MAXSTR];
#define SMALLVAL 0.000000000000001
#define SATOSHIDEN ((uint64_t)100000000L)
#define dstr(x) ((double)(x) / SATOSHIDEN)
#define KOMODO_ASSETCHAIN_MAXLEN 65
char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],IPADDRESS[100];
#define HUSH_SMART_CHAIN_MAXLEN 65
char ASSETCHAINS_SYMBOL[HUSH_SMART_CHAIN_MAXLEN],IPADDRESS[100];
#ifndef _BITS256
#define _BITS256
@ -649,7 +649,7 @@ uint16_t _komodo_userpass(char *username, char *password, FILE *fp)
uint16_t komodo_userpass(char *userpass,char *symbol)
{
FILE *fp; uint16_t port = 0; char fname[512],username[512],password[512],confname[KOMODO_ASSETCHAIN_MAXLEN];
FILE *fp; uint16_t port = 0; char fname[512],username[512],password[512],confname[HUSH_SMART_CHAIN_MAXLEN];
userpass[0] = 0;
if ( strcmp("KMD",symbol) == 0 )
{

2
src/cc/dice.cpp

@ -1729,7 +1729,7 @@ void *dealer0_loop(void *_arg)
if ( num < DICE_MINUTXOS ) // this deadlocks, need to put it in a different thread
{
char *cmd = (char *)malloc(100 * 128);
sprintf(cmd,"./komodo-cli -ac_name=%s sendmany \"\" \"{\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002}\"",ASSETCHAINS_SYMBOL,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr);
sprintf(cmd,"./komodo-cli -ac_name=%s sendmany \"\" \"{\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002,\\\"%s\\\":0.0002}\"",SMART_CHAIN_SYMBOL,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr,coinaddr);
n = sqrt((DICE_MINUTXOS - num) / 100)*2 + 1;
fprintf(stderr,"num normal 0.0002 utxos.%d < %d -> n.%d\n",num,DICE_MINUTXOS,n);
for (i=0; i<n; i++)

2
src/cc/eval.cpp

@ -201,7 +201,7 @@ uint32_t Eval::GetAssetchainsCC() const
std::string Eval::GetAssetchainsSymbol() const
{
return std::string(ASSETCHAINS_SYMBOL);
return std::string(SMART_CHAIN_SYMBOL);
}

4
src/cc/eval.h

@ -154,7 +154,7 @@ public:
};
extern char ASSETCHAINS_SYMBOL[65];
extern char SMART_CHAIN_SYMBOL[65];
/*
@ -221,7 +221,7 @@ public:
template <typename Stream>
bool DetectBackNotarisation(Stream& s, CSerActionUnserialize act)
{
if (ASSETCHAINS_SYMBOL[0]) return 1;
if (SMART_CHAIN_SYMBOL[0]) return 1;
if (s.size() >= 72) {
if (strcmp("BTC", &s[68]) == 0) return 1;
if (strcmp("KMD", &s[68]) == 0) return 1;

4
src/cc/gamescc.cpp

@ -279,7 +279,7 @@ uint8_t games_registeropretdecode(uint256 &gametxid,uint256 &tokenid,uint256 &pl
CScript games_finishopret(uint8_t funcid,uint256 gametxid,int32_t regslot,CPubKey pk,std::vector<uint8_t>playerdata,std::string pname)
{
CScript opret; uint8_t evalcode = EVAL_GAMES; std::string symbol(ASSETCHAINS_SYMBOL);
CScript opret; uint8_t evalcode = EVAL_GAMES; std::string symbol(SMART_CHAIN_SYMBOL);
opret << OP_RETURN << E_MARSHAL(ss << evalcode << funcid << gametxid << symbol << pname << regslot << pk << playerdata );
return(opret);
}
@ -871,7 +871,7 @@ uint64_t games_gamefields(UniValue &obj,int64_t maxplayers,int64_t buyin,uint256
obj.push_back(Pair("seed",(int64_t)seed));
if ( games_iamregistered(maxplayers,gametxid,tx,mygamesaddr) > 0 )
sprintf(cmd,"cc/%s %llu %s",GAMENAME,(long long)seed,gametxid.ToString().c_str());
else sprintf(cmd,"./komodo-cli -ac_name=%s cclib register %d \"[%%22%s%%22]\"",ASSETCHAINS_SYMBOL,EVAL_GAMES,gametxid.ToString().c_str());
else sprintf(cmd,"./komodo-cli -ac_name=%s cclib register %d \"[%%22%s%%22]\"",SMART_CHAIN_SYMBOL,EVAL_GAMES,gametxid.ToString().c_str());
obj.push_back(Pair("run",cmd));
}
}

2
src/cc/import.cpp

@ -672,7 +672,7 @@ bool Eval::ImportCoin(const std::vector<uint8_t> params, const CTransaction &imp
LOGSTREAM("importcoin", CCLOG_DEBUG1, stream << "Validating import tx..., txid=" << importTx.GetHash().GetHex() << std::endl);
if (strcmp(ASSETCHAINS_SYMBOL, "CFEKDIMXY6") == 0 && chainActive.Height() <= 44693)
if (strcmp(SMART_CHAIN_SYMBOL, "CFEKDIMXY6") == 0 && chainActive.Height() <= 44693)
return true;
if (importTx.vout.size() < 2)

2
src/cc/prices.cpp

@ -457,7 +457,7 @@ bool PricesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx
{
vscript_t vopret;
if (strcmp(ASSETCHAINS_SYMBOL, "REKT0") == 0 && chainActive.Height() < 5851)
if (strcmp(SMART_CHAIN_SYMBOL, "REKT0") == 0 && chainActive.Height() < 5851)
return true;
// check basic opret rules:
if (PricesCheckOpret(tx, vopret) == 0)

6
src/cc/rogue/main.c

@ -29,8 +29,8 @@ extern char Gametxidstr[67];
#define SMALLVAL 0.000000000000001
#define SATOSHIDEN ((uint64_t)100000000L)
#define dstr(x) ((double)(x) / SATOSHIDEN)
#define KOMODO_ASSETCHAIN_MAXLEN 65
char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],IPADDRESS[100];
#define HUSH_SMART_CHAIN_MAXLEN 65
char ASSETCHAINS_SYMBOL[HUSH_SMART_CHAIN_MAXLEN],IPADDRESS[100];
#ifndef _BITS256
#define _BITS256
@ -696,7 +696,7 @@ uint16_t _komodo_userpass(char *username, char *password, FILE *fp)
uint16_t komodo_userpass(char *userpass,char *symbol)
{
FILE *fp; uint16_t port = 0; char fname[512],username[512],password[512],confname[KOMODO_ASSETCHAIN_MAXLEN];
FILE *fp; uint16_t port = 0; char fname[512],username[512],password[512],confname[HUSH_SMART_CHAIN_MAXLEN];
userpass[0] = 0;
if ( strcmp("KMD",symbol) == 0 )
{

6
src/cc/rogue_rpc.cpp

@ -162,7 +162,7 @@ CScript rogue_keystrokesopret(uint256 gametxid,uint256 batontxid,CPubKey pk,std:
CScript rogue_highlanderopret(uint8_t funcid,uint256 gametxid,int32_t regslot,CPubKey pk,std::vector<uint8_t>playerdata,std::string pname)
{
CScript opret; uint8_t evalcode = EVAL_ROGUE; std::string symbol(ASSETCHAINS_SYMBOL);
CScript opret; uint8_t evalcode = EVAL_ROGUE; std::string symbol(SMART_CHAIN_SYMBOL);
opret << OP_RETURN << E_MARSHAL(ss << evalcode << funcid << gametxid << symbol << pname << regslot << pk << playerdata );
return(opret);
}
@ -701,7 +701,7 @@ uint64_t rogue_gamefields(UniValue &obj,int64_t maxplayers,int64_t buyin,uint256
obj.push_back(Pair("seed",(int64_t)seed));
if ( rogue_iamregistered(maxplayers,gametxid,tx,myrogueaddr) > 0 )
sprintf(cmd,"cc/rogue/rogue %llu %s",(long long)seed,gametxid.ToString().c_str());
else sprintf(cmd,"./komodo-cli -ac_name=%s cclib register %d \"[%%22%s%%22]\"",ASSETCHAINS_SYMBOL,EVAL_ROGUE,gametxid.ToString().c_str());
else sprintf(cmd,"./komodo-cli -ac_name=%s cclib register %d \"[%%22%s%%22]\"",SMART_CHAIN_SYMBOL,EVAL_ROGUE,gametxid.ToString().c_str());
obj.push_back(Pair("run",cmd));
}
}
@ -1513,7 +1513,7 @@ UniValue rogue_setname(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
bool rogue_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const CTransaction tx)
{
CScript scriptPubKey; std::vector<uint8_t> vopret; uint8_t *script,e,f,funcid,tokentx=0; int32_t i,maxplayers,enabled = 0,decoded=0,regslot,ind,err,dispflag,gameheight,score,numvouts; CTransaction vintx,gametx; CPubKey pk; uint256 hashBlock,gametxid,txid,tokenid,batontxid,playertxid,ptxid; int64_t buyin,cashout; std::vector<uint8_t> playerdata,keystrokes; std::string symbol,pname;
if ( strcmp(ASSETCHAINS_SYMBOL,"ROGUE") == 0 )
if ( strcmp(SMART_CHAIN_SYMBOL,"ROGUE") == 0 )
{
if (height < 21274 )
return(true);

8
src/cc/sudoku.cpp

@ -2968,7 +2968,7 @@ bool sudoku_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const
strcpy(laststr,str);
fprintf(stderr,"%s\n",str);
}
if ( strcmp(ASSETCHAINS_SYMBOL,"SUDOKU") != 0 || height > 2000 )
if ( strcmp(SMART_CHAIN_SYMBOL,"SUDOKU") != 0 || height > 2000 )
return eval->Invalid("mismatched sudoku value vs score");
else return(true);
} else return(true);
@ -3000,14 +3000,14 @@ bool sudoku_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const
{
if ( dispflag != 0 )
fprintf(stderr,"ht.%d errflag.%d %s\n",height,errflag,unsolved);
if ( (height != 1220 && height != 1383) || strcmp(ASSETCHAINS_SYMBOL,"SUDOKU") != 0 )
if ( (height != 1220 && height != 1383) || strcmp(SMART_CHAIN_SYMBOL,"SUDOKU") != 0 )
return eval->Invalid("invalid timestamp vs unsolved");
}
if ( dupree_solver(0,&score,unsolved) != 1 )
{
if ( dispflag != 0 )
fprintf(stderr,"non-unique sudoku at ht.%d\n",height);
if ( strcmp(ASSETCHAINS_SYMBOL,"SUDOKU") != 0 )
if ( strcmp(SMART_CHAIN_SYMBOL,"SUDOKU") != 0 )
return eval->Invalid("invalid sudoku with multiple solutions");
}
if ( dispflag != 0 )
@ -3034,7 +3034,7 @@ bool sudoku_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const
return(true);
} else return eval->Invalid("invalid solution opret");
}
else if ( strcmp(ASSETCHAINS_SYMBOL,"SUDOKU") == 0 && height == 236 )
else if ( strcmp(SMART_CHAIN_SYMBOL,"SUDOKU") == 0 && height == 236 )
return(true);
else return eval->Invalid("invalid solution vin");
}

2
src/chain.h

@ -36,7 +36,7 @@ extern bool fZindex;
static const int SPROUT_VALUE_VERSION = 1001400;
static const int SAPLING_VALUE_VERSION = 1010100;
extern int32_t ASSETCHAINS_LWMAPOS;
extern char ASSETCHAINS_SYMBOL[65];
extern char SMART_CHAIN_SYMBOL[65];
extern uint64_t ASSETCHAINS_NOTARY_PAY[];
struct CDiskBlockPos

6
src/chainparams.cpp

@ -564,7 +564,7 @@ void *chainparams_commandline()
fprintf(stderr,"chainparams_commandline called\n");
CChainParams::CCheckpointData checkpointData;
//fprintf(stderr,">>>>>>>> port.%u\n",ASSETCHAINS_P2PPORT);
if ( ASSETCHAINS_SYMBOL[0] != 0 )
if ( SMART_CHAIN_SYMBOL[0] != 0 )
{
if ( ASSETCHAINS_BLOCKTIME != 60 )
{
@ -586,12 +586,12 @@ void *chainparams_commandline()
pCurrentParams->pchMessageStart[1] = (ASSETCHAINS_MAGIC >> 8) & 0xff;
pCurrentParams->pchMessageStart[2] = (ASSETCHAINS_MAGIC >> 16) & 0xff;
pCurrentParams->pchMessageStart[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff;
fprintf(stderr,">>>>>>>>>> %s: p2p.%u rpc.%u magic.%08x %u %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,(uint32_t)ASSETCHAINS_SUPPLY);
fprintf(stderr,">>>>>>>>>> %s: p2p.%u rpc.%u magic.%08x %u %u coins\n",SMART_CHAIN_SYMBOL,ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,(uint32_t)ASSETCHAINS_SUPPLY);
pCurrentParams->consensus.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight = ASSETCHAINS_SAPLING;
pCurrentParams->consensus.vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight = ASSETCHAINS_OVERWINTER;
// Generated at 1575831755 via hush3 contrib/checkpoints.pl by Duke Leto
if (strcmp(ASSETCHAINS_SYMBOL,"HUSH3") == 0) {
if (strcmp(SMART_CHAIN_SYMBOL,"HUSH3") == 0) {
// Generated at 1596199654 via hush3 contrib/checkpoints.pl by Duke Leto
checkpointData = //(Checkpoints::CCheckpointData)
{

4
src/coins.cpp

@ -544,7 +544,7 @@ const CTxOut &CCoinsViewCache::GetOutputFor(const CTxIn& input) const
//uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime);
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight);
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
const CScript &CCoinsViewCache::GetSpendFor(const CCoins *coins, const CTxIn& input)
{
@ -577,7 +577,7 @@ CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTr
value = GetOutputFor(tx.vin[i]).nValue;
nResult += value;
#ifdef KOMODO_ENABLE_INTEREST
if ( ASSETCHAINS_SYMBOL[0] == 0 && nHeight >= 60000 )
if ( SMART_CHAIN_SYMBOL[0] == 0 && nHeight >= 60000 )
{
if ( value >= 10*COIN )
{

2
src/crosschain.cpp

@ -252,7 +252,7 @@ void CompleteImportTransaction(CTransaction &importTx, int32_t offset)
}
bool IsSameAssetChain(const Notarisation &nota) {
return strcmp(nota.second.symbol, ASSETCHAINS_SYMBOL) == 0;
return strcmp(nota.second.symbol, SMART_CHAIN_SYMBOL) == 0;
};

4
src/deprecation.cpp

@ -28,7 +28,7 @@
#include "chainparams.h"
static const std::string CLIENT_VERSION_STR = FormatVersion(CLIENT_VERSION);
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
void EnforceNodeDeprecation(int nHeight, bool forceLogging, bool fThread) {
@ -36,7 +36,7 @@ void EnforceNodeDeprecation(int nHeight, bool forceLogging, bool fThread) {
std::string networkID = Params().NetworkIDString();
std::string msg;
if (networkID != "main" || ASSETCHAINS_SYMBOL[0] != 0 ) return;
if (networkID != "main" || SMART_CHAIN_SYMBOL[0] != 0 ) return;
int blocksToDeprecation = DEPRECATION_HEIGHT - nHeight;
if (blocksToDeprecation <= 0) {

134
src/hush.h

@ -26,7 +26,7 @@
// Todo: verify: reorgs
#define KOMODO_ASSETCHAINS_WAITNOTARIZE
#define HUSH_SMART_CHAINS_WAITNOTARIZE
#define KOMODO_PAXMAX (10000 * COIN)
extern int32_t NOTARIZED_HEIGHT;
uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID;
@ -61,7 +61,7 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char
void komodo_currentheight_set(int32_t height)
{
char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp;
char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct komodo_state *sp;
if ( (sp= komodo_stateptr(symbol,dest)) != 0 )
sp->CURRENT_HEIGHT = height;
}
@ -69,7 +69,7 @@ void komodo_currentheight_set(int32_t height)
extern struct NSPV_inforesp NSPV_inforesult;
int32_t komodo_currentheight()
{
char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp;
char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct komodo_state *sp;
if ( KOMODO_NSPV_SUPERLITE )
{
return (NSPV_inforesult.height);
@ -85,13 +85,13 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char
int32_t func,ht,notarized_height,num,matched=0,MoMdepth; uint256 MoM,notarized_hash,notarized_desttxid; uint8_t pubkeys[64][33];
if ( (func= fgetc(fp)) != EOF )
{
if ( ASSETCHAINS_SYMBOL[0] == 0 && strcmp(symbol,"KMD") == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 && strcmp(symbol,"KMD") == 0 )
matched = 1;
else matched = (strcmp(symbol,ASSETCHAINS_SYMBOL) == 0);
else matched = (strcmp(symbol,SMART_CHAIN_SYMBOL) == 0);
if ( fread(&ht,1,sizeof(ht),fp) != sizeof(ht) )
errs++;
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 && func != 'T' )
printf("[%s] matched.%d fpos.%ld func.(%d %c) ht.%d\n",ASSETCHAINS_SYMBOL,matched,ftell(fp),func,func,ht);
if ( 0 && SMART_CHAIN_SYMBOL[0] != 0 && func != 'T' )
printf("[%s] matched.%d fpos.%ld func.(%d %c) ht.%d\n",SMART_CHAIN_SYMBOL,matched,ftell(fp),func,func,ht);
if ( func == 'P' )
{
if ( (num= fgetc(fp)) <= 64 )
@ -120,8 +120,8 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char
errs++;
if ( fread(&MoMdepth,1,sizeof(MoMdepth),fp) != sizeof(MoMdepth) )
errs++;
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 && sp != 0 )
printf("%s load[%s.%d -> %s] NOTARIZED %d %s MoM.%s %d CCid.%u\n",ASSETCHAINS_SYMBOL,symbol,sp->NUM_NPOINTS,dest,notarized_height,notarized_hash.ToString().c_str(),MoM.ToString().c_str(),MoMdepth&0xffff,(MoMdepth>>16)&0xffff);
if ( 0 && SMART_CHAIN_SYMBOL[0] != 0 && sp != 0 )
printf("%s load[%s.%d -> %s] NOTARIZED %d %s MoM.%s %d CCid.%u\n",SMART_CHAIN_SYMBOL,symbol,sp->NUM_NPOINTS,dest,notarized_height,notarized_hash.ToString().c_str(),MoM.ToString().c_str(),MoMdepth&0xffff,(MoMdepth>>16)&0xffff);
}
else
{
@ -150,7 +150,7 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char
if ( fread(&kheight,1,sizeof(kheight),fp) != sizeof(kheight) )
errs++;
//if ( matched != 0 ) global independent states -> inside *sp
//printf("%s.%d load[%s] ht.%d\n",ASSETCHAINS_SYMBOL,ht,symbol,kheight);
//printf("%s.%d load[%s] ht.%d\n",SMART_CHAIN_SYMBOL,ht,symbol,kheight);
komodo_eventadd_kmdheight(sp,symbol,ht,kheight,0);
}
else if ( func == 'T' )
@ -161,7 +161,7 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char
if ( fread(&ktimestamp,1,sizeof(ktimestamp),fp) != sizeof(ktimestamp) )
errs++;
//if ( matched != 0 ) global independent states -> inside *sp
//printf("%s.%d load[%s] ht.%d t.%u\n",ASSETCHAINS_SYMBOL,ht,symbol,kheight,ktimestamp);
//printf("%s.%d load[%s] ht.%d t.%u\n",SMART_CHAIN_SYMBOL,ht,symbol,kheight,ktimestamp);
komodo_eventadd_kmdheight(sp,symbol,ht,kheight,ktimestamp);
}
else if ( func == 'R' )
@ -179,11 +179,11 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char
{
if ( fread(opret,1,olen,fp) != olen )
errs++;
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 && matched != 0 )
if ( 0 && SMART_CHAIN_SYMBOL[0] != 0 && matched != 0 )
{
int32_t i; for (i=0; i<olen; i++)
printf("%02x",opret[i]);
printf(" %s.%d load[%s] opret[%c] len.%d %.8f\n",ASSETCHAINS_SYMBOL,ht,symbol,opret[0],olen,(double)ovalue/COIN);
printf(" %s.%d load[%s] opret[%c] len.%d %.8f\n",SMART_CHAIN_SYMBOL,ht,symbol,opret[0],olen,(double)ovalue/COIN);
}
komodo_eventadd_opreturn(sp,symbol,ht,txid,ovalue,v,opret,olen); // global shared state -> global PAX
} else
@ -205,11 +205,11 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char
if ( numpvals*sizeof(uint32_t) <= sizeof(pvals) && fread(pvals,sizeof(uint32_t),numpvals,fp) == numpvals )
{
//if ( matched != 0 ) global shared state -> global PVALS
//printf("%s load[%s] prices %d\n",ASSETCHAINS_SYMBOL,symbol,ht);
//printf("%s load[%s] prices %d\n",SMART_CHAIN_SYMBOL,symbol,ht);
komodo_eventadd_pricefeed(sp,symbol,ht,pvals,numpvals);
//printf("load pvals ht.%d numpvals.%d\n",ht,numpvals);
} else printf("error loading pvals[%d]\n",numpvals);
} // else printf("[%s] %s illegal func.(%d %c)\n",ASSETCHAINS_SYMBOL,symbol,func,func);
} // else printf("[%s] %s illegal func.(%d %c)\n",SMART_CHAIN_SYMBOL,symbol,func,func);
return(func);
} else return(-1);
}
@ -232,9 +232,9 @@ int32_t komodo_parsestatefiledata(struct komodo_state *sp,uint8_t *filedata,long
if ( fpos < datalen )
{
func = filedata[fpos++];
if ( ASSETCHAINS_SYMBOL[0] == 0 && strcmp(symbol,"KMD") == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 && strcmp(symbol,"KMD") == 0 )
matched = 1;
else matched = (strcmp(symbol,ASSETCHAINS_SYMBOL) == 0);
else matched = (strcmp(symbol,SMART_CHAIN_SYMBOL) == 0);
if ( memread(&ht,sizeof(ht),filedata,&fpos,datalen) != sizeof(ht) )
errs++;
if ( func == 'P' )
@ -265,8 +265,8 @@ int32_t komodo_parsestatefiledata(struct komodo_state *sp,uint8_t *filedata,long
errs++;
if ( memread(&MoMdepth,sizeof(MoMdepth),filedata,&fpos,datalen) != sizeof(MoMdepth) )
errs++;
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 && sp != 0 )
printf("%s load[%s.%d -> %s] NOTARIZED %d %s MoM.%s %d CCid.%u\n",ASSETCHAINS_SYMBOL,symbol,sp->NUM_NPOINTS,dest,notarized_height,notarized_hash.ToString().c_str(),MoM.ToString().c_str(),MoMdepth&0xffff,(MoMdepth>>16)&0xffff);
if ( 0 && SMART_CHAIN_SYMBOL[0] != 0 && sp != 0 )
printf("%s load[%s.%d -> %s] NOTARIZED %d %s MoM.%s %d CCid.%u\n",SMART_CHAIN_SYMBOL,symbol,sp->NUM_NPOINTS,dest,notarized_height,notarized_hash.ToString().c_str(),MoM.ToString().c_str(),MoMdepth&0xffff,(MoMdepth>>16)&0xffff);
}
else
{
@ -301,7 +301,7 @@ int32_t komodo_parsestatefiledata(struct komodo_state *sp,uint8_t *filedata,long
if ( memread(&ktimestamp,sizeof(ktimestamp),filedata,&fpos,datalen) != sizeof(ktimestamp) )
errs++;
//if ( matched != 0 ) global independent states -> inside *sp
//printf("%s.%d load[%s] ht.%d t.%u\n",ASSETCHAINS_SYMBOL,ht,symbol,kheight,ktimestamp);
//printf("%s.%d load[%s] ht.%d t.%u\n",SMART_CHAIN_SYMBOL,ht,symbol,kheight,ktimestamp);
komodo_eventadd_kmdheight(sp,symbol,ht,kheight,ktimestamp);
}
else if ( func == 'R' )
@ -319,11 +319,11 @@ int32_t komodo_parsestatefiledata(struct komodo_state *sp,uint8_t *filedata,long
{
if ( memread(opret,olen,filedata,&fpos,datalen) != olen )
errs++;
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 && matched != 0 )
if ( 0 && SMART_CHAIN_SYMBOL[0] != 0 && matched != 0 )
{
int32_t i; for (i=0; i<olen; i++)
printf("%02x",opret[i]);
printf(" %s.%d load[%s] opret[%c] len.%d %.8f\n",ASSETCHAINS_SYMBOL,ht,symbol,opret[0],olen,(double)ovalue/COIN);
printf(" %s.%d load[%s] opret[%c] len.%d %.8f\n",SMART_CHAIN_SYMBOL,ht,symbol,opret[0],olen,(double)ovalue/COIN);
}
komodo_eventadd_opreturn(sp,symbol,ht,txid,ovalue,v,opret,olen); // global shared state -> global PAX
} else
@ -345,11 +345,11 @@ int32_t komodo_parsestatefiledata(struct komodo_state *sp,uint8_t *filedata,long
if ( numpvals*sizeof(uint32_t) <= sizeof(pvals) && memread(pvals,(int32_t)(sizeof(uint32_t)*numpvals),filedata,&fpos,datalen) == numpvals*sizeof(uint32_t) )
{
//if ( matched != 0 ) global shared state -> global PVALS
//printf("%s load[%s] prices %d\n",ASSETCHAINS_SYMBOL,symbol,ht);
//printf("%s load[%s] prices %d\n",SMART_CHAIN_SYMBOL,symbol,ht);
komodo_eventadd_pricefeed(sp,symbol,ht,pvals,numpvals);
//printf("load pvals ht.%d numpvals.%d\n",ht,numpvals);
} else printf("error loading pvals[%d]\n",numpvals);
} // else printf("[%s] %s illegal func.(%d %c)\n",ASSETCHAINS_SYMBOL,symbol,func,func);
} // else printf("[%s] %s illegal func.(%d %c)\n",SMART_CHAIN_SYMBOL,symbol,func,func);
*fposp = fpos;
return(func);
}
@ -359,7 +359,7 @@ int32_t komodo_parsestatefiledata(struct komodo_state *sp,uint8_t *filedata,long
void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout,uint256 MoM,int32_t MoMdepth)
{
static FILE *fp; static int32_t errs,didinit; static uint256 zero;
struct komodo_state *sp; char fname[512],symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t retval,ht,func; uint8_t num,pubkeys[64][33];
struct komodo_state *sp; char fname[512],symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; int32_t retval,ht,func; uint8_t num,pubkeys[64][33];
if ( didinit == 0 )
{
portable_mutex_init(&KOMODO_KV_mutex);
@ -369,13 +369,13 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar
if ( (sp= komodo_stateptr(symbol,dest)) == 0 )
{
HUSH_INITDONE = (uint32_t)time(NULL);
printf("[%s] no komodo_stateptr\n",ASSETCHAINS_SYMBOL);
printf("[%s] no komodo_stateptr\n",SMART_CHAIN_SYMBOL);
return;
}
//printf("[%s] (%s) -> (%s)\n",ASSETCHAINS_SYMBOL,symbol,dest);
//printf("[%s] (%s) -> (%s)\n",SMART_CHAIN_SYMBOL,symbol,dest);
if ( fp == 0 )
{
komodo_statefname(fname,ASSETCHAINS_SYMBOL,(char *)"komodostate");
komodo_statefname(fname,SMART_CHAIN_SYMBOL,(char *)"komodostate");
if ( (fp= fopen(fname,"rb+")) != 0 )
{
if ( (retval= komodo_faststateinit(sp,fname,symbol,dest)) > 0 )
@ -515,7 +515,7 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar
int32_t komodo_validate_chain(uint256 srchash,int32_t notarized_height)
{
static int32_t last_rewind; int32_t rewindtarget; CBlockIndex *pindex; struct komodo_state *sp; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN];
static int32_t last_rewind; int32_t rewindtarget; CBlockIndex *pindex; struct komodo_state *sp; char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN];
if ( (sp= komodo_stateptr(symbol,dest)) == 0 )
return(0);
if ( IsInitialBlockDownload() == 0 && ((pindex= komodo_getblockindex(srchash)) == 0 || pindex->GetHeight() != notarized_height) )
@ -530,7 +530,7 @@ int32_t komodo_validate_chain(uint256 srchash,int32_t notarized_height)
if ( last_rewind != 0 )
{
//KOMODO_REWIND = rewindtarget;
fprintf(stderr,"%s FORK detected. notarized.%d %s not in this chain! last notarization %d -> rewindtarget.%d\n",ASSETCHAINS_SYMBOL,notarized_height,srchash.ToString().c_str(),sp->NOTARIZED_HEIGHT,rewindtarget);
fprintf(stderr,"%s FORK detected. notarized.%d %s not in this chain! last notarization %d -> rewindtarget.%d\n",SMART_CHAIN_SYMBOL,notarized_height,srchash.ToString().c_str(),sp->NOTARIZED_HEIGHT,rewindtarget);
}
last_rewind = rewindtarget;
}
@ -541,14 +541,14 @@ int32_t komodo_validate_chain(uint256 srchash,int32_t notarized_height)
int32_t komodo_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notaryid,uint8_t *scriptbuf,int32_t scriptlen,int32_t height,uint256 txhash,int32_t i,int32_t j,uint64_t *voutmaskp,int32_t *specialtxp,int32_t *notarizedheightp,uint64_t value,int32_t notarized,uint64_t signedmask,uint32_t timestamp)
{
static uint256 zero; static FILE *signedfp;
int32_t opretlen,nid,offset,k,MoMdepth,matched,len = 0; uint256 MoM,srchash,desttxid; uint8_t crypto777[33]; struct komodo_state *sp; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN];
int32_t opretlen,nid,offset,k,MoMdepth,matched,len = 0; uint256 MoM,srchash,desttxid; uint8_t crypto777[33]; struct komodo_state *sp; char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN];
if ( (sp= komodo_stateptr(symbol,dest)) == 0 )
return(-1);
if ( scriptlen == 35 && scriptbuf[0] == 33 && scriptbuf[34] == 0xac )
{
if ( i == 0 && j == 0 && memcmp(NOTARY_PUBKEY33,scriptbuf+1,33) == 0 && IS_HUSH_NOTARY != 0 )
{
printf("%s KOMODO_LASTMINED.%d -> %d\n",ASSETCHAINS_SYMBOL,KOMODO_LASTMINED,height);
printf("%s KOMODO_LASTMINED.%d -> %d\n",SMART_CHAIN_SYMBOL,KOMODO_LASTMINED,height);
prevKOMODO_LASTMINED = KOMODO_LASTMINED;
KOMODO_LASTMINED = height;
}
@ -578,7 +578,7 @@ int32_t komodo_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notar
{
//for (i=0; i<33; i++)
// printf("%02x",scriptbuf[i+1]);
//printf(" %s mismatch notaryid.%d k.%d\n",ASSETCHAINS_SYMBOL,notaryid,nid);
//printf(" %s mismatch notaryid.%d k.%d\n",SMART_CHAIN_SYMBOL,notaryid,nid);
notaryid = 64;
*voutmaskp = 0;
}
@ -599,7 +599,7 @@ int32_t komodo_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notar
}
opoffset = len;
matched = 0;
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
{
if ( strcmp("KMD",(char *)&scriptbuf[len+32 * 2 + 4]) == 0 )
matched = 1;
@ -612,7 +612,7 @@ int32_t komodo_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notar
komodo_stateupdate(height,0,0,0,txhash,0,0,0,0,0,0,value,&scriptbuf[len],opretlen,j,zero,0);
return(-1);
}
if ( strcmp(ASSETCHAINS_SYMBOL,(char *)&scriptbuf[len+32*2+4]) == 0 )
if ( strcmp(SMART_CHAIN_SYMBOL,(char *)&scriptbuf[len+32*2+4]) == 0 )
matched = 1;
}
offset = 32 * (1 + matched) + 4;
@ -628,7 +628,7 @@ int32_t komodo_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notar
if ( strcmp("PIZZA",ccdata.symbol) == 0 || strncmp("TXSCL",ccdata.symbol,5) == 0 || strcmp("BEER",ccdata.symbol) == 0)
notarized = 1;
if ( 0 && opretlen != 149 )
printf("[%s].%d (%s) matched.%d i.%d j.%d notarized.%d %llx opretlen.%d len.%d offset.%d opoffset.%d\n",ASSETCHAINS_SYMBOL,height,ccdata.symbol,matched,i,j,notarized,(long long)signedmask,opretlen,len,offset,opoffset);
printf("[%s].%d (%s) matched.%d i.%d j.%d notarized.%d %llx opretlen.%d len.%d offset.%d opoffset.%d\n",SMART_CHAIN_SYMBOL,height,ccdata.symbol,matched,i,j,notarized,(long long)signedmask,opretlen,len,offset,opoffset);
len += dragon_rwbignum(0,&scriptbuf[len],32,(uint8_t *)&srchash);
len += dragon_rwnum(0,&scriptbuf[len],sizeof(*notarizedheightp),(uint8_t *)notarizedheightp);
if ( matched != 0 )
@ -661,12 +661,12 @@ int32_t komodo_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notar
{
len += dragon_rwnum(0,&scriptbuf[len],sizeof(ccdata.CCid),(uint8_t *)&ccdata.CCid);
//if ( ((MoMdepth>>16) & 0xffff) != (ccdata.CCid & 0xffff) )
// fprintf(stderr,"%s CCid mismatch %u != %u\n",ASSETCHAINS_SYMBOL,((MoMdepth>>16) & 0xffff),(ccdata.CCid & 0xffff));
// fprintf(stderr,"%s CCid mismatch %u != %u\n",SMART_CHAIN_SYMBOL,((MoMdepth>>16) & 0xffff),(ccdata.CCid & 0xffff));
ccdata.len = sizeof(ccdata.CCid);
if ( ASSETCHAINS_SYMBOL[0] != 0 )
if ( SMART_CHAIN_SYMBOL[0] != 0 )
{
// MoMoM, depth, numpairs, (notarization ht, MoMoM offset)
if ( len+48-opoffset <= opretlen && strcmp(ccdata.symbol,ASSETCHAINS_SYMBOL) == 0 )
if ( len+48-opoffset <= opretlen && strcmp(ccdata.symbol,SMART_CHAIN_SYMBOL) == 0 )
{
len += dragon_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.kmdstarti);
len += dragon_rwnum(0,&scriptbuf[len],sizeof(uint32_t),(uint8_t *)&MoMoMdata.kmdendi);
@ -694,16 +694,16 @@ int32_t komodo_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notar
}
else
{
komodo_rwccdata(ASSETCHAINS_SYMBOL,1,&ccdata,&MoMoMdata);
komodo_rwccdata(SMART_CHAIN_SYMBOL,1,&ccdata,&MoMoMdata);
if ( matched != 0 )
printf("[%s] matched.%d VALID (%s) MoM.%s [%d] CCid.%u\n",ASSETCHAINS_SYMBOL,matched,ccdata.symbol,MoM.ToString().c_str(),MoMdepth&0xffff,(MoMdepth>>16)&0xffff);
printf("[%s] matched.%d VALID (%s) MoM.%s [%d] CCid.%u\n",SMART_CHAIN_SYMBOL,matched,ccdata.symbol,MoM.ToString().c_str(),MoMdepth&0xffff,(MoMdepth>>16)&0xffff);
}
if ( MoMoMdata.pairs != 0 )
free(MoMoMdata.pairs);
memset(&ccdata,0,sizeof(ccdata));
memset(&MoMoMdata,0,sizeof(MoMoMdata));
}
else if ( ASSETCHAINS_SYMBOL[0] == 0 && matched != 0 && notarized != 0 && validated != 0 )
else if ( SMART_CHAIN_SYMBOL[0] == 0 && matched != 0 && notarized != 0 && validated != 0 )
komodo_rwccdata((char *)"KMD",1,&ccdata,0);
if ( matched != 0 && *notarizedheightp > sp->NOTARIZED_HEIGHT && *notarizedheightp < height )
@ -717,15 +717,15 @@ int32_t komodo_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notar
sp->MoMdepth = MoMdepth;
}
komodo_stateupdate(height,0,0,0,zero,0,0,0,0,0,0,0,0,0,0,sp->MoM,sp->MoMdepth);
//if ( ASSETCHAINS_SYMBOL[0] != 0 )
printf("[%s] ht.%d NOTARIZED.%d %s.%s %sTXID.%s lens.(%d %d) MoM.%s %d\n",ASSETCHAINS_SYMBOL,height,sp->NOTARIZED_HEIGHT,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,srchash.ToString().c_str(),ASSETCHAINS_SYMBOL[0]==0?"BTC":"KMD",desttxid.ToString().c_str(),opretlen,len,sp->MoM.ToString().c_str(),sp->MoMdepth);
//if ( SMART_CHAIN_SYMBOL[0] != 0 )
printf("[%s] ht.%d NOTARIZED.%d %s.%s %sTXID.%s lens.(%d %d) MoM.%s %d\n",SMART_CHAIN_SYMBOL,height,sp->NOTARIZED_HEIGHT,SMART_CHAIN_SYMBOL[0]==0?"KMD":SMART_CHAIN_SYMBOL,srchash.ToString().c_str(),SMART_CHAIN_SYMBOL[0]==0?"BTC":"KMD",desttxid.ToString().c_str(),opretlen,len,sp->MoM.ToString().c_str(),sp->MoMdepth);
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
{
if ( signedfp == 0 )
{
char fname[512];
komodo_statefname(fname,ASSETCHAINS_SYMBOL,(char *)"signedmasks");
komodo_statefname(fname,SMART_CHAIN_SYMBOL,(char *)"signedmasks");
if ( (signedfp= fopen(fname,"rb+")) == 0 )
signedfp = fopen(fname,"wb");
else fseek(signedfp,0,SEEK_END);
@ -747,7 +747,7 @@ int32_t komodo_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notar
} //else if ( fJustCheck )
// return (-3); // if the notarisation is only invalid because its out of order it cannot be mined in a block with a valid one!
} else if ( opretlen != 149 && height > 600000 && matched != 0 )
printf("%s validated.%d notarized.%d %llx reject ht.%d NOTARIZED.%d prev.%d %s.%s DESTTXID.%s len.%d opretlen.%d\n",ccdata.symbol,validated,notarized,(long long)signedmask,height,*notarizedheightp,sp->NOTARIZED_HEIGHT,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,srchash.ToString().c_str(),desttxid.ToString().c_str(),len,opretlen);
printf("%s validated.%d notarized.%d %llx reject ht.%d NOTARIZED.%d prev.%d %s.%s DESTTXID.%s len.%d opretlen.%d\n",ccdata.symbol,validated,notarized,(long long)signedmask,height,*notarizedheightp,sp->NOTARIZED_HEIGHT,SMART_CHAIN_SYMBOL[0]==0?"KMD":SMART_CHAIN_SYMBOL,srchash.ToString().c_str(),desttxid.ToString().c_str(),len,opretlen);
}
else if ( matched != 0 && i == 0 && j == 1 && opretlen == 149 )
{
@ -758,8 +758,8 @@ int32_t komodo_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notar
{
//int32_t k; for (k=0; k<scriptlen; k++)
// printf("%02x",scriptbuf[k]);
//printf(" <- script ht.%d i.%d j.%d value %.8f %s\n",height,i,j,dstr(value),ASSETCHAINS_SYMBOL);
if ( opretlen >= 32*2+4 && strcmp(ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,(char *)&scriptbuf[len+32*2+4]) == 0 )
//printf(" <- script ht.%d i.%d j.%d value %.8f %s\n",height,i,j,dstr(value),SMART_CHAIN_SYMBOL);
if ( opretlen >= 32*2+4 && strcmp(SMART_CHAIN_SYMBOL[0]==0?"KMD":SMART_CHAIN_SYMBOL,(char *)&scriptbuf[len+32*2+4]) == 0 )
{
for (k=0; k<32; k++)
if ( scriptbuf[len+k] != 0 )
@ -813,7 +813,7 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
static int32_t hwmheight;
int32_t staked_era; static int32_t lastStakedEra;
std::vector<int32_t> notarisations;
uint64_t signedmask,voutmask; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp;
uint64_t signedmask,voutmask; char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct komodo_state *sp;
uint8_t scriptbuf[10001],pubkeys[64][33],rmd160[20],scriptPubKey[35]; uint256 zero,btctxid,txhash;
int32_t i,j,k,numnotaries,notarized,scriptlen,isratification,nid,numvalid,specialtx,notarizedheight,notaryid,len,numvouts,numvins,height,txn_count;
if ( pindex == 0 )
@ -826,10 +826,10 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
HUSH_INITDONE = (uint32_t)time(NULL);
if ( (sp= komodo_stateptr(symbol,dest)) == 0 )
{
fprintf(stderr,"unexpected null komodostateptr.[%s]\n",ASSETCHAINS_SYMBOL);
fprintf(stderr,"unexpected null komodostateptr.[%s]\n",SMART_CHAIN_SYMBOL);
return(0);
}
//fprintf(stderr,"%s connect.%d\n",ASSETCHAINS_SYMBOL,pindex->nHeight);
//fprintf(stderr,"%s connect.%d\n",SMART_CHAIN_SYMBOL,pindex->nHeight);
// Wallet Filter. Disabled here. Cant be activated by notaries or pools with some changes.
numnotaries = komodo_notaries(pubkeys,pindex->GetHeight(),pindex->GetBlockTime());
calc_rmd160_sha256(rmd160,pubkeys[0],33);
@ -839,7 +839,7 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
{
if ( pindex->GetHeight() != hwmheight )
{
printf("%s hwmheight.%d vs pindex->GetHeight().%d t.%u reorg.%d\n",ASSETCHAINS_SYMBOL,hwmheight,pindex->GetHeight(),(uint32_t)pindex->nTime,hwmheight-pindex->GetHeight());
printf("%s hwmheight.%d vs pindex->GetHeight().%d t.%u reorg.%d\n",SMART_CHAIN_SYMBOL,hwmheight,pindex->GetHeight(),(uint32_t)pindex->nTime,hwmheight-pindex->GetHeight());
komodo_purge_ccdata((int32_t)pindex->GetHeight());
hwmheight = pindex->GetHeight();
}
@ -885,16 +885,16 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
}
numvalid = bitweight(signedmask);
if ( ((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) ||
(numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) ||
(numvalid >= KOMODO_MINRATIFY && SMART_CHAIN_SYMBOL[0] != 0) ||
numvalid > (numnotaries/5) )
{
if ( !fJustCheck && ASSETCHAINS_SYMBOL[0] != 0)
if ( !fJustCheck && SMART_CHAIN_SYMBOL[0] != 0)
{
static FILE *signedfp;
if ( signedfp == 0 )
{
char fname[512];
komodo_statefname(fname,ASSETCHAINS_SYMBOL,(char *)"signedmasks");
komodo_statefname(fname,SMART_CHAIN_SYMBOL,(char *)"signedmasks");
if ( (signedfp= fopen(fname,"rb+")) == 0 )
signedfp = fopen(fname,"wb");
else fseek(signedfp,0,SEEK_END);
@ -906,7 +906,7 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
fflush(signedfp);
}
transaction = i;
printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts);
printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",SMART_CHAIN_SYMBOL,height,i,(long long)signedmask,numvins,numvouts);
}
notarized = 1;
}
@ -917,7 +917,7 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
sp->NOTARIZED_HASH = block.GetHash();
sp->NOTARIZED_DESTTXID = txhash;
}
if ( IS_HUSH_NOTARY != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
if ( IS_HUSH_NOTARY != 0 && SMART_CHAIN_SYMBOL[0] == 0 )
printf("(tx.%d: ",i);
for (j=0; j<numvouts; j++)
{
@ -935,7 +935,7 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
}
}
}*/
if ( IS_HUSH_NOTARY != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
if ( IS_HUSH_NOTARY != 0 && SMART_CHAIN_SYMBOL[0] == 0 )
printf("%.8f ",dstr(block.vtx[i].vout[j].nValue));
len = block.vtx[i].vout[j].scriptPubKey.size();
@ -956,15 +956,15 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
}
}
}
if ( IS_HUSH_NOTARY != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
if ( IS_HUSH_NOTARY != 0 && SMART_CHAIN_SYMBOL[0] == 0 )
printf(") ");
if ( 0 && ASSETCHAINS_SYMBOL[0] == 0 )
printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d notarized.%d special.%d isratification.%d\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts,notarized,specialtx,isratification);
if ( 0 && SMART_CHAIN_SYMBOL[0] == 0 )
printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d notarized.%d special.%d isratification.%d\n",SMART_CHAIN_SYMBOL,height,i,(long long)signedmask,numvins,numvouts,notarized,specialtx,isratification);
if ( !fJustCheck && (notarized != 0 && (notarizedheight != 0 || specialtx != 0)) )
{
if ( isratification != 0 )
{
printf("%s NOTARY SIGNED.%llx numvins.%d ht.%d txi.%d notaryht.%d specialtx.%d\n",ASSETCHAINS_SYMBOL,(long long)signedmask,numvins,height,i,notarizedheight,specialtx);
printf("%s NOTARY SIGNED.%llx numvins.%d ht.%d txi.%d notaryht.%d specialtx.%d\n",SMART_CHAIN_SYMBOL,(long long)signedmask,numvins,height,i,notarizedheight,specialtx);
printf("ht.%d specialtx.%d isratification.%d numvouts.%d signed.%llx numnotaries.%d\n",height,specialtx,isratification,numvouts,(long long)signedmask,numnotaries);
}
if ( specialtx != 0 && isratification != 0 && numvouts > 2 )
@ -986,7 +986,7 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
}
}
}
if ( ASSETCHAINS_SYMBOL[0] != 0 || height < 100000 )
if ( SMART_CHAIN_SYMBOL[0] != 0 || height < 100000 )
{
if ( ((signedmask & 1) != 0 && numvalid >= KOMODO_MINRATIFY) || bitweight(signedmask) > (numnotaries/3) )
{
@ -998,15 +998,15 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
}
}
}
if ( !fJustCheck && IS_HUSH_NOTARY != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
printf("%s ht.%d\n",ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL,height);
if ( !fJustCheck && IS_HUSH_NOTARY != 0 && SMART_CHAIN_SYMBOL[0] == 0 )
printf("%s ht.%d\n",SMART_CHAIN_SYMBOL[0] == 0 ? "KMD" : SMART_CHAIN_SYMBOL,height);
if ( !fJustCheck && pindex->GetHeight() == hwmheight )
komodo_stateupdate(height,0,0,0,zero,0,0,0,0,height,(uint32_t)pindex->nTime,0,0,0,0,zero,0);
}
else
{ fprintf(stderr,"hush_connectblock: unexpected null pindex\n"); return(0); }
//HUSH_INITDONE = (uint32_t)time(NULL);
//fprintf(stderr,"%s end connect.%d\n",ASSETCHAINS_SYMBOL,pindex->GetHeight());
//fprintf(stderr,"%s end connect.%d\n",SMART_CHAIN_SYMBOL,pindex->GetHeight());
if (fJustCheck)
{
if ( notarisations.size() == 0 )

4
src/hush_defs.h

@ -26,7 +26,7 @@
#define ASSETCHAINS_MAX_ERAS 7
#define KOMODO_ELECTION_GAP 2000
#define ROUNDROBIN_DELAY 61
#define KOMODO_ASSETCHAIN_MAXLEN 65
#define HUSH_SMART_CHAIN_MAXLEN 65
#define KOMODO_LIMITED_NETWORKSIZE 4
#define IGUANA_MAXSCRIPTSIZE 10001
#define KOMODO_MAXMEMPOOLTIME 3600 // affects consensus
@ -493,7 +493,7 @@ static const char *notaries_elected[NUM_HUSH_SEASONS][NUM_HUSH_NOTARIES][2] =
extern uint8_t ASSETCHAINS_TXPOW,ASSETCHAINS_PUBLIC;
extern int8_t ASSETCHAINS_ADAPTIVEPOW;
int32_t MAX_BLOCK_SIZE(int32_t height);
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
extern uint32_t ASSETCHAIN_INIT, ASSETCHAINS_MAGIC;
extern int32_t ASSETCHAINS_LWMAPOS, ASSETCHAINS_SAPLING, ASSETCHAINS_OVERWINTER,ASSETCHAINS_BLOCKTIME;

32
src/hush_notary.h

@ -90,15 +90,15 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam
int32_t i,htind,n; uint64_t mask = 0; struct knotary_entry *kp,*tmp;
static uint8_t kmd_pubkeys[NUM_HUSH_SEASONS][64][33],didinit[NUM_HUSH_SEASONS];
if ( timestamp == 0 && ASSETCHAINS_SYMBOL[0] != 0 ) {
if ( timestamp == 0 && SMART_CHAIN_SYMBOL[0] != 0 ) {
timestamp = komodo_heightstamp(height);
} else if ( ASSETCHAINS_SYMBOL[0] == 0 ) {
} else if ( SMART_CHAIN_SYMBOL[0] == 0 ) {
timestamp = 0;
}
// Find the correct DPoW Notary pubkeys for this season
int32_t hush_season = 0;
bool ishush3 = strncmp(ASSETCHAINS_SYMBOL, "HUSH3",5) == 0 ? true : false;
bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
hush_season = ishush3 ? gethushseason(height) : getacseason(timestamp);
if ( hush_season != 0 )
{
@ -130,8 +130,8 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam
}
pthread_mutex_lock(&komodo_mutex);
n = Pubkeys[htind].numnotaries;
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
fprintf(stderr,"%s height.%d t.%u genesis.%d\n",ASSETCHAINS_SYMBOL,height,timestamp,n);
if ( 0 && SMART_CHAIN_SYMBOL[0] != 0 )
fprintf(stderr,"%s height.%d t.%u genesis.%d\n",SMART_CHAIN_SYMBOL,height,timestamp,n);
HASH_ITER(hh,Pubkeys[htind].Notaries,kp,tmp)
{
if ( kp->notaryid < n )
@ -191,7 +191,7 @@ void komodo_notarysinit(int32_t origheight,uint8_t pubkeys[64][33],int32_t num)
htind = (height / KOMODO_ELECTION_GAP);
if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP )
htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1;
//printf("htind.%d activation %d from %d vs %d | hwmheight.%d %s\n",htind,height,origheight,(((origheight+KOMODO_ELECTION_GAP/2)/KOMODO_ELECTION_GAP)+1)*KOMODO_ELECTION_GAP,hwmheight,ASSETCHAINS_SYMBOL);
//printf("htind.%d activation %d from %d vs %d | hwmheight.%d %s\n",htind,height,origheight,(((origheight+KOMODO_ELECTION_GAP/2)/KOMODO_ELECTION_GAP)+1)*KOMODO_ELECTION_GAP,hwmheight,SMART_CHAIN_SYMBOL);
} else htind = 0;
pthread_mutex_lock(&komodo_mutex);
for (k=0; k<num; k++)
@ -233,7 +233,7 @@ int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,
printf("komodo_chosennotary ht.%d illegal\n",height);
return(-1);
}
if ( height >= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 )
if ( height >= KOMODO_NOTARIES_HARDCODED || SMART_CHAIN_SYMBOL[0] != 0 )
{
if ( (*notaryidp= komodo_electednotary(&numnotaries,pubkey33,height,timestamp)) >= 0 && numnotaries != 0 )
{
@ -270,7 +270,7 @@ int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,
struct notarized_checkpoint *komodo_npptr_for_height(int32_t height, int *idx)
{
char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t i; struct komodo_state *sp; struct notarized_checkpoint *np = 0;
char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; int32_t i; struct komodo_state *sp; struct notarized_checkpoint *np = 0;
if ( (sp= komodo_stateptr(symbol,dest)) != 0 )
{
for (i=sp->NUM_NPOINTS-1; i>=0; i--)
@ -293,7 +293,7 @@ struct notarized_checkpoint *komodo_npptr(int32_t height)
struct notarized_checkpoint *komodo_npptr_at(int idx)
{
char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp;
char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct komodo_state *sp;
if ( (sp= komodo_stateptr(symbol,dest)) != 0 )
if (idx < sp->NUM_NPOINTS)
return &sp->NPOINTS[idx];
@ -303,7 +303,7 @@ struct notarized_checkpoint *komodo_npptr_at(int idx)
int32_t komodo_prevMoMheight()
{
static uint256 zero;
char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t i; struct komodo_state *sp; struct notarized_checkpoint *np = 0;
char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; int32_t i; struct komodo_state *sp; struct notarized_checkpoint *np = 0;
if ( (sp= komodo_stateptr(symbol,dest)) != 0 )
{
for (i=sp->NUM_NPOINTS-1; i>=0; i--)
@ -318,7 +318,7 @@ int32_t komodo_prevMoMheight()
int32_t komodo_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *txidp)
{
char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp;
char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct komodo_state *sp;
*prevMoMheightp = 0;
memset(hashp,0,sizeof(*hashp));
memset(txidp,0,sizeof(*txidp));
@ -345,7 +345,7 @@ int32_t komodo_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *
int32_t hush_dpowconfs(int32_t txheight,int32_t numconfs)
{
static int32_t hadnotarization;
char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp;
char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct komodo_state *sp;
if ( KOMODO_DPOWCONFS != 0 && txheight > 0 && numconfs > 0 && (sp= komodo_stateptr(symbol,dest)) != 0 )
{
if ( sp->NOTARIZED_HEIGHT > 0 )
@ -385,7 +385,7 @@ int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,in
int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp)
{
struct notarized_checkpoint *np = 0; int32_t i=0,flag = 0; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp;
struct notarized_checkpoint *np = 0; int32_t i=0,flag = 0; char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct komodo_state *sp;
if ( (sp= komodo_stateptr(symbol,dest)) != 0 )
{
if ( sp->NUM_NPOINTS > 0 )
@ -426,7 +426,7 @@ int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *n
}
if ( np != 0 )
{
//char str[65],str2[65]; printf("[%s] notarized_ht.%d\n",ASSETCHAINS_SYMBOL,np->notarized_height);
//char str[65],str2[65]; printf("[%s] notarized_ht.%d\n",SMART_CHAIN_SYMBOL,np->notarized_height);
if ( np->nHeight >= nHeight || (i < sp->NUM_NPOINTS && np[1].nHeight < nHeight) )
printf("warning: flag.%d i.%d np->ht %d [1].ht %d >= nHeight.%d\n",flag,i,np->nHeight,np[1].nHeight,nHeight);
*notarized_hashp = np->notarized_hash;
@ -447,8 +447,8 @@ void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t not
fprintf(stderr,"komodo_notarized_update REJECT notarized_height %d > %d nHeight\n",notarized_height,nHeight);
return;
}
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
fprintf(stderr,"[%s] komodo_notarized_update nHeight.%d notarized_height.%d\n",ASSETCHAINS_SYMBOL,nHeight,notarized_height);
if ( 0 && SMART_CHAIN_SYMBOL[0] != 0 )
fprintf(stderr,"[%s] komodo_notarized_update nHeight.%d notarized_height.%d\n",SMART_CHAIN_SYMBOL,nHeight,notarized_height);
portable_mutex_lock(&komodo_mutex);
sp->NPOINTS = (struct notarized_checkpoint *)realloc(sp->NPOINTS,(sp->NUM_NPOINTS+1) * sizeof(*sp->NPOINTS));
np = &sp->NPOINTS[sp->NUM_NPOINTS++];

68
src/hush_utils.h

@ -811,7 +811,7 @@ char *bitcoin_address(char *coinaddr,uint8_t addrtype,uint8_t *pubkey_or_rmd160,
int32_t komodo_is_issuer()
{
if ( ASSETCHAINS_SYMBOL[0] != 0 && komodo_baseid(ASSETCHAINS_SYMBOL) >= 0 )
if ( SMART_CHAIN_SYMBOL[0] != 0 && komodo_baseid(SMART_CHAIN_SYMBOL) >= 0 )
return(1);
else return(0);
}
@ -1334,15 +1334,15 @@ void komodo_statefname(char *fname,char *symbol,char *str)
{
int32_t n,len;
sprintf(fname,"%s",GetDataDir(false).string().c_str());
if ( (n= (int32_t)strlen(ASSETCHAINS_SYMBOL)) != 0 )
if ( (n= (int32_t)strlen(SMART_CHAIN_SYMBOL)) != 0 )
{
len = (int32_t)strlen(fname);
if ( strcmp(ASSETCHAINS_SYMBOL,&fname[len - n]) == 0 )
if ( strcmp(SMART_CHAIN_SYMBOL,&fname[len - n]) == 0 )
fname[len - n] = 0;
else
{
if ( strcmp(symbol,"REGTEST") != 0 )
printf("unexpected fname.(%s) vs %s [%s] n.%d len.%d (%s)\n",fname,symbol,ASSETCHAINS_SYMBOL,n,len,&fname[len - n]);
printf("unexpected fname.(%s) vs %s [%s] n.%d len.%d (%s)\n",fname,symbol,SMART_CHAIN_SYMBOL,n,len,&fname[len - n]);
return;
}
}
@ -1365,7 +1365,7 @@ void komodo_statefname(char *fname,char *symbol,char *str)
#endif
}
strcat(fname,str);
//printf("test.(%s) -> [%s] statename.(%s) %s\n",test,ASSETCHAINS_SYMBOL,symbol,fname);
//printf("test.(%s) -> [%s] statename.(%s) %s\n",test,SMART_CHAIN_SYMBOL,symbol,fname);
}
void komodo_configfile(char *symbol,uint16_t rpcport)
@ -1441,7 +1441,7 @@ void komodo_configfile(char *symbol,uint16_t rpcport)
uint16_t komodo_userpass(char *userpass,char *symbol)
{
FILE *fp; uint16_t port = 0; char fname[512],username[512],password[512],confname[KOMODO_ASSETCHAIN_MAXLEN];
FILE *fp; uint16_t port = 0; char fname[512],username[512],password[512],confname[HUSH_SMART_CHAIN_MAXLEN];
userpass[0] = 0;
if ( strcmp("KMD",symbol) == 0 )
{
@ -1457,7 +1457,7 @@ uint16_t komodo_userpass(char *userpass,char *symbol)
{
port = _komodo_userpass(username,password,fp);
sprintf(userpass,"%s:%s",username,password);
if ( strcmp(symbol,ASSETCHAINS_SYMBOL) == 0 )
if ( strcmp(symbol,SMART_CHAIN_SYMBOL) == 0 )
strcpy(ASSETCHAINS_USERPASS,userpass);
fclose(fp);
}
@ -1647,7 +1647,7 @@ uint64_t komodo_ac_block_subsidy(int nHeight)
int64_t subsidyDifference;
int32_t numhalvings = 0, curEra = 0, sign = 1;
static uint64_t cached_subsidy; static int32_t cached_numhalvings; static int cached_era;
bool ishush3 = strncmp(ASSETCHAINS_SYMBOL, "HUSH3",5) == 0 ? true : false;
bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
// check for backwards compat, older chains with no explicit rewards had 0.0001 block reward
if ( ASSETCHAINS_ENDSUBSIDY[0] == 0 && ASSETCHAINS_REWARD[0] == 0 ) {
@ -1915,7 +1915,7 @@ void komodo_args(char *argv0)
Split(GetArg("-ac_halving",""), sizeof(ASSETCHAINS_HALVING)/sizeof(*ASSETCHAINS_HALVING), ASSETCHAINS_HALVING, 0);
Split(GetArg("-ac_reward",""), sizeof(ASSETCHAINS_REWARD)/sizeof(*ASSETCHAINS_REWARD), ASSETCHAINS_REWARD, 0);
bool ishush3 = strncmp(ASSETCHAINS_SYMBOL, "HUSH3",5) == 0 ? true : false;
bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
if(ishush3) {
fprintf(stderr,"%s: Setting custom HUSH3 reward,halving,subsidy chain values...\n",__func__);
@ -2301,14 +2301,14 @@ fprintf(stderr,"extralen.%d before disable bits\n",extralen);
if ( strlen(addn.c_str()) > 0 )
ASSETCHAINS_SEED = 1;
strncpy(ASSETCHAINS_SYMBOL,name.c_str(),sizeof(ASSETCHAINS_SYMBOL)-1);
strncpy(SMART_CHAIN_SYMBOL,name.c_str(),sizeof(SMART_CHAIN_SYMBOL)-1);
MAX_MONEY = komodo_max_money();
if ( (baseid = komodo_baseid(ASSETCHAINS_SYMBOL)) >= 0 && baseid < 32 )
if ( (baseid = komodo_baseid(SMART_CHAIN_SYMBOL)) >= 0 && baseid < 32 )
{
//komodo_maxallowed(baseid);
printf("baseid.%d MAX_MONEY.%s %.8f\n",baseid,ASSETCHAINS_SYMBOL,(double)MAX_MONEY/SATOSHIDEN);
printf("baseid.%d MAX_MONEY.%s %.8f\n",baseid,SMART_CHAIN_SYMBOL,(double)MAX_MONEY/SATOSHIDEN);
}
if ( ASSETCHAINS_CC >= KOMODO_FIRSTFUNGIBLEID && MAX_MONEY < 1000000LL*SATOSHIDEN )
@ -2316,8 +2316,8 @@ fprintf(stderr,"extralen.%d before disable bits\n",extralen);
if ( KOMODO_BIT63SET(MAX_MONEY) != 0 )
MAX_MONEY = KOMODO_MAXNVALUE;
fprintf(stderr,"MAX_MONEY %llu %.8f\n",(long long)MAX_MONEY,(double)MAX_MONEY/SATOSHIDEN);
//printf("baseid.%d MAX_MONEY.%s %.8f\n",baseid,ASSETCHAINS_SYMBOL,(double)MAX_MONEY/SATOSHIDEN);
uint16_t tmpport = komodo_port(ASSETCHAINS_SYMBOL,ASSETCHAINS_SUPPLY,&ASSETCHAINS_MAGIC,extraptr,extralen);
//printf("baseid.%d MAX_MONEY.%s %.8f\n",baseid,SMART_CHAIN_SYMBOL,(double)MAX_MONEY/SATOSHIDEN);
uint16_t tmpport = komodo_port(SMART_CHAIN_SYMBOL,ASSETCHAINS_SUPPLY,&ASSETCHAINS_MAGIC,extraptr,extralen);
if ( GetArg("-port",0) != 0 )
{
ASSETCHAINS_P2PPORT = GetArg("-port",0);
@ -2334,18 +2334,18 @@ fprintf(stderr,"extralen.%d before disable bits\n",extralen);
#endif
}
//fprintf(stderr,"Got datadir.(%s)\n",dirname);
if ( ASSETCHAINS_SYMBOL[0] != 0 )
if ( SMART_CHAIN_SYMBOL[0] != 0 )
{
int32_t komodo_baseid(char *origbase);
extern int COINBASE_MATURITY;
if ( strcmp(ASSETCHAINS_SYMBOL,"KMD") == 0 )
if ( strcmp(SMART_CHAIN_SYMBOL,"KMD") == 0 )
{
fprintf(stderr,"cant have assetchain named KMD\n");
StartShutdown();
}
if ( (port= komodo_userpass(ASSETCHAINS_USERPASS,ASSETCHAINS_SYMBOL)) != 0 )
if ( (port= komodo_userpass(ASSETCHAINS_USERPASS,SMART_CHAIN_SYMBOL)) != 0 )
ASSETCHAINS_RPCPORT = port;
else komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_P2PPORT + 1);
else komodo_configfile(SMART_CHAIN_SYMBOL,ASSETCHAINS_P2PPORT + 1);
if (ASSETCHAINS_CBMATURITY != 0)
COINBASE_MATURITY = ASSETCHAINS_CBMATURITY;
@ -2356,7 +2356,7 @@ fprintf(stderr,"extralen.%d before disable bits\n",extralen);
fprintf(stderr,"ac_cbmaturity must be >0, shutting down\n");
StartShutdown();
}
//fprintf(stderr,"ASSETCHAINS_RPCPORT (%s) %u\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_RPCPORT);
//fprintf(stderr,"ASSETCHAINS_RPCPORT (%s) %u\n",SMART_CHAIN_SYMBOL,ASSETCHAINS_RPCPORT);
}
if ( ASSETCHAINS_RPCPORT == 0 )
ASSETCHAINS_RPCPORT = ASSETCHAINS_P2PPORT + 1;
@ -2367,7 +2367,7 @@ fprintf(stderr,"extralen.%d before disable bits\n",extralen);
sprintf(&magicstr[i<<1],"%02x",magic[i]);
magicstr[8] = 0;
#ifndef FROM_CLI
sprintf(fname,"%s_7776",ASSETCHAINS_SYMBOL);
sprintf(fname,"%s_7776",SMART_CHAIN_SYMBOL);
if ( (fp= fopen(fname,"wb")) != 0 )
{
int8_t notarypay = 0;
@ -2431,25 +2431,25 @@ fprintf(stderr,"extralen.%d before disable bits\n",extralen);
}
}
int32_t dpowconfs = KOMODO_DPOWCONFS;
if ( ASSETCHAINS_SYMBOL[0] != 0 )
if ( SMART_CHAIN_SYMBOL[0] != 0 )
{
BITCOIND_RPCPORT = GetArg("-rpcport", ASSETCHAINS_RPCPORT);
//fprintf(stderr,"(%s) port.%u chain params initialized\n",ASSETCHAINS_SYMBOL,BITCOIND_RPCPORT);
//fprintf(stderr,"(%s) port.%u chain params initialized\n",SMART_CHAIN_SYMBOL,BITCOIND_RPCPORT);
// Set cc enables for all existing ac_cc chains here.
if ( strcmp("AXO",ASSETCHAINS_SYMBOL) == 0 )
if ( strcmp("AXO",SMART_CHAIN_SYMBOL) == 0 )
{
// No CCs used on this chain yet.
CCDISABLEALL;
}
if ( strcmp("CCL",ASSETCHAINS_SYMBOL) == 0 )
if ( strcmp("CCL",SMART_CHAIN_SYMBOL) == 0 )
{
// No CCs used on this chain yet.
CCDISABLEALL;
CCENABLE(EVAL_TOKENS);
CCENABLE(EVAL_HEIR);
}
if ( strcmp("COQUI",ASSETCHAINS_SYMBOL) == 0 )
if ( strcmp("COQUI",SMART_CHAIN_SYMBOL) == 0 )
{
CCDISABLEALL;
CCENABLE(EVAL_DICE);
@ -2458,40 +2458,40 @@ fprintf(stderr,"extralen.%d before disable bits\n",extralen);
CCENABLE(EVAL_ASSETS);
CCENABLE(EVAL_TOKENS);
}
if ( strcmp("DION",ASSETCHAINS_SYMBOL) == 0 )
if ( strcmp("DION",SMART_CHAIN_SYMBOL) == 0 )
{
// No CCs used on this chain yet.
CCDISABLEALL;
}
if ( strcmp("EQL",ASSETCHAINS_SYMBOL) == 0 )
if ( strcmp("EQL",SMART_CHAIN_SYMBOL) == 0 )
{
// No CCs used on this chain yet.
CCDISABLEALL;
}
if ( strcmp("ILN",ASSETCHAINS_SYMBOL) == 0 )
if ( strcmp("ILN",SMART_CHAIN_SYMBOL) == 0 )
{
// No CCs used on this chain yet.
CCDISABLEALL;
}
if ( strcmp("OUR",ASSETCHAINS_SYMBOL) == 0 )
if ( strcmp("OUR",SMART_CHAIN_SYMBOL) == 0 )
{
// No CCs used on this chain yet.
CCDISABLEALL;
}
if ( strcmp("ZEXO",ASSETCHAINS_SYMBOL) == 0 )
if ( strcmp("ZEXO",SMART_CHAIN_SYMBOL) == 0 )
{
// No CCs used on this chain yet.
CCDISABLEALL;
}
if ( strcmp("SEC",ASSETCHAINS_SYMBOL) == 0 )
if ( strcmp("SEC",SMART_CHAIN_SYMBOL) == 0 )
{
CCDISABLEALL;
CCENABLE(EVAL_ASSETS);
CCENABLE(EVAL_TOKENS);
CCENABLE(EVAL_ORACLES);
}
if ( strcmp("KMDICE",ASSETCHAINS_SYMBOL) == 0 )
if ( strcmp("KMDICE",SMART_CHAIN_SYMBOL) == 0 )
{
CCDISABLEALL;
CCENABLE(EVAL_FAUCET);
@ -2500,7 +2500,7 @@ fprintf(stderr,"extralen.%d before disable bits\n",extralen);
}
} else BITCOIND_RPCPORT = GetArg("-rpcport", BaseParams().RPCPort());
KOMODO_DPOWCONFS = GetArg("-dpowconfs",dpowconfs);
if ( ASSETCHAINS_SYMBOL[0] == 0 || strcmp(ASSETCHAINS_SYMBOL,"SUPERNET") == 0 || strcmp(ASSETCHAINS_SYMBOL,"DEX") == 0 || strcmp(ASSETCHAINS_SYMBOL,"COQUI") == 0 || strcmp(ASSETCHAINS_SYMBOL,"PIRATE") == 0 || strcmp(ASSETCHAINS_SYMBOL,"KMDICE") == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 || strcmp(SMART_CHAIN_SYMBOL,"SUPERNET") == 0 || strcmp(SMART_CHAIN_SYMBOL,"DEX") == 0 || strcmp(SMART_CHAIN_SYMBOL,"COQUI") == 0 || strcmp(SMART_CHAIN_SYMBOL,"PIRATE") == 0 || strcmp(SMART_CHAIN_SYMBOL,"KMDICE") == 0 )
KOMODO_EXTRASATOSHI = 1;
}
@ -2531,7 +2531,7 @@ struct komodo_state *komodo_stateptrget(char *base)
struct komodo_state *komodo_stateptr(char *symbol,char *dest)
{
int32_t baseid;
komodo_nameset(symbol,dest,ASSETCHAINS_SYMBOL);
komodo_nameset(symbol,dest,SMART_CHAIN_SYMBOL);
return(komodo_stateptrget(symbol));
}

2
src/init.cpp

@ -93,7 +93,7 @@ using namespace std;
extern void ThreadSendAlert();
extern bool komodo_dailysnapshot(int32_t height);
extern int32_t KOMODO_LOADINGBLOCKS;
extern char ASSETCHAINS_SYMBOL[];
extern char SMART_CHAIN_SYMBOL[];
extern int32_t KOMODO_SNAPSHOT_INTERVAL;
extern void komodo_init(int32_t height);

44
src/komodo_bitcoind.h

@ -381,7 +381,7 @@ char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port)
{
sprintf(url,(char *)"http://127.0.0.1:%u",port);
sprintf(postdata,"{\"method\":\"%s\",\"params\":%s}",method,params);
//printf("[%s] (%s) postdata.(%s) params.(%s) USERPASS.(%s)\n",ASSETCHAINS_SYMBOL,url,postdata,params,KMDUSERPASS);
//printf("[%s] (%s) postdata.(%s) params.(%s) USERPASS.(%s)\n",SMART_CHAIN_SYMBOL,url,postdata,params,KMDUSERPASS);
retstr2 = bitcoind_RPC(&retstr,(char *)"debug",url,userpass,method,params);
//retstr = curl_post(&cHandle,url,USERPASS,postdata,0,0,0,0);
}
@ -454,7 +454,7 @@ int32_t komodo_verifynotarizedscript(int32_t height,uint8_t *script,int32_t len,
printf(" notarized, ");
for (i=0; i<32; i++)
printf("%02x",((uint8_t *)&hash)[i]);
printf(" opreturn from [%s] ht.%d MISMATCHED\n",ASSETCHAINS_SYMBOL,height);
printf(" opreturn from [%s] ht.%d MISMATCHED\n",SMART_CHAIN_SYMBOL,height);
return(-1);
}
@ -480,15 +480,15 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t
sprintf(&params[i*2 + 2],"%02x",((uint8_t *)&NOTARIZED_DESTTXID)[31-i]);
strcat(params,"\", 1]");*/
sprintf(params,"[\"%s\", 1]",NOTARIZED_DESTTXID.ToString().c_str());
if ( strcmp(symbol,ASSETCHAINS_SYMBOL[0]==0?(char *)"KMD":ASSETCHAINS_SYMBOL) != 0 )
if ( strcmp(symbol,SMART_CHAIN_SYMBOL[0]==0?(char *)"KMD":SMART_CHAIN_SYMBOL) != 0 )
return(0);
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
printf("[%s] src.%s dest.%s params.[%s] ht.%d notarized.%d\n",ASSETCHAINS_SYMBOL,symbol,dest,params,height,NOTARIZED_HEIGHT);
if ( 0 && SMART_CHAIN_SYMBOL[0] != 0 )
printf("[%s] src.%s dest.%s params.[%s] ht.%d notarized.%d\n",SMART_CHAIN_SYMBOL,symbol,dest,params,height,NOTARIZED_HEIGHT);
if ( strcmp(dest,"KMD") == 0 )
{
if ( KMDUSERPASS[0] != 0 )
{
if ( ASSETCHAINS_SYMBOL[0] != 0 )
if ( SMART_CHAIN_SYMBOL[0] != 0 )
{
jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,KMD_PORT);
//printf("userpass.(%s) got (%s)\n",KMDUSERPASS,jsonstr);
@ -508,7 +508,7 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t
}
else
{
printf("[%s] verifynotarization error unexpected dest.(%s)\n",ASSETCHAINS_SYMBOL,dest);
printf("[%s] verifynotarization error unexpected dest.(%s)\n",SMART_CHAIN_SYMBOL,dest);
return(-1);
}
if ( jsonstr != 0 )
@ -518,7 +518,7 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t
if ( (txjson= jobj(json,(char *)"result")) != 0 && (vouts= jarray(&n,txjson,(char *)"vout")) > 0 )
{
vout = jitem(vouts,n-1);
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
if ( 0 && SMART_CHAIN_SYMBOL[0] != 0 )
printf("vout.(%s)\n",jprint(vout,0));
if ( (skey= jobj(vout,(char *)"scriptPubKey")) != 0 )
{
@ -598,7 +598,7 @@ uint64_t komodo_seed(int32_t height)
memset(&zero,0,sizeof(zero));
if ( height > 10 )
height -= 10;
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
hash = _komodo_getblockhash(height);
if ( memcmp(&hash,&zero,sizeof(hash)) == 0 )
hash = komodo_getblockhash(height);
@ -724,14 +724,14 @@ int32_t komodo_isPoS(CBlock *pblock,int32_t height,bool fJustCheck)
void komodo_disconnect(CBlockIndex *pindex,CBlock& block)
{
char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp;
char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct komodo_state *sp;
//fprintf(stderr,"disconnect ht.%d\n",pindex->GetHeight());
komodo_init(pindex->GetHeight());
if ( (sp= komodo_stateptr(symbol,dest)) != 0 )
{
//sp->rewinding = pindex->GetHeight();
//fprintf(stderr,"-%d ",pindex->GetHeight());
} else printf("komodo_disconnect: ht.%d cant get komodo_state.(%s)\n",pindex->GetHeight(),ASSETCHAINS_SYMBOL);
} else printf("komodo_disconnect: ht.%d cant get komodo_state.(%s)\n",pindex->GetHeight(),SMART_CHAIN_SYMBOL);
}
int32_t komodo_is_notarytx(const CTransaction& tx)
@ -1123,18 +1123,18 @@ int32_t komodo_checkpoint(int32_t *notarized_heightp,int32_t nHeight,uint256 has
{
if ( nHeight < notarized_height )
{
//fprintf(stderr,"[%s] nHeight.%d < NOTARIZED_HEIGHT.%d\n",ASSETCHAINS_SYMBOL,nHeight,notarized_height);
//fprintf(stderr,"[%s] nHeight.%d < NOTARIZED_HEIGHT.%d\n",SMART_CHAIN_SYMBOL,nHeight,notarized_height);
return(-1);
}
else if ( nHeight == notarized_height && memcmp(&hash,&notarized_hash,sizeof(hash)) != 0 )
{
fprintf(stderr,"[%s] nHeight.%d == NOTARIZED_HEIGHT.%d, diff hash\n",ASSETCHAINS_SYMBOL,nHeight,notarized_height);
fprintf(stderr,"[%s] nHeight.%d == NOTARIZED_HEIGHT.%d, diff hash\n",SMART_CHAIN_SYMBOL,nHeight,notarized_height);
return(-1);
}
} //else fprintf(stderr,"[%s] unexpected error notary_hash %s ht.%d at ht.%d\n",ASSETCHAINS_SYMBOL,notarized_hash.ToString().c_str(),notarized_height,notary->GetHeight());
} //else fprintf(stderr,"[%s] unexpected error notary_hash %s ht.%d at ht.%d\n",SMART_CHAIN_SYMBOL,notarized_hash.ToString().c_str(),notarized_height,notary->GetHeight());
}
//else if ( notarized_height > 0 && notarized_height != 73880 && notarized_height >= 170000 )
// fprintf(stderr,"[%s] couldnt find notarized.(%s %d) ht.%d\n",ASSETCHAINS_SYMBOL,notarized_hash.ToString().c_str(),notarized_height,pindex->GetHeight());
// fprintf(stderr,"[%s] couldnt find notarized.(%s %d) ht.%d\n",SMART_CHAIN_SYMBOL,notarized_hash.ToString().c_str(),notarized_height,pindex->GetHeight());
return(0);
}
@ -1203,7 +1203,7 @@ int32_t komodo_isrealtime(int32_t *kmdheightp)
int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_t cmptime,int32_t dispflag)
{
dispflag = 1;
if ( KOMODO_REWIND == 0 && ASSETCHAINS_SYMBOL[0] == 0 && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD ) //1473793441 )
if ( KOMODO_REWIND == 0 && SMART_CHAIN_SYMBOL[0] == 0 && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD ) //1473793441 )
{
if ( txheight > 246748 )
{
@ -1354,7 +1354,7 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height)
static bool didinit = false, ishush3 = false;
if (!didinit) {
ishush3 = strncmp(ASSETCHAINS_SYMBOL, "HUSH3",5) == 0 ? true : false;
ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
didinit = true;
fprintf(stderr,"%s: didinit ishush3=%d\n", __func__, ishush3);
}
@ -2158,10 +2158,10 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
if ( ASSETCHAINS_LWMAPOS != 0 && bhash > bnTarget )
{
}
if ( (ASSETCHAINS_SYMBOL[0] != 0 || height > 792000) && bhash > bnTarget )
if ( (SMART_CHAIN_SYMBOL[0] != 0 || height > 792000) && bhash > bnTarget )
{
failed = 1;
if ( height > 0 && ASSETCHAINS_SYMBOL[0] == 0 ) // for the fast case
if ( height > 0 && SMART_CHAIN_SYMBOL[0] == 0 ) // for the fast case
{
if ( (n= komodo_notaries(pubkeys,height,pblock->nTime)) > 0 )
{
@ -2173,7 +2173,7 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
}
}
}
else if ( possible == 0 || ASSETCHAINS_SYMBOL[0] != 0 )
else if ( possible == 0 || SMART_CHAIN_SYMBOL[0] != 0 )
{
if ( KOMODO_TEST_ASSETCHAIN_SKIP_POW )
return(0);
@ -2296,7 +2296,7 @@ int32_t komodo_acpublic(uint32_t tiptime)
if ( (pindex= chainActive.LastTip()) != 0 )
tiptime = pindex->nTime;
}
if ( (ASSETCHAINS_SYMBOL[0] == 0 || strcmp(ASSETCHAINS_SYMBOL,"ZEX") == 0) && tiptime >= KOMODO_SAPLING_DEADLINE )
if ( (SMART_CHAIN_SYMBOL[0] == 0 || strcmp(SMART_CHAIN_SYMBOL,"ZEX") == 0) && tiptime >= KOMODO_SAPLING_DEADLINE )
acpublic = 1;
}
return(acpublic);
@ -2351,7 +2351,7 @@ int64_t komodo_newcoins(int64_t *zfundsp,int64_t *sproutfundsp,int32_t nHeight,C
}
*zfundsp = zfunds;
*sproutfundsp = sproutfunds;
if ( ASSETCHAINS_SYMBOL[0] == 0 && (voutsum-vinsum) == 100003*SATOSHIDEN ) // 15 times
if ( SMART_CHAIN_SYMBOL[0] == 0 && (voutsum-vinsum) == 100003*SATOSHIDEN ) // 15 times
return(3 * SATOSHIDEN);
//if ( voutsum-vinsum+zfunds > 100000*SATOSHIDEN || voutsum-vinsum+zfunds < 0 )
//. fprintf(stderr,"ht.%d vins %.8f, vouts %.8f -> %.8f zfunds %.8f\n",nHeight,dstr(vinsum),dstr(voutsum),dstr(voutsum)-dstr(vinsum),dstr(zfunds));

6
src/komodo_ccdata.h

@ -179,7 +179,7 @@ int32_t komodo_MoMoMdata(char *hexstr,int32_t hexsize,struct komodo_ccdataMoMoM
void komodo_purge_ccdata(int32_t height)
{
struct komodo_ccdata *ccdata,*tmpptr;
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
{
portable_mutex_lock(&KOMODO_CC_mutex);
DL_FOREACH_SAFE(CC_data,ccdata,tmpptr)
@ -222,8 +222,8 @@ int32_t komodo_rwccdata(char *thischain,int32_t rwflag,struct komodo_ccdata *ccd
if ( nonz == 0 )
return(0);
memcpy(&hash,&tmp,sizeof(hash));
//fprintf(stderr,"[%s] ccdata.%s id.%d notarized_ht.%d MoM.%s height.%d/t%d\n",ASSETCHAINS_SYMBOL,ccdata->symbol,ccdata->CCid,ccdata->MoMdata.notarized_height,hash.ToString().c_str(),ccdata->MoMdata.height,ccdata->MoMdata.txi);
if ( ASSETCHAINS_SYMBOL[0] == 0 )
//fprintf(stderr,"[%s] ccdata.%s id.%d notarized_ht.%d MoM.%s height.%d/t%d\n",SMART_CHAIN_SYMBOL,ccdata->symbol,ccdata->CCid,ccdata->MoMdata.notarized_height,hash.ToString().c_str(),ccdata->MoMdata.height,ccdata->MoMdata.txi);
if ( SMART_CHAIN_SYMBOL[0] == 0 )
{
if ( CC_data != 0 && (CC_data->MoMdata.height > ccdata->MoMdata.height || (CC_data->MoMdata.height == ccdata->MoMdata.height && CC_data->MoMdata.txi >= ccdata->MoMdata.txi)) )
{

12
src/komodo_events.h

@ -20,7 +20,7 @@
struct komodo_event *komodo_eventadd(struct komodo_state *sp,int32_t height,char *symbol,uint8_t type,uint8_t *data,uint16_t datalen)
{
struct komodo_event *ep=0; uint16_t len = (uint16_t)(sizeof(*ep) + datalen);
if ( sp != 0 && ASSETCHAINS_SYMBOL[0] != 0 )
if ( sp != 0 && SMART_CHAIN_SYMBOL[0] != 0 )
{
portable_mutex_lock(&komodo_mutex);
ep = (struct komodo_event *)calloc(1,len);
@ -40,11 +40,11 @@ struct komodo_event *komodo_eventadd(struct komodo_state *sp,int32_t height,char
void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t height,char *dest,uint256 notarized_hash,uint256 notarized_desttxid,int32_t notarizedheight,uint256 MoM,int32_t MoMdepth)
{
static uint32_t counter; int32_t verified=0; char *coin; struct komodo_event_notarized N;
coin = (ASSETCHAINS_SYMBOL[0] == 0) ? (char *)"KMD" : ASSETCHAINS_SYMBOL;
coin = (SMART_CHAIN_SYMBOL[0] == 0) ? (char *)"KMD" : SMART_CHAIN_SYMBOL;
if ( IS_HUSH_NOTARY != 0 && (verified= komodo_verifynotarization(symbol,dest,height,notarizedheight,notarized_hash,notarized_desttxid)) < 0 )
{
if ( counter++ < 100 )
printf("[%s] error validating notarization ht.%d notarized_height.%d, if on a pruned %s node this can be ignored\n",ASSETCHAINS_SYMBOL,height,notarizedheight,dest);
printf("[%s] error validating notarization ht.%d notarized_height.%d, if on a pruned %s node this can be ignored\n",SMART_CHAIN_SYMBOL,height,notarizedheight,dest);
}
else if ( strcmp(symbol,coin) == 0 )
{
@ -92,7 +92,7 @@ void komodo_eventadd_pricefeed(struct komodo_state *sp,char *symbol,int32_t heig
void komodo_eventadd_opreturn(struct komodo_state *sp,char *symbol,int32_t height,uint256 txid,uint64_t value,uint16_t vout,uint8_t *buf,uint16_t opretlen)
{
struct komodo_event_opreturn O; uint8_t *opret;
if ( ASSETCHAINS_SYMBOL[0] != 0 )
if ( SMART_CHAIN_SYMBOL[0] != 0 )
{
opret = (uint8_t *)calloc(1,sizeof(O) + opretlen + 16);
O.txid = txid;
@ -132,7 +132,7 @@ void komodo_event_rewind(struct komodo_state *sp,char *symbol,int32_t height)
struct komodo_event *ep;
if ( sp != 0 )
{
if ( ASSETCHAINS_SYMBOL[0] == 0 && height <= KOMODO_LASTMINED && prevKOMODO_LASTMINED != 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 && height <= KOMODO_LASTMINED && prevKOMODO_LASTMINED != 0 )
{
printf("undo KOMODO_LASTMINED %d <- %d\n",KOMODO_LASTMINED,prevKOMODO_LASTMINED);
KOMODO_LASTMINED = prevKOMODO_LASTMINED;
@ -144,7 +144,7 @@ void komodo_event_rewind(struct komodo_state *sp,char *symbol,int32_t height)
{
if ( ep->height < height )
break;
//printf("[%s] undo %s event.%c ht.%d for rewind.%d\n",ASSETCHAINS_SYMBOL,symbol,ep->type,ep->height,height);
//printf("[%s] undo %s event.%c ht.%d for rewind.%d\n",SMART_CHAIN_SYMBOL,symbol,ep->type,ep->height,height);
komodo_event_undo(sp,ep);
sp->Komodo_numevents--;
}

136
src/komodo_gateway.h

@ -117,10 +117,10 @@ void komodo_paxdelete(struct pax_transaction *pax)
void komodo_gateway_deposit(char *coinaddr,uint64_t value,char *symbol,uint64_t fiatoshis,uint8_t *rmd160,uint256 txid,uint16_t vout,uint8_t type,int32_t height,int32_t otherheight,char *source,int32_t approved) // assetchain context
{
struct pax_transaction *pax; uint8_t buf[35]; int32_t addflag = 0; struct komodo_state *sp; char str[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN],*s;
struct pax_transaction *pax; uint8_t buf[35]; int32_t addflag = 0; struct komodo_state *sp; char str[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN],*s;
//if ( KOMODO_PAX == 0 )
// return;
//if ( strcmp(symbol,ASSETCHAINS_SYMBOL) != 0 )
//if ( strcmp(symbol,SMART_CHAIN_SYMBOL) != 0 )
// return;
sp = komodo_stateptr(str,dest);
pthread_mutex_lock(&komodo_mutex);
@ -135,11 +135,11 @@ void komodo_gateway_deposit(char *coinaddr,uint64_t value,char *symbol,uint64_t
memcpy(pax->buf,buf,sizeof(pax->buf));
HASH_ADD_KEYPTR(hh,PAX,pax->buf,sizeof(pax->buf),pax);
addflag = 1;
if ( 0 && ASSETCHAINS_SYMBOL[0] == 0 )
if ( 0 && SMART_CHAIN_SYMBOL[0] == 0 )
{
int32_t i; for (i=0; i<32; i++)
printf("%02x",((uint8_t *)&txid)[i]);
printf(" v.%d [%s] kht.%d ht.%d create pax.%p symbol.%s source.%s\n",vout,ASSETCHAINS_SYMBOL,height,otherheight,pax,symbol,source);
printf(" v.%d [%s] kht.%d ht.%d create pax.%p symbol.%s source.%s\n",vout,SMART_CHAIN_SYMBOL,height,otherheight,pax,symbol,source);
}
}
pthread_mutex_unlock(&komodo_mutex);
@ -209,7 +209,7 @@ int32_t komodo_rwapproval(int32_t rwflag,uint8_t *opretbuf,struct pax_transactio
int32_t komodo_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t *values,int64_t *srcvalues,int32_t *kmdheights,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[KOMODO_ASSETCHAIN_MAXLEN];
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 ( KOMODO_PAX == 0 )
// return(0);
incr = 34 + (iskomodo * (2*sizeof(fiatoshis) + 2*sizeof(height) + 20 + 4));
@ -221,7 +221,7 @@ int32_t komodo_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t
// 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 ( ASSETCHAINS_SYMBOL[0] == 0 || strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0 )
//if ( SMART_CHAIN_SYMBOL[0] == 0 || strncmp(SMART_CHAIN_SYMBOL,base,strlen(base)) == 0 )
{
type = opretbuf[0];
opretbuf++, opretlen--;
@ -286,7 +286,7 @@ int32_t komodo_paxcmp(char *symbol,int32_t kmdheight,uint64_t value,uint64_t che
return(0);
else
{
if ( ASSETCHAINS_SYMBOL[0] != 0 )
if ( SMART_CHAIN_SYMBOL[0] != 0 )
printf("ht.%d ignore mismatched %s value %lld vs checkvalue %lld -> ratio.%d\n",kmdheight,symbol,(long long)value,(long long)checkvalue,ratio);
return(-1);
}
@ -302,7 +302,7 @@ int32_t komodo_paxcmp(char *symbol,int32_t kmdheight,uint64_t value,uint64_t che
uint64_t komodo_paxtotal()
{
struct pax_transaction *pax,*pax2,*tmp,*tmp2; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN],*str; int32_t i,ht; int64_t checktoshis; uint64_t seed,total = 0; struct komodo_state *basesp;
struct pax_transaction *pax,*pax2,*tmp,*tmp2; char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN],*str; int32_t i,ht; int64_t checktoshis; uint64_t seed,total = 0; struct komodo_state *basesp;
if ( KOMODO_PASSPORT_INITDONE == 0 ) //KOMODO_PAX == 0 ||
return(0);
if ( komodo_isrealtime(&ht) == 0 )
@ -327,7 +327,7 @@ uint64_t komodo_paxtotal()
pax->fiatoshis = pax2->fiatoshis;
basesp->issued += pax->fiatoshis;
pax->didstats = 1;
if ( strcmp(str,ASSETCHAINS_SYMBOL) == 0 )
if ( strcmp(str,SMART_CHAIN_SYMBOL) == 0 )
printf("########### %p issued %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,str,dstr(pax->fiatoshis),pax->height,dstr(pax->komodoshis),pax->otherheight);
pax2->marked = pax->height;
pax->marked = pax->height;
@ -348,7 +348,7 @@ uint64_t komodo_paxtotal()
pax->validated = pax->komodoshis = checktoshis;
//int32_t j; for (j=0; j<32; j++)
// printf("%02x",((uint8_t *)&pax->txid)[j]);
//if ( strcmp(str,ASSETCHAINS_SYMBOL) == 0 )
//if ( strcmp(str,SMART_CHAIN_SYMBOL) == 0 )
// printf(" v%d %p got WITHDRAW.%s kmd.%d ht.%d %.8f -> %.8f/%.8f\n",pax->vout,pax,pax->source,pax->height,pax->otherheight,dstr(pax->fiatoshis),dstr(pax->komodoshis),dstr(checktoshis));
}
}
@ -430,7 +430,7 @@ int32_t komodo_pending_withdraws(char *opretstr) // todo: enforce deterministic
struct pax_transaction *pax,*pax2,*tmp,*paxes[64]; uint8_t opretbuf[16384*4]; int32_t i,n,ht,len=0; uint64_t total = 0;
if ( KOMODO_PAX == 0 || KOMODO_PASSPORT_INITDONE == 0 )
return(0);
if ( komodo_isrealtime(&ht) == 0 || ASSETCHAINS_SYMBOL[0] != 0 )
if ( komodo_isrealtime(&ht) == 0 || SMART_CHAIN_SYMBOL[0] != 0 )
return(0);
n = 0;
HASH_ITER(hh,PAX,pax,tmp)
@ -476,13 +476,13 @@ int32_t komodo_pending_withdraws(char *opretstr) // todo: enforce deterministic
int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t tokomodo)
{
struct pax_transaction *pax,*tmp; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; uint8_t *script,opcode,opret[16384*4],data[16384*4]; int32_t i,baseid,ht,len=0,opretlen=0,numvouts=1; struct komodo_state *sp; uint64_t available,deposited,issued,withdrawn,approved,redeemed,mask,sum = 0;
struct pax_transaction *pax,*tmp; char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; uint8_t *script,opcode,opret[16384*4],data[16384*4]; int32_t i,baseid,ht,len=0,opretlen=0,numvouts=1; struct komodo_state *sp; uint64_t available,deposited,issued,withdrawn,approved,redeemed,mask,sum = 0;
if ( KOMODO_PASSPORT_INITDONE == 0 )//KOMODO_PAX == 0 ||
return(0);
struct komodo_state *kmdsp = komodo_stateptrget((char *)"KMD");
sp = komodo_stateptr(symbol,dest);
strcpy(symbol,base);
if ( ASSETCHAINS_SYMBOL[0] != 0 && komodo_baseid(ASSETCHAINS_SYMBOL) < 0 )
if ( SMART_CHAIN_SYMBOL[0] != 0 && komodo_baseid(SMART_CHAIN_SYMBOL) < 0 )
return(0);
PENDING_KOMODO_TX = 0;
for (i=0; i<3; i++)
@ -494,7 +494,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
if ( i == 3 )
{
if ( tokomodo == 0 )
printf("%s not realtime ht.%d\n",ASSETCHAINS_SYMBOL,ht);
printf("%s not realtime ht.%d\n",SMART_CHAIN_SYMBOL,ht);
return(0);
}
if ( tokomodo == 0 )
@ -512,7 +512,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
if ( pax->type != 'D' && pax->type != 'A' )
continue;
{
#ifdef KOMODO_ASSETCHAINS_WAITNOTARIZE
#ifdef HUSH_SMART_CHAINS_WAITNOTARIZE
if ( pax->height > 236000 )
{
if ( kmdsp != 0 && kmdsp->NOTARIZED_HEIGHT >= pax->height )
@ -530,10 +530,10 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
pax->validated = pax->komodoshis;
#endif
}
if ( ASSETCHAINS_SYMBOL[0] != 0 && (pax_fiatstatus(&available,&deposited,&issued,&withdrawn,&approved,&redeemed,symbol) != 0 || available < pax->fiatoshis) )
if ( SMART_CHAIN_SYMBOL[0] != 0 && (pax_fiatstatus(&available,&deposited,&issued,&withdrawn,&approved,&redeemed,symbol) != 0 || available < pax->fiatoshis) )
{
//if ( pax->height > 214700 || strcmp(ASSETCHAINS_SYMBOL,symbol) == 0 )
// printf("miner.[%s]: skip %s %.8f when avail %.8f deposited %.8f, issued %.8f withdrawn %.8f approved %.8f redeemed %.8f\n",ASSETCHAINS_SYMBOL,symbol,dstr(pax->fiatoshis),dstr(available),dstr(deposited),dstr(issued),dstr(withdrawn),dstr(approved),dstr(redeemed));
//if ( pax->height > 214700 || strcmp(SMART_CHAIN_SYMBOL,symbol) == 0 )
// printf("miner.[%s]: skip %s %.8f when avail %.8f deposited %.8f, issued %.8f withdrawn %.8f approved %.8f redeemed %.8f\n",SMART_CHAIN_SYMBOL,symbol,dstr(pax->fiatoshis),dstr(available),dstr(deposited),dstr(issued),dstr(withdrawn),dstr(approved),dstr(redeemed));
continue;
}
/*printf("pax.%s marked.%d %.8f -> %.8f ready.%d validated.%d\n",pax->symbol,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->ready!=0,pax->validated!=0);
@ -542,16 +542,16 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
printf("reject 2\n");
continue;
}*/
if ( ASSETCHAINS_SYMBOL[0] != 0 && (strcmp(pax->symbol,symbol) != 0 || pax->validated == 0 || pax->ready == 0) )
if ( SMART_CHAIN_SYMBOL[0] != 0 && (strcmp(pax->symbol,symbol) != 0 || pax->validated == 0 || pax->ready == 0) )
{
if ( strcmp(pax->symbol,ASSETCHAINS_SYMBOL) == 0 )
if ( strcmp(pax->symbol,SMART_CHAIN_SYMBOL) == 0 )
printf("pax->symbol.%s != %s or null pax->validated %.8f ready.%d ht.(%d %d)\n",pax->symbol,symbol,dstr(pax->validated),pax->ready,kmdsp->CURRENT_HEIGHT,pax->height);
pax->marked = pax->height;
continue;
}
if ( pax->ready == 0 )
continue;
if ( pax->type == 'A' && ASSETCHAINS_SYMBOL[0] == 0 )
if ( pax->type == 'A' && SMART_CHAIN_SYMBOL[0] == 0 )
{
if ( kmdsp != 0 )
{
@ -564,8 +564,8 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
}
//printf("redeem.%d? (%c) %p pax.%s marked.%d %.8f -> %.8f ready.%d validated.%d approved.%d\n",tokomodo,pax->type,pax,pax->symbol,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->ready!=0,pax->validated!=0,pax->approved!=0);
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
printf("pax.%s marked.%d %.8f -> %.8f\n",ASSETCHAINS_SYMBOL,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis));
if ( 0 && SMART_CHAIN_SYMBOL[0] != 0 )
printf("pax.%s marked.%d %.8f -> %.8f\n",SMART_CHAIN_SYMBOL,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis));
if ( opcode == 'I' )
{
sum += pax->fiatoshis;
@ -617,7 +617,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
memcpy(script,opret,opretlen);
for (i=0; i<8; i++)
printf("%02x",opret[i]);
printf(" <- opret, MINER deposits.%d (%s) vouts.%d %.8f opretlen.%d\n",tokomodo,ASSETCHAINS_SYMBOL,numvouts,dstr(PENDING_KOMODO_TX),opretlen);
printf(" <- opret, MINER deposits.%d (%s) vouts.%d %.8f opretlen.%d\n",tokomodo,SMART_CHAIN_SYMBOL,numvouts,dstr(PENDING_KOMODO_TX),opretlen);
return(1);
}
return(0);
@ -683,7 +683,7 @@ void komodo_passport_iteration();
int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtime) // verify above block is valid pax pricing
{
static uint256 array[64]; static int32_t numbanned,indallvouts;
int32_t i,j,k,n,ht,baseid,txn_count,activation,num,opretlen,offset=1,errs=0,notmatched=0,matched=0,kmdheights[256],otherheights[256]; uint256 hash,txids[256]; char symbol[KOMODO_ASSETCHAIN_MAXLEN],base[KOMODO_ASSETCHAIN_MAXLEN]; uint16_t vouts[256]; int8_t baseids[256]; uint8_t *script,opcode,rmd160s[256*20]; uint64_t total,subsidy,available,deposited,issued,withdrawn,approved,redeemed,seed; int64_t checktoshis,values[256],srcvalues[256]; struct pax_transaction *pax; struct komodo_state *sp; CTransaction tx;
int32_t i,j,k,n,ht,baseid,txn_count,activation,num,opretlen,offset=1,errs=0,notmatched=0,matched=0,kmdheights[256],otherheights[256]; uint256 hash,txids[256]; char symbol[HUSH_SMART_CHAIN_MAXLEN],base[HUSH_SMART_CHAIN_MAXLEN]; uint16_t vouts[256]; int8_t baseids[256]; uint8_t *script,opcode,rmd160s[256*20]; uint64_t total,subsidy,available,deposited,issued,withdrawn,approved,redeemed,seed; int64_t checktoshis,values[256],srcvalues[256]; struct pax_transaction *pax; struct komodo_state *sp; CTransaction tx;
activation = 235300;
if ( *(int32_t *)&array[0] == 0 )
numbanned = komodo_bannedset(&indallvouts,array,(int32_t)(sizeof(array)/sizeof(*array)));
@ -694,7 +694,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim
memset(kmdheights,0,sizeof(kmdheights));
memset(otherheights,0,sizeof(otherheights));
txn_count = block.vtx.size();
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
{
for (i=0; i<txn_count; i++)
{
@ -738,7 +738,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim
}
}
}
if ( ASSETCHAINS_SYMBOL[0] == 0 ||
if ( SMART_CHAIN_SYMBOL[0] == 0 ||
((ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_FOUNDERS_REWARD) && height > 1) ||
NetworkUpgradeActive(height, Params().GetConsensus(), Consensus::UPGRADE_SAPLING) )
{
@ -763,7 +763,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim
}
prevtotal = total;
}
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
{
if ( overflow != 0 || total > COIN/10 )
{
@ -819,7 +819,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim
{
fprintf(stderr,"checkdeposit: ht.%d checktoshis %.8f overflow.%d total %.8f strangeout.%d\n",height,dstr(checktoshis),overflow,dstr(total),strangeout);
if ( strangeout != 0 )
fprintf(stderr,">>>>>>>>>>>>> %s DUST ht.%d strangeout.%d notmatched.%d <<<<<<<<<\n",ASSETCHAINS_SYMBOL,height,strangeout,notmatched);
fprintf(stderr,">>>>>>>>>>>>> %s DUST ht.%d strangeout.%d notmatched.%d <<<<<<<<<\n",SMART_CHAIN_SYMBOL,height,strangeout,notmatched);
return(-1);
}
}
@ -831,9 +831,9 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
{
uint8_t rmd160[20],rmd160s[64*20],addrtype,shortflag,pubkey33[33]; int32_t didstats,i,j,n,kvheight,len,tokomodo,kmdheight,otherheights[64],kmdheights[64]; int8_t baseids[64]; char base[4],coinaddr[64],destaddr[64]; uint256 txids[64]; uint16_t vouts[64]; uint64_t convtoshis,seed; int64_t fee,fiatoshis,komodoshis,checktoshis,values[64],srcvalues[64]; struct pax_transaction *pax,*pax2; struct komodo_state *basesp; double diff;
const char *typestr = "unknown";
if ( ASSETCHAINS_SYMBOL[0] != 0 && komodo_baseid(ASSETCHAINS_SYMBOL) < 0 && opretbuf[0] != 'K' )
if ( SMART_CHAIN_SYMBOL[0] != 0 && komodo_baseid(SMART_CHAIN_SYMBOL) < 0 && opretbuf[0] != 'K' )
{
//printf("komodo_opreturn skip %s\n",ASSETCHAINS_SYMBOL);
//printf("komodo_opreturn skip %s\n",SMART_CHAIN_SYMBOL);
return("assetchain");
}
memset(baseids,0xff,sizeof(baseids));
@ -848,7 +848,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
komodo_kvupdate(opretbuf,opretlen,value);
return("kv");
}
else if ( ASSETCHAINS_SYMBOL[0] == 0 && KOMODO_PAX == 0 )
else if ( SMART_CHAIN_SYMBOL[0] == 0 && KOMODO_PAX == 0 )
return("nopax");
if ( opretbuf[0] == 'D' )
{
@ -865,8 +865,8 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
typestr = "deposit";
if ( 0 && strcmp("NOK",base) == 0 )
{
printf("[%s] %s paxdeposit height.%d vs kmdheight.%d\n",ASSETCHAINS_SYMBOL,base,height,kmdheight);
printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed);
printf("[%s] %s paxdeposit height.%d vs kmdheight.%d\n",SMART_CHAIN_SYMBOL,base,height,kmdheight);
printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx\n",SMART_CHAIN_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(SMART_CHAIN_SYMBOL,base,strlen(base)) == 0,(long long)seed);
for (i=0; i<32; i++)
printf("%02x",((uint8_t *)&txid)[i]);
printf(" <- txid.v%u ",vout);
@ -874,7 +874,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
printf("%02x",pubkey33[i]);
printf(" checkpubkey check %.8f v %.8f dest.(%s) kmdheight.%d height.%d\n",dstr(checktoshis),dstr(value),destaddr,kmdheight,height);
}
if ( strcmp(base,ASSETCHAINS_SYMBOL) == 0 && (kmdheight > 195000 || kmdheight <= height) )
if ( strcmp(base,SMART_CHAIN_SYMBOL) == 0 && (kmdheight > 195000 || kmdheight <= height) )
{
didstats = 0;
if ( komodo_paxcmp(base,kmdheight,value,checktoshis,kmdheight < 225000 ? seed : 0) == 0 )
@ -885,7 +885,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
{
basesp->deposited += fiatoshis;
didstats = 1;
if ( 0 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 )
if ( 0 && strcmp(base,SMART_CHAIN_SYMBOL) == 0 )
printf("########### %p deposited %s += %.8f kmdheight.%d %.8f\n",basesp,base,dstr(fiatoshis),kmdheight,dstr(value));
} else printf("cant get stateptr.(%s)\n",base);
komodo_gateway_deposit(coinaddr,value,base,fiatoshis,rmd160,txid,vout,'D',kmdheight,height,(char *)"KMD",0);
@ -902,7 +902,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
{
basesp->deposited += fiatoshis;
didstats = 1;
if ( 0 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 )
if ( 0 && strcmp(base,SMART_CHAIN_SYMBOL) == 0 )
printf("########### %p depositedB %s += %.8f/%.8f kmdheight.%d/%d %.8f/%.8f\n",basesp,base,dstr(fiatoshis),dstr(pax->fiatoshis),kmdheight,pax->height,dstr(value),dstr(pax->komodoshis));
}
} //
@ -931,16 +931,16 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
{
if ( (pax= komodo_paxfind(txid,vout,'D')) != 0 )
pax->marked = checktoshis;
if ( kmdheight > 238000 && (kmdheight > 214700 || strcmp(base,ASSETCHAINS_SYMBOL) == 0) ) //seed != 0 &&
if ( kmdheight > 238000 && (kmdheight > 214700 || strcmp(base,SMART_CHAIN_SYMBOL) == 0) ) //seed != 0 &&
printf("pax %s deposit %.8f rejected kmdheight.%d %.8f KMD check %.8f seed.%llu\n",base,dstr(fiatoshis),kmdheight,dstr(value),dstr(checktoshis),(long long)seed);
}
} //else printf("[%s] %s paxdeposit height.%d vs kmdheight.%d\n",ASSETCHAINS_SYMBOL,base,height,kmdheight);
} //else printf("[%s] %s paxdeposit height.%d vs kmdheight.%d\n",SMART_CHAIN_SYMBOL,base,height,kmdheight);
} //else printf("unsupported size.%d for opreturn D\n",opretlen);
}
else if ( opretbuf[0] == 'I' )
{
tokomodo = 0;
if ( strncmp((char *)"KMD",(char *)&opretbuf[opretlen-4],3) != 0 && strncmp(ASSETCHAINS_SYMBOL,(char *)&opretbuf[opretlen-4],3) == 0 )
if ( strncmp((char *)"KMD",(char *)&opretbuf[opretlen-4],3) != 0 && strncmp(SMART_CHAIN_SYMBOL,(char *)&opretbuf[opretlen-4],3) == 0 )
{
if ( (n= komodo_issued_opreturn(base,txids,vouts,values,srcvalues,kmdheights,otherheights,baseids,rmd160s,opretbuf,opretlen,0)) > 0 )
{
@ -954,7 +954,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
continue;
}
bitcoin_address(coinaddr,60,&rmd160s[i*20],20);
komodo_gateway_deposit(coinaddr,0,ASSETCHAINS_SYMBOL,0,0,txids[i],vouts[i],'I',height,0,CURRENCIES[baseids[i]],0);
komodo_gateway_deposit(coinaddr,0,SMART_CHAIN_SYMBOL,0,0,txids[i],vouts[i],'I',height,0,CURRENCIES[baseids[i]],0);
komodo_paxmark(height,txids[i],vouts[i],'I',height);
if ( (pax= komodo_paxfind(txids[i],vouts[i],'I')) != 0 )
{
@ -988,13 +988,13 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
} //else printf("opreturn none issued?\n");
}
}
else if ( height < 236000 && opretbuf[0] == 'W' && strncmp(ASSETCHAINS_SYMBOL,(char *)&opretbuf[opretlen-4],3) == 0 )//&& opretlen >= 38 )
else if ( height < 236000 && opretbuf[0] == 'W' && strncmp(SMART_CHAIN_SYMBOL,(char *)&opretbuf[opretlen-4],3) == 0 )//&& opretlen >= 38 )
{
if ( komodo_baseid((char *)&opretbuf[opretlen-4]) >= 0 && strcmp(ASSETCHAINS_SYMBOL,(char *)&opretbuf[opretlen-4]) == 0 )
if ( komodo_baseid((char *)&opretbuf[opretlen-4]) >= 0 && strcmp(SMART_CHAIN_SYMBOL,(char *)&opretbuf[opretlen-4]) == 0 )
{
for (i=0; i<opretlen; i++)
printf("%02x",opretbuf[i]);
printf(" [%s] reject obsolete withdraw request.%s\n",ASSETCHAINS_SYMBOL,(char *)&opretbuf[opretlen-4]);
printf(" [%s] reject obsolete withdraw request.%s\n",SMART_CHAIN_SYMBOL,(char *)&opretbuf[opretlen-4]);
return(typestr);
}
tokomodo = 1;
@ -1004,7 +1004,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
bitcoin_address(coinaddr,addrtype,rmd160,20);
checktoshis = PAX_fiatdest(&seed,tokomodo,destaddr,pubkey33,coinaddr,kmdheight,base,value);
typestr = "withdraw";
//printf(" [%s] WITHDRAW %s.height.%d vs height.%d check %.8f/%.8f vs %.8f tokomodo.%d %d seed.%llx -> (%s) len.%d\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(komodoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed,coinaddr,opretlen);
//printf(" [%s] WITHDRAW %s.height.%d vs height.%d check %.8f/%.8f vs %.8f tokomodo.%d %d seed.%llx -> (%s) len.%d\n",SMART_CHAIN_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(komodoshis),dstr(value),komodo_is_issuer(),strncmp(SMART_CHAIN_SYMBOL,base,strlen(base)) == 0,(long long)seed,coinaddr,opretlen);
didstats = 0;
//if ( komodo_paxcmp(base,kmdheight,komodoshis,checktoshis,seed) == 0 )
{
@ -1014,11 +1014,11 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
{
basesp->withdrawn += value;
didstats = 1;
if ( 0 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 )
if ( 0 && strcmp(base,SMART_CHAIN_SYMBOL) == 0 )
printf("########### %p withdrawn %s += %.8f check %.8f\n",basesp,base,dstr(value),dstr(checktoshis));
}
if ( 0 && strcmp(base,"RUB") == 0 && (pax == 0 || pax->approved == 0) )
printf("notarize %s %.8f -> %.8f kmd.%d other.%d\n",ASSETCHAINS_SYMBOL,dstr(value),dstr(komodoshis),kmdheight,height);
printf("notarize %s %.8f -> %.8f kmd.%d other.%d\n",SMART_CHAIN_SYMBOL,dstr(value),dstr(komodoshis),kmdheight,height);
}
komodo_gateway_deposit(coinaddr,0,(char *)"KMD",value,rmd160,txid,vout,'W',kmdheight,height,source,0);
if ( (pax= komodo_paxfind(txid,vout,'W')) != 0 )
@ -1033,10 +1033,10 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
} // else printf("withdraw %s paxcmp ht.%d %d error value %.8f -> %.8f vs %.8f\n",base,kmdheight,height,dstr(value),dstr(komodoshis),dstr(checktoshis));
// need to allocate pax
}
else if ( height < 236000 && tokomodo != 0 && opretbuf[0] == 'A' && ASSETCHAINS_SYMBOL[0] == 0 )
else if ( height < 236000 && tokomodo != 0 && opretbuf[0] == 'A' && SMART_CHAIN_SYMBOL[0] == 0 )
{
tokomodo = 1;
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
if ( 0 && SMART_CHAIN_SYMBOL[0] != 0 )
{
for (i=0; i<opretlen; i++)
printf("%02x",opretbuf[i]);
@ -1104,7 +1104,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
pax->validated = checktoshis;
if ( didstats != 0 )
pax->didstats = 1;
//if ( strcmp(CURRENCIES[baseids[i]],ASSETCHAINS_SYMBOL) == 0 )
//if ( strcmp(CURRENCIES[baseids[i]],SMART_CHAIN_SYMBOL) == 0 )
//printf(" i.%d approved.%d <<<<<<<<<<<<< APPROVED %p\n",i,kmdheights[i],pax);
}
}
@ -1112,7 +1112,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
} //else printf("n.%d from opreturns\n",n);
//printf("extra.[%d] after %.8f\n",n,dstr(komodo_paxtotal()));
}
else if ( height < 236000 && opretbuf[0] == 'X' && ASSETCHAINS_SYMBOL[0] == 0 )
else if ( height < 236000 && opretbuf[0] == 'X' && SMART_CHAIN_SYMBOL[0] == 0 )
{
tokomodo = 1;
if ( (n= komodo_issued_opreturn(base,txids,vouts,values,srcvalues,kmdheights,otherheights,baseids,rmd160s,opretbuf,opretlen,1)) > 0 )
@ -1136,7 +1136,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
{
basesp->redeemed += value;
pax->didstats = 1;
if ( strcmp(CURRENCIES[baseids[i]],ASSETCHAINS_SYMBOL) == 0 )
if ( strcmp(CURRENCIES[baseids[i]],SMART_CHAIN_SYMBOL) == 0 )
printf("ht.%d %.8f ########### %p redeemed %s += %.8f %.8f kht.%d ht.%d\n",height,dstr(value),basesp,CURRENCIES[baseids[i]],dstr(value),dstr(srcvalues[i]),kmdheights[i],otherheights[i]);
}
}
@ -1427,28 +1427,28 @@ void komodo_passport_iteration()
{
static long lastpos[34]; static char userpass[33][1024]; static uint32_t lasttime,callcounter,lastinterest;
int32_t maxseconds = 10;
FILE *fp; uint8_t *filedata; long fpos,datalen,lastfpos; int32_t baseid,limit,n,ht,isrealtime,expired,refid,blocks,longest; struct komodo_state *sp,*refsp; char *retstr,fname[512],*base,symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; uint32_t buf[3],starttime; uint64_t RTmask = 0; //CBlockIndex *pindex;
FILE *fp; uint8_t *filedata; long fpos,datalen,lastfpos; int32_t baseid,limit,n,ht,isrealtime,expired,refid,blocks,longest; struct komodo_state *sp,*refsp; char *retstr,fname[512],*base,symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; uint32_t buf[3],starttime; uint64_t RTmask = 0; //CBlockIndex *pindex;
expired = 0;
while ( 0 && HUSH_INITDONE == 0 )
{
fprintf(stderr,"[%s] PASSPORT iteration waiting for HUSH_INITDONE\n",ASSETCHAINS_SYMBOL);
fprintf(stderr,"[%s] PASSPORT iteration waiting for HUSH_INITDONE\n",SMART_CHAIN_SYMBOL);
sleep(3);
}
if ( komodo_chainactive_timestamp() > lastinterest )
{
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
komodo_interestsum();
//komodo_longestchain();
lastinterest = komodo_chainactive_timestamp();
}
refsp = komodo_stateptr(symbol,dest);
if ( ASSETCHAINS_SYMBOL[0] == 0 || strcmp(ASSETCHAINS_SYMBOL,"JUSTLIES") == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 || strcmp(SMART_CHAIN_SYMBOL,"JUSTLIES") == 0 )
{
refid = 33;
limit = 10000000;
} else {
limit = 10000000;
refid = komodo_baseid(ASSETCHAINS_SYMBOL)+1; // illegal base -> baseid.-1 -> 0
refid = komodo_baseid(SMART_CHAIN_SYMBOL)+1; // illegal base -> baseid.-1 -> 0
if ( refid == 0 )
{
KOMODO_PASSPORT_INITDONE = 1;
@ -1466,7 +1466,7 @@ void komodo_passport_iteration()
sp = 0;
isrealtime = 0;
base = (char *)CURRENCIES[baseid];
//printf("PASSPORT %s baseid+1 %d refid.%d\n",ASSETCHAINS_SYMBOL,baseid+1,refid);
//printf("PASSPORT %s baseid+1 %d refid.%d\n",SMART_CHAIN_SYMBOL,baseid+1,refid);
if ( baseid+1 != refid ) // only need to import state from a different coin
{
if ( baseid == 32 ) // only care about KMD's state
@ -1479,10 +1479,10 @@ void komodo_passport_iteration()
if ( lastpos[baseid] == 0 && (filedata= OS_fileptr(&datalen,fname)) != 0 )
{
fpos = 0;
fprintf(stderr,"%s processing %s %ldKB\n",ASSETCHAINS_SYMBOL,fname,datalen/1024);
fprintf(stderr,"%s processing %s %ldKB\n",SMART_CHAIN_SYMBOL,fname,datalen/1024);
while ( komodo_parsestatefiledata(sp,filedata,&fpos,datalen,symbol,dest) >= 0 )
lastfpos = fpos;
fprintf(stderr,"%s took %d seconds to process %s %ldKB\n",ASSETCHAINS_SYMBOL,(int32_t)(time(NULL)-starttime),fname,datalen/1024);
fprintf(stderr,"%s took %d seconds to process %s %ldKB\n",SMART_CHAIN_SYMBOL,(int32_t)(time(NULL)-starttime),fname,datalen/1024);
lastpos[baseid] = lastfpos;
free(filedata), filedata = 0;
datalen = 0;
@ -1493,8 +1493,8 @@ void komodo_passport_iteration()
//fprintf(stderr,"couldnt OS_fileptr(%s), freading %ldKB\n",fname,ftell(fp)/1024);
if ( ftell(fp) > lastpos[baseid] )
{
if ( ASSETCHAINS_SYMBOL[0] != 0 )
printf("%s passport refid.%d %s fname.(%s) base.%s %ld %ld\n",ASSETCHAINS_SYMBOL,refid,symbol,fname,base,ftell(fp),lastpos[baseid]);
if ( SMART_CHAIN_SYMBOL[0] != 0 )
printf("%s passport refid.%d %s fname.(%s) base.%s %ld %ld\n",SMART_CHAIN_SYMBOL,refid,symbol,fname,base,ftell(fp),lastpos[baseid]);
fseek(fp,lastpos[baseid],SEEK_SET);
while ( komodo_parsestatefile(sp,fp,symbol,dest) >= 0 && n < limit )
{
@ -1504,7 +1504,7 @@ void komodo_passport_iteration()
n = 0;
else
{
//printf("expire passport loop %s -> %s at %ld\n",ASSETCHAINS_SYMBOL,base,lastpos[baseid]);
//printf("expire passport loop %s -> %s at %ld\n",SMART_CHAIN_SYMBOL,base,lastpos[baseid]);
expired++;
}
}
@ -1512,7 +1512,7 @@ void komodo_passport_iteration()
}
lastpos[baseid] = ftell(fp);
if ( 0 && lastpos[baseid] == 0 && strcmp(symbol,"KMD") == 0 )
printf("from.(%s) lastpos[%s] %ld isrt.%d\n",ASSETCHAINS_SYMBOL,CURRENCIES[baseid],lastpos[baseid],komodo_isrealtime(&ht));
printf("from.(%s) lastpos[%s] %ld isrt.%d\n",SMART_CHAIN_SYMBOL,CURRENCIES[baseid],lastpos[baseid],komodo_isrealtime(&ht));
} //else fprintf(stderr,"%s.%ld ",CURRENCIES[baseid],ftell(fp));
fclose(fp);
} else fprintf(stderr,"load error.(%s) %p\n",fname,sp);
@ -1528,8 +1528,8 @@ void komodo_passport_iteration()
RTmask |= (1LL << baseid);
memcpy(refsp->RTbufs[baseid+1],buf,sizeof(refsp->RTbufs[baseid+1]));
}
else if ( KOMODO_PAX != 0 && (time(NULL)-buf[2]) > 60 && ASSETCHAINS_SYMBOL[0] != 0 )
fprintf(stderr,"[%s]: %s not RT %u %u %d\n",ASSETCHAINS_SYMBOL,base,buf[0],buf[1],(int32_t)(time(NULL)-buf[2]));
else if ( KOMODO_PAX != 0 && (time(NULL)-buf[2]) > 60 && SMART_CHAIN_SYMBOL[0] != 0 )
fprintf(stderr,"[%s]: %s not RT %u %u %d\n",SMART_CHAIN_SYMBOL,base,buf[0],buf[1],(int32_t)(time(NULL)-buf[2]));
} //else fprintf(stderr,"%s size error RT\n",base);
fclose(fp);
} //else fprintf(stderr,"%s open error RT\n",base);
@ -1552,7 +1552,7 @@ void komodo_passport_iteration()
memcpy(refsp->RTbufs[0],buf,sizeof(refsp->RTbufs[0]));
}
if ( fwrite(buf,1,sizeof(buf),fp) != sizeof(buf) )
fprintf(stderr,"[%s] %s error writing realtime\n",ASSETCHAINS_SYMBOL,base);
fprintf(stderr,"[%s] %s error writing realtime\n",SMART_CHAIN_SYMBOL,base);
fclose(fp);
} else fprintf(stderr,"%s create error RT\n",base);
}
@ -1564,7 +1564,7 @@ void komodo_passport_iteration()
if ( expired == 0 && KOMODO_PASSPORT_INITDONE == 0 )
{
KOMODO_PASSPORT_INITDONE = 1;
printf("READY for %s RPC calls at %u! done PASSPORT %s refid.%d\n",ASSETCHAINS_SYMBOL,(uint32_t)time(NULL),ASSETCHAINS_SYMBOL,refid);
printf("READY for %s RPC calls at %u! done PASSPORT %s refid.%d\n",SMART_CHAIN_SYMBOL,(uint32_t)time(NULL),SMART_CHAIN_SYMBOL,refid);
}
}

8
src/komodo_globals.h

@ -37,8 +37,8 @@ int32_t komodo_checkvout(int32_t vout,int32_t k,int32_t indallvouts);
pthread_mutex_t komodo_mutex,staked_mutex;
#define KOMODO_ELECTION_GAP 2000 //((ASSETCHAINS_SYMBOL[0] == 0) ? 2000 : 100)
#define KOMODO_ASSETCHAIN_MAXLEN 65
#define KOMODO_ELECTION_GAP 2000 //((SMART_CHAIN_SYMBOL[0] == 0) ? 2000 : 100)
#define HUSH_SMART_CHAIN_MAXLEN 65
struct pax_transaction *PAX;
int32_t NUM_PRICES; uint32_t *PVALS;
@ -61,7 +61,7 @@ std::vector<std::string> vWhiteListAddress;
char NOTARYADDRS[64][64];
char NOTARY_ADDRESSES[NUM_HUSH_SEASONS][64][64];
char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],ASSETCHAINS_USERPASS[4096];
char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN],ASSETCHAINS_USERPASS[4096];
uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT,ASSETCHAINS_BEAMPORT,ASSETCHAINS_CODAPORT;
uint32_t ASSETCHAIN_INIT,ASSETCHAINS_CC,KOMODO_STOPAT,KOMODO_DPOWCONFS = 1,STAKING_MIN_DIFF;
uint32_t ASSETCHAINS_MAGIC = 2387029918;
@ -142,7 +142,7 @@ uint64_t komodo_current_supply(uint32_t nHeight)
uint64_t cur_money;
int32_t baseid;
//if ( (baseid = komodo_baseid(ASSETCHAINS_SYMBOL)) >= 0 && baseid < 32 )
//if ( (baseid = komodo_baseid(SMART_CHAIN_SYMBOL)) >= 0 && baseid < 32 )
// cur_money = ASSETCHAINS_GENESISTXVAL + ASSETCHAINS_SUPPLY + nHeight * ASSETCHAINS_REWARD[0] / SATOSHIDEN;
//else
{

4
src/komodo_interest.h

@ -74,7 +74,7 @@ uint64_t komodo_earned_interest(int32_t height,int64_t paidinterest)
uint64_t komodo_moneysupply(int32_t height)
{
if ( height <= 1 || ASSETCHAINS_SYMBOL[0] == 0 )
if ( height <= 1 || SMART_CHAIN_SYMBOL[0] == 0 )
return(0);
else return(COIN * 100000000 + (height-1) * 3 + komodo_earned_interest(height,-1));
}
@ -107,7 +107,7 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin
{
int32_t minutes,exception; uint64_t interestnew,numerator,denominator,interest = 0; uint32_t activation;
activation = 1491350400; // 1491350400 5th April
if ( ASSETCHAINS_SYMBOL[0] != 0 )
if ( SMART_CHAIN_SYMBOL[0] != 0 )
return(0);
if ( txheight >= KOMODO_ENDOFERA )
return(0);

2
src/komodo_kv.h

@ -101,7 +101,7 @@ void komodo_kvupdate(uint8_t *opretbuf,int32_t opretlen,uint64_t value)
{
static uint256 zeroes;
uint32_t flags; uint256 pubkey,refpubkey,sig; int32_t i,refvaluesize,hassig,coresize,haspubkey,height,kvheight; uint16_t keylen,valuesize,newflag = 0; uint8_t *key,*valueptr,keyvalue[IGUANA_MAXSCRIPTSIZE*8]; struct komodo_kv *ptr; char *transferpubstr,*tstr; uint64_t fee;
if ( ASSETCHAINS_SYMBOL[0] == 0 ) // disable KV for KMD
if ( SMART_CHAIN_SYMBOL[0] == 0 ) // disable KV for KMD
return;
dragon_rwnum(0,&opretbuf[1],sizeof(keylen),&keylen);
dragon_rwnum(0,&opretbuf[3],sizeof(valuesize),&valuesize);

2
src/komodo_nSPV.h

@ -577,7 +577,7 @@ int32_t NSPV_notarizationextract(int32_t verifyntz,int32_t *ntzheightp,uint256 *
int32_t numsigs=0; uint8_t elected[64][33]; char *symbol; std::vector<uint8_t> opret; uint32_t nTime;
if ( tx.vout.size() >= 2 )
{
symbol = (ASSETCHAINS_SYMBOL[0] == 0) ? (char *)"KMD" : ASSETCHAINS_SYMBOL;
symbol = (SMART_CHAIN_SYMBOL[0] == 0) ? (char *)"KMD" : SMART_CHAIN_SYMBOL;
GetOpReturnData(tx.vout[1].scriptPubKey,opret);
if ( opret.size() >= 32*2+4 )
{

4
src/komodo_nSPV_fullnode.h

@ -37,7 +37,7 @@ struct NSPV_ntzargs
int32_t NSPV_notarization_find(struct NSPV_ntzargs *args,int32_t height,int32_t dir)
{
int32_t ntzheight = 0; uint256 hashBlock; CTransaction tx; Notarisation nota; char *symbol; std::vector<uint8_t> opret;
symbol = (ASSETCHAINS_SYMBOL[0] == 0) ? (char *)"KMD" : ASSETCHAINS_SYMBOL;
symbol = (SMART_CHAIN_SYMBOL[0] == 0) ? (char *)"KMD" : SMART_CHAIN_SYMBOL;
memset(args,0,sizeof(*args));
if ( dir > 0 )
height += 10;
@ -185,7 +185,7 @@ int32_t NSPV_getaddressutxos(struct NSPV_utxosresp *ptr,char *coinaddr,bool isCC
ptr->utxos[ind].vout = (int32_t)it->first.index;
ptr->utxos[ind].satoshis = it->second.satoshis;
ptr->utxos[ind].height = it->second.blockHeight;
if ( ASSETCHAINS_SYMBOL[0] == 0 && it->second.satoshis >= 10*COIN )
if ( SMART_CHAIN_SYMBOL[0] == 0 && it->second.satoshis >= 10*COIN )
{
ptr->utxos[n].extradata = komodo_accrued_interest(&txheight,&locktime,ptr->utxos[ind].txid,ptr->utxos[ind].vout,ptr->utxos[ind].height,ptr->utxos[ind].satoshis,tipheight);
interest += ptr->utxos[ind].extradata;

4
src/komodo_nSPV_superlite.h

@ -391,7 +391,7 @@ UniValue NSPV_utxoresp_json(struct NSPV_utxoresp *utxos,int32_t numutxos)
item.push_back(Pair("txid",utxos[i].txid.GetHex()));
item.push_back(Pair("vout",(int64_t)utxos[i].vout));
item.push_back(Pair("value",(double)utxos[i].satoshis/COIN));
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
item.push_back(Pair("interest",(double)utxos[i].extradata/COIN));
array.push_back(item);
}
@ -408,7 +408,7 @@ UniValue NSPV_utxosresp_json(struct NSPV_utxosresp *ptr)
result.push_back(Pair("height",(int64_t)ptr->nodeheight));
result.push_back(Pair("numutxos",(int64_t)ptr->numutxos));
result.push_back(Pair("balance",(double)ptr->total/COIN));
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
result.push_back(Pair("interest",(double)ptr->interest/COIN));
result.push_back(Pair("filter",(int64_t)ptr->filter));
result.push_back(Pair("lastpeer",NSPV_lastpeer));

6
src/komodo_nSPV_wallet.h

@ -83,7 +83,7 @@ int32_t NSPV_gettransaction(int32_t skipvalidation,int32_t vout,uint256 txid,int
retval = -2001;
else if ( skipvalidation == 0 && ptr->unspentvalue <= 0 )
retval = -2002;
else if ( ASSETCHAINS_SYMBOL[0] == 0 && tiptime != 0 )
else if ( SMART_CHAIN_SYMBOL[0] == 0 && tiptime != 0 )
{
rewards = komodo_interestnew(height,tx.vout[vout].nValue,tx.nLockTime,tiptime);
if ( rewards != extradata )
@ -388,7 +388,7 @@ UniValue NSPV_spend(char *srcaddr,char *destaddr,int64_t satoshis) // what its a
mtx.nExpiryHeight = 0;
mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID;
mtx.nVersion = SAPLING_TX_VERSION;
if ( ASSETCHAINS_SYMBOL[0] == 0 ) {
if ( SMART_CHAIN_SYMBOL[0] == 0 ) {
if ( !hush_hardfork_active((uint32_t)chainActive.LastTip()->nTime) )
mtx.nLockTime = (uint32_t)time(NULL) - 777;
else
@ -407,7 +407,7 @@ UniValue NSPV_spend(char *srcaddr,char *destaddr,int64_t satoshis) // what its a
return(result);
}
hex = NSPV_signtx(rewardsum,interestsum,retcodes,mtx,txfee,opret,used);
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
{
char numstr[64];
sprintf(numstr,"%.8f",(double)interestsum/COIN);

4
src/komodo_pax.h

@ -637,7 +637,7 @@ uint64_t komodo_paxpriceB(uint64_t seed,int32_t height,char *base,char *rel,uint
uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uint64_t basevolume)
{
int32_t i,nonz=0; int64_t diff; uint64_t price,seed,sum = 0;
if ( ASSETCHAINS_SYMBOL[0] == 0 && chainActive.LastTip() != 0 && height > chainActive.LastTip()->GetHeight() )
if ( SMART_CHAIN_SYMBOL[0] == 0 && chainActive.LastTip() != 0 && height > chainActive.LastTip()->GetHeight() )
{
if ( height < 100000000 )
{
@ -726,7 +726,7 @@ uint64_t PAX_fiatdest(uint64_t *seedp,int32_t tokomodo,char *destaddr,uint8_t pu
if ( (baseid= komodo_baseid(origbase)) < 0 || baseid == MAX_CURRENCIES )
{
if ( 0 && origbase[0] != 0 )
printf("[%s] PAX_fiatdest illegal base.(%s)\n",ASSETCHAINS_SYMBOL,origbase);
printf("[%s] PAX_fiatdest illegal base.(%s)\n",SMART_CHAIN_SYMBOL,origbase);
return(0);
}
for (i=0; i<3; i++)

6
src/komodo_structs.h

@ -46,7 +46,7 @@
#define KOMODO_KVPROTECTED 1
#define KOMODO_KVBINARY 2
#define KOMODO_KVDURATION 1440
#define KOMODO_ASSETCHAIN_MAXLEN 65
#define HUSH_SMART_CHAIN_MAXLEN 65
#ifndef _BITS256
#define _BITS256
@ -70,7 +70,7 @@ struct komodo_event
uint16_t len;
int32_t height;
uint8_t type,reorged;
char symbol[KOMODO_ASSETCHAIN_MAXLEN];
char symbol[HUSH_SMART_CHAIN_MAXLEN];
uint8_t space[];
};
@ -81,7 +81,7 @@ struct pax_transaction
uint64_t komodoshis,fiatoshis,validated;
int32_t marked,height,otherheight,approved,didstats,ready;
uint16_t vout;
char symbol[KOMODO_ASSETCHAIN_MAXLEN],source[KOMODO_ASSETCHAIN_MAXLEN],coinaddr[64]; uint8_t rmd160[20],type,buf[35];
char symbol[HUSH_SMART_CHAIN_MAXLEN],source[HUSH_SMART_CHAIN_MAXLEN],coinaddr[64]; uint8_t rmd160[20],type,buf[35];
};
struct knotary_entry { UT_hash_handle hh; uint8_t pubkey[33],notaryid; };

48
src/main.cpp

@ -114,11 +114,11 @@ bool fAlerts = DEFAULT_ALERTS;
/* If the tip is older than this (in seconds), the node is considered to be in initial block download.
*/
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE;
bool ishush3 = strncmp(ASSETCHAINS_SYMBOL, "HUSH3",5) == 0 ? true : false;
bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
int32_t nFirstHalvingHeight = 340000;
unsigned int expiryDelta = DEFAULT_TX_EXPIRY_DELTA;
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
#define ASSETCHAINS_MAX_ERAS 7
extern uint64_t ASSETCHAINS_ENDSUBSIDY[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_HALVING[ASSETCHAINS_MAX_ERAS+1];
extern uint32_t ASSETCHAINS_MAGIC;
@ -684,7 +684,7 @@ bool komodo_dailysnapshot(int32_t height)
// we are on chain init, and need to scan all the way back to the correct height, other wise our node will have a diffrent snapshot to online nodes.
// use the notarizationsDB to scan back from the consesnus height to get the offset we need.
std::string symbol; Notarisation nota;
symbol.assign(ASSETCHAINS_SYMBOL);
symbol.assign(SMART_CHAIN_SYMBOL);
if ( ScanNotarisationsDB(height-extraoffset, symbol, 100, nota) == 0 )
undo_height = height-extraoffset-reorglimit;
else undo_height = nota.second.height;
@ -1346,7 +1346,7 @@ bool CheckTransaction(uint32_t tiptime,const CTransaction& tx, CValidationState
if ( *(int32_t *)&array[0] == 0 )
numbanned = komodo_bannedset(&indallvouts,array,(int32_t)(sizeof(array)/sizeof(*array)));
n = tx.vin.size();
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
{
for (j=0; j<n; j++)
{
@ -1777,7 +1777,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
}
//fprintf(stderr,"addmempool 1\n");
auto verifier = libzcash::ProofVerifier::Strict();
if ( ASSETCHAINS_SYMBOL[0] == 0 && komodo_validate_interest(tx,chainActive.LastTip()->GetHeight()+1,chainActive.LastTip()->GetMedianTimePast() + 777,0) < 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 && komodo_validate_interest(tx,chainActive.LastTip()->GetHeight()+1,chainActive.LastTip()->GetMedianTimePast() + 777,0) < 0 )
{
fprintf(stderr,"AcceptToMemoryPool komodo_validate_interest failure\n");
return error("AcceptToMemoryPool: komodo_validate_interest failed");
@ -2728,7 +2728,7 @@ namespace Consensus {
// Check for negative or overflow input values
nValueIn += coins->vout[prevout.n].nValue;
#ifdef KOMODO_ENABLE_INTEREST
if ( ASSETCHAINS_SYMBOL[0] == 0 && nSpendHeight > 60000 )//chainActive.LastTip() != 0 && chainActive.LastTip()->GetHeight() >= 60000 )
if ( SMART_CHAIN_SYMBOL[0] == 0 && nSpendHeight > 60000 )//chainActive.LastTip() != 0 && chainActive.LastTip()->GetHeight() >= 60000 )
{
if ( coins->vout[prevout.n].nValue >= 10*COIN )
{
@ -2871,7 +2871,7 @@ bool ContextualCheckInputs(
// If prev is coinbase, check that it's matured
if (coins->IsCoinBase()) {
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
COINBASE_MATURITY = _COINBASE_MATURITY;
if (nSpendHeight - coins->nHeight < COINBASE_MATURITY) {
fprintf(stderr,"ContextualCheckInputs failure.1 i.%d of %d\n",i,(int32_t)tx.vin.size());
@ -3331,7 +3331,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
//fprintf(stderr,"connectblock ht.%d\n",(int32_t)pindex->GetHeight());
AssertLockHeld(cs_main);
bool ishush3 = strncmp(ASSETCHAINS_SYMBOL, "HUSH3",5) == 0 ? true : false;
bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
// At startup, HUSH3 doesn't know a block height yet and so we must wait until
// connecting a block to set our private/blocktime flags, which are height-dependent
@ -3681,14 +3681,14 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
fprintf(stderr,"checktoshis %.8f vs %.8f numvouts %d\n",dstr(checktoshis),dstr(block.vtx[0].vout[1].nValue),(int32_t)block.vtx[0].vout.size());
}
}
if (ASSETCHAINS_SYMBOL[0] != 0 && pindex->GetHeight() == 1 && block.vtx[0].GetValueOut() != blockReward)
if (SMART_CHAIN_SYMBOL[0] != 0 && pindex->GetHeight() == 1 && block.vtx[0].GetValueOut() != blockReward)
{
return state.DoS(100, error("ConnectBlock(): coinbase for block 1 pays wrong amount (actual=%d vs correct=%d)", block.vtx[0].GetValueOut(), blockReward),
REJECT_INVALID, "bad-cb-amount");
}
if ( block.vtx[0].GetValueOut() > blockReward+KOMODO_EXTRASATOSHI )
{
if ( ASSETCHAINS_SYMBOL[0] != 0 || pindex->GetHeight() >= KOMODO_NOTARIES_HEIGHT1 || block.vtx[0].vout[0].nValue > blockReward )
if ( SMART_CHAIN_SYMBOL[0] != 0 || pindex->GetHeight() >= KOMODO_NOTARIES_HEIGHT1 || block.vtx[0].vout[0].nValue > blockReward )
{
//fprintf(stderr, "coinbase pays too much\n");
//sleepflag = true;
@ -3938,7 +3938,7 @@ void static UpdateTip(CBlockIndex *pindexNew) {
mempool.AddTransactionsUpdated(1);
KOMODO_NEWBLOCKS++;
double progress;
if ( ASSETCHAINS_SYMBOL[0] == 0 ) {
if ( SMART_CHAIN_SYMBOL[0] == 0 ) {
progress = Checkpoints::GuessVerificationProgress(chainParams.Checkpoints(), chainActive.LastTip());
} else {
int32_t longestchain = komodo_longestchain();
@ -3975,7 +3975,7 @@ bool static DisconnectTip(CValidationState &state, bool fBare = false) {
CBlock block;
if (!ReadBlockFromDisk(block, pindexDelete,1))
return AbortNode(state, "Failed to read block");
//if ( ASSETCHAINS_SYMBOL[0] != 0 || pindexDelete->GetHeight() > 1400000 )
//if ( SMART_CHAIN_SYMBOL[0] != 0 || pindexDelete->GetHeight() > 1400000 )
{
int32_t notarizedht,prevMoMheight; uint256 notarizedhash,txid;
notarizedht = komodo_notarized_height(&prevMoMheight,&notarizedhash,&txid);
@ -4090,7 +4090,7 @@ int32_t komodo_activate_sapling(CBlockIndex *pindex)
if ( prevtime <= KOMODO_SAPLING_ACTIVATION && blocktime > KOMODO_SAPLING_ACTIVATION )
{
activation = height + 60;
fprintf(stderr,"%s transition at %d (%d, %u) -> (%d, %u)\n",ASSETCHAINS_SYMBOL,height,prevht,prevtime,height,blocktime);
fprintf(stderr,"%s transition at %d (%d, %u) -> (%d, %u)\n",SMART_CHAIN_SYMBOL,height,prevht,prevtime,height,blocktime);
}
if ( prevtime < KOMODO_SAPLING_ACTIVATION-3600*24 )
break;
@ -4102,7 +4102,7 @@ int32_t komodo_activate_sapling(CBlockIndex *pindex)
if ( activation != 0 )
{
komodo_setactivation(activation);
fprintf(stderr,"%s sapling activation at %d\n",ASSETCHAINS_SYMBOL,activation);
fprintf(stderr,"%s sapling activation at %d\n",SMART_CHAIN_SYMBOL,activation);
ASSETCHAINS_SAPLING = activation;
}
return activation;
@ -4137,7 +4137,7 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
pblock = &block;
}
KOMODO_CONNECTING = (int32_t)pindexNew->GetHeight();
//fprintf(stderr,"%s connecting ht.%d maxsize.%d vs %d\n",ASSETCHAINS_SYMBOL,(int32_t)pindexNew->GetHeight(),MAX_BLOCK_SIZE(pindexNew->GetHeight()),(int32_t)::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION));
//fprintf(stderr,"%s connecting ht.%d maxsize.%d vs %d\n",SMART_CHAIN_SYMBOL,(int32_t)pindexNew->GetHeight(),MAX_BLOCK_SIZE(pindexNew->GetHeight()),(int32_t)::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION));
// Apply the block atomically to the chain state.
int64_t nTime2 = GetTimeMicros(); nTimeReadFromDisk += nTime2 - nTime1;
@ -4205,9 +4205,9 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
HUSH_INSYNC = (int32_t)pindexNew->GetHeight();
else HUSH_INSYNC = 0;
//fprintf(stderr,"connect.%d insync.%d ASSETCHAINS_SAPLING.%d\n",(int32_t)pindexNew->GetHeight(),HUSH_INSYNC,ASSETCHAINS_SAPLING);
/*if ( HUSH_INSYNC != 0 ) //ASSETCHAINS_SYMBOL[0] == 0 &&
/*if ( HUSH_INSYNC != 0 ) //SMART_CHAIN_SYMBOL[0] == 0 &&
komodo_broadcast(pblock,8);
else if ( ASSETCHAINS_SYMBOL[0] != 0 )
else if ( SMART_CHAIN_SYMBOL[0] != 0 )
komodo_broadcast(pblock,4);*/
if ( KOMODO_NSPV_FULLNODE )
{
@ -4397,7 +4397,7 @@ static bool ActivateBestChainStep(bool fSkipdpow, CValidationState &state, CBloc
pindexMostWork->phashBlock->GetHex(), pindexMostWork->GetHeight(), pindexMostWork->chainPower.chainWork.GetHex(),
pindexMostWork->chainPower.chainStake.GetHex()) + "\n" +
"- " + strprintf(_("Fork point: %s %s, height %d"),
ASSETCHAINS_SYMBOL,pindexFork->phashBlock->GetHex(), pindexFork->GetHeight()) + "\n\n" +
SMART_CHAIN_SYMBOL,pindexFork->phashBlock->GetHex(), pindexFork->GetHeight()) + "\n\n" +
_("Please help, human!");
LogPrintf("*** %s\nif you launch with -maxreorg=%d it might be able to resolve this automatically", msg,reorgLength+10);
fprintf(stderr,"*** %s\nif you launch with -maxreorg=%d it might be able to resolve this automatically", msg.c_str(),reorgLength+10);
@ -4426,7 +4426,7 @@ static bool ActivateBestChainStep(bool fSkipdpow, CValidationState &state, CBloc
if ( !DisconnectTip(state) )
break;
}
fprintf(stderr,"reached rewind.%d, best to do: ./komodo-cli -ac_name=%s stop\n",KOMODO_REWIND,ASSETCHAINS_SYMBOL);
fprintf(stderr,"reached rewind.%d, best to do: ./komodo-cli -ac_name=%s stop\n",KOMODO_REWIND,SMART_CHAIN_SYMBOL);
sleep(20);
fprintf(stderr,"resuming normal operations\n");
KOMODO_REWIND = 0;
@ -5191,7 +5191,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
// because we receive the wrong transactions for it.
// Size limits
//fprintf(stderr,"%s checkblock %d -> %d vs blocksize.%d\n",ASSETCHAINS_SYMBOL,height,MAX_BLOCK_SIZE(height),(int32_t)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION));
//fprintf(stderr,"%s checkblock %d -> %d vs blocksize.%d\n",SMART_CHAIN_SYMBOL,height,MAX_BLOCK_SIZE(height),(int32_t)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION));
if (block.vtx.empty() || block.vtx.size() > MAX_BLOCK_SIZE(height) || ::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE(height))
return state.DoS(100, error("CheckBlock: size limits failed"),
REJECT_INVALID, "bad-blk-length");
@ -5331,7 +5331,7 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
int nHeight = pindexPrev->GetHeight()+1;
// Check proof of work
if ( (ASSETCHAINS_SYMBOL[0] != 0 || nHeight < 235300 || nHeight > 236000) && block.nBits != GetNextWorkRequired(pindexPrev, &block, consensusParams))
if ( (SMART_CHAIN_SYMBOL[0] != 0 || nHeight < 235300 || nHeight > 236000) && block.nBits != GetNextWorkRequired(pindexPrev, &block, consensusParams))
{
cout << block.nBits << " block.nBits vs. calc " << GetNextWorkRequired(pindexPrev, &block, consensusParams) <<
" for block #" << nHeight << endl;
@ -5819,7 +5819,7 @@ bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNo
CheckBlockIndex();
if (!ret && futureblock == 0)
{
/*if ( ASSETCHAINS_SYMBOL[0] == 0 )
/*if ( SMART_CHAIN_SYMBOL[0] == 0 )
{
//fprintf(stderr,"request headers from failed process block peer\n");
pfrom->PushMessage("getheaders", chainActive.GetLocator(chainActive.LastTip()), uint256());
@ -6306,7 +6306,7 @@ bool static LoadBlockIndexDB()
PruneBlockIndexCandidates();
double progress;
if ( ASSETCHAINS_SYMBOL[0] == 0 ) {
if ( SMART_CHAIN_SYMBOL[0] == 0 ) {
progress = Checkpoints::GuessVerificationProgress(chainparams.Checkpoints(), chainActive.LastTip());
} else {
int32_t longestchain = komodo_longestchain();
@ -6611,7 +6611,7 @@ bool LoadBlockIndex()
KOMODO_LOADINGBLOCKS = 0;
return false;
}
fprintf(stderr,"finished loading blocks %s\n",ASSETCHAINS_SYMBOL);
fprintf(stderr,"finished loading blocks %s\n",SMART_CHAIN_SYMBOL);
return true;
}

62
src/miner.cpp

@ -297,7 +297,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
//if ( KOMODO_VALUETOOBIG(txvalue + voutsum) != 0 ) // has been commented from main.cpp ?
// continue;
//voutsum += txvalue;
if ( ASSETCHAINS_SYMBOL[0] == 0 && komodo_validate_interest(tx,nHeight,(uint32_t)pblock->nTime,0) < 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 && komodo_validate_interest(tx,nHeight,(uint32_t)pblock->nTime,0) < 0 )
{
//fprintf(stderr,"CreateNewBlock: komodo_validate_interest failure nHeight.%d nTime.%u vs locktime.%u\n",nHeight,(uint32_t)pblock->nTime,(uint32_t)tx.nLockTime);
continue;
@ -626,11 +626,11 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
else txNew.nLockTime = std::max((int64_t)(pindexPrev->nTime+1), GetTime());
if ( ASSETCHAINS_SYMBOL[0] == 0 && IS_HUSH_NOTARY != 0 && My_notaryid >= 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 && IS_HUSH_NOTARY != 0 && My_notaryid >= 0 )
txNew.vout[0].nValue += 5000;
pblock->vtx[0] = txNew;
if ( nHeight > 1 && ASSETCHAINS_SYMBOL[0] != 0 && (ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 || ASSETCHAINS_SCRIPTPUB.size() > 1) && (ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_FOUNDERS_REWARD != 0) && (commission= komodo_commission((CBlock*)&pblocktemplate->block,(int32_t)nHeight)) != 0 )
if ( nHeight > 1 && SMART_CHAIN_SYMBOL[0] != 0 && (ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 || ASSETCHAINS_SCRIPTPUB.size() > 1) && (ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_FOUNDERS_REWARD != 0) && (commission= komodo_commission((CBlock*)&pblocktemplate->block,(int32_t)nHeight)) != 0 )
{
int32_t i; uint8_t *ptr;
txNew.vout.resize(2);
@ -684,7 +684,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
if ( totalsats == 0 )
{
fprintf(stderr, "Could not create notary payment, trying again.\n");
if ( ASSETCHAINS_SYMBOL[0] == 0 || (ASSETCHAINS_SYMBOL[0] != 0 && !isStake) )
if ( SMART_CHAIN_SYMBOL[0] == 0 || (SMART_CHAIN_SYMBOL[0] != 0 && !isStake) )
{
LEAVE_CRITICAL_SECTION(cs_main);
LEAVE_CRITICAL_SECTION(mempool.cs);
@ -722,14 +722,14 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
pblock->hashFinalSaplingRoot = sapling_tree.root();
// all PoS chains need this data in the block at all times
if ( ASSETCHAINS_LWMAPOS || ASSETCHAINS_SYMBOL[0] == 0 || ASSETCHAINS_STAKED == 0 || KOMODO_MININGTHREADS > 0 )
if ( ASSETCHAINS_LWMAPOS || SMART_CHAIN_SYMBOL[0] == 0 || ASSETCHAINS_STAKED == 0 || KOMODO_MININGTHREADS > 0 )
{
UpdateTime(pblock, Params().GetConsensus(), pindexPrev);
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
}
pblock->nSolution.clear();
pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]);
if ( ASSETCHAINS_SYMBOL[0] == 0 && IS_HUSH_NOTARY != 0 && My_notaryid >= 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 && IS_HUSH_NOTARY != 0 && My_notaryid >= 0 )
{
uint32_t r; CScript opret; void **ptr=0;
@ -760,7 +760,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
else
{
fprintf(stderr,"error adding notaryvin, need to create 0.0001 utxos\n");
if ( ASSETCHAINS_SYMBOL[0] == 0 || (ASSETCHAINS_SYMBOL[0] != 0 && !isStake) )
if ( SMART_CHAIN_SYMBOL[0] == 0 || (SMART_CHAIN_SYMBOL[0] != 0 && !isStake) )
{
LEAVE_CRITICAL_SECTION(cs_main);
LEAVE_CRITICAL_SECTION(mempool.cs);
@ -768,13 +768,13 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
return(0);
}
}
else if ( ASSETCHAINS_CC == 0 && pindexPrev != 0 && ASSETCHAINS_STAKED == 0 && (ASSETCHAINS_SYMBOL[0] != 0 || IS_HUSH_NOTARY == 0 || My_notaryid < 0) )
else if ( ASSETCHAINS_CC == 0 && pindexPrev != 0 && ASSETCHAINS_STAKED == 0 && (SMART_CHAIN_SYMBOL[0] != 0 || IS_HUSH_NOTARY == 0 || My_notaryid < 0) )
{
CValidationState state;
//fprintf(stderr,"check validity\n");
if ( !TestBlockValidity(state, *pblock, pindexPrev, false, false)) // invokes CC checks
{
if ( ASSETCHAINS_SYMBOL[0] == 0 || (ASSETCHAINS_SYMBOL[0] != 0 && !isStake) )
if ( SMART_CHAIN_SYMBOL[0] == 0 || (SMART_CHAIN_SYMBOL[0] != 0 && !isStake) )
{
LEAVE_CRITICAL_SECTION(cs_main);
LEAVE_CRITICAL_SECTION(mempool.cs);
@ -785,7 +785,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
//fprintf(stderr,"valid\n");
}
}
if ( ASSETCHAINS_SYMBOL[0] == 0 || (ASSETCHAINS_SYMBOL[0] != 0 && !isStake) )
if ( SMART_CHAIN_SYMBOL[0] == 0 || (SMART_CHAIN_SYMBOL[0] != 0 && !isStake) )
{
LEAVE_CRITICAL_SECTION(cs_main);
LEAVE_CRITICAL_SECTION(mempool.cs);
@ -1113,10 +1113,10 @@ void static BitcoinMiner()
while ( (ASSETCHAIN_INIT == 0 || HUSH_INITDONE == 0) )
{
sleep(1);
if ( komodo_baseid(ASSETCHAINS_SYMBOL) < 0 )
if ( komodo_baseid(SMART_CHAIN_SYMBOL) < 0 )
break;
}
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
komodo_chosennotary(&notaryid,chainActive.LastTip()->GetHeight(),NOTARY_PUBKEY33,(uint32_t)chainActive.LastTip()->GetBlockTime());
if ( notaryid != My_notaryid )
My_notaryid = notaryid;
@ -1127,8 +1127,8 @@ void static BitcoinMiner()
solver = "default";
assert(solver == "tromp" || solver == "default");
LogPrint("pow", "Using Equihash solver \"%s\" with n = %u, k = %u\n", solver, n, k);
if ( ASSETCHAINS_SYMBOL[0] != 0 )
fprintf(stderr,"notaryid.%d Mining.%s with %s\n",notaryid,ASSETCHAINS_SYMBOL,solver.c_str());
if ( SMART_CHAIN_SYMBOL[0] != 0 )
fprintf(stderr,"notaryid.%d Mining.%s with %s\n",notaryid,SMART_CHAIN_SYMBOL,solver.c_str());
std::mutex m_cs;
bool cancelSolver = false;
boost::signals2::connection c = uiInterface.NotifyBlockTip.connect(
@ -1140,8 +1140,8 @@ void static BitcoinMiner()
miningTimer.start();
try {
if ( ASSETCHAINS_SYMBOL[0] != 0 )
fprintf(stderr,"try %s Mining with %s\n",ASSETCHAINS_SYMBOL,solver.c_str());
if ( SMART_CHAIN_SYMBOL[0] != 0 )
fprintf(stderr,"try %s Mining with %s\n",SMART_CHAIN_SYMBOL,solver.c_str());
while (true)
{
if (chainparams.MiningRequiresPeers()) //chainActive.LastTip()->GetHeight() != 235300 &&
@ -1160,10 +1160,10 @@ void static BitcoinMiner()
if (!fvNodesEmpty )//&& !IsInitialBlockDownload())
break;
MilliSleep(15000);
//fprintf(stderr,"fvNodesEmpty %d IsInitialBlockDownload(%s) %d\n",(int32_t)fvNodesEmpty,ASSETCHAINS_SYMBOL,(int32_t)IsInitialBlockDownload());
//fprintf(stderr,"fvNodesEmpty %d IsInitialBlockDownload(%s) %d\n",(int32_t)fvNodesEmpty,SMART_CHAIN_SYMBOL,(int32_t)IsInitialBlockDownload());
} while (true);
//fprintf(stderr,"%s Found peers\n",ASSETCHAINS_SYMBOL);
//fprintf(stderr,"%s Found peers\n",SMART_CHAIN_SYMBOL);
miningTimer.start();
}
//
@ -1176,9 +1176,9 @@ void static BitcoinMiner()
Mining_height = pindexPrev->GetHeight()+1;
Mining_start = (uint32_t)time(NULL);
}
if ( ASSETCHAINS_SYMBOL[0] != 0 && ASSETCHAINS_STAKED == 0 )
if ( SMART_CHAIN_SYMBOL[0] != 0 && ASSETCHAINS_STAKED == 0 )
{
//fprintf(stderr,"%s create new block ht.%d\n",ASSETCHAINS_SYMBOL,Mining_height);
//fprintf(stderr,"%s create new block ht.%d\n",SMART_CHAIN_SYMBOL,Mining_height);
//sleep(3);
}
@ -1216,7 +1216,7 @@ void static BitcoinMiner()
return;
}
CBlock *pblock = &pblocktemplate->block;
if ( ASSETCHAINS_SYMBOL[0] != 0 )
if ( SMART_CHAIN_SYMBOL[0] != 0 )
{
if ( ASSETCHAINS_REWARD[0] == 0 && !ASSETCHAINS_LASTERA )
{
@ -1224,10 +1224,10 @@ void static BitcoinMiner()
{
static uint32_t counter;
if ( counter++ < 10 )
fprintf(stderr,"skip generating %s on-demand block, no tx avail\n",ASSETCHAINS_SYMBOL);
fprintf(stderr,"skip generating %s on-demand block, no tx avail\n",SMART_CHAIN_SYMBOL);
sleep(10);
continue;
} else fprintf(stderr,"%s vouts.%d mining.%d vs %d\n",ASSETCHAINS_SYMBOL,(int32_t)pblock->vtx[0].vout.size(),Mining_height,ASSETCHAINS_MINHEIGHT);
} else fprintf(stderr,"%s vouts.%d mining.%d vs %d\n",SMART_CHAIN_SYMBOL,(int32_t)pblock->vtx[0].vout.size(),Mining_height,ASSETCHAINS_MINHEIGHT);
}
}
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
@ -1241,7 +1241,7 @@ void static BitcoinMiner()
savebits = pblock->nBits;
HASHTarget = arith_uint256().SetCompact(savebits);
roundrobin_delay = ROUNDROBIN_DELAY;
if ( ASSETCHAINS_SYMBOL[0] == 0 && notaryid >= 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 && notaryid >= 0 )
{
j = 65;
if ( (Mining_height >= 235300 && Mining_height < 236000) || (Mining_height % KOMODO_ELECTION_GAP) > 64 || (Mining_height % KOMODO_ELECTION_GAP) == 0 || Mining_height > 1000000 )
@ -1292,7 +1292,7 @@ void static BitcoinMiner()
if ( (Mining_height >= 235300 && Mining_height < 236000) || (j == 65 && Mining_height > KOMODO_MAYBEMINED+1 && Mining_height > KOMODO_LASTMINED+64) )
{
HASHTarget = arith_uint256().SetCompact(KOMODO_MINDIFF_NBITS);
fprintf(stderr,"I am the chosen one for %s ht.%d\n",ASSETCHAINS_SYMBOL,pindexPrev->GetHeight()+1);
fprintf(stderr,"I am the chosen one for %s ht.%d\n",SMART_CHAIN_SYMBOL,pindexPrev->GetHeight()+1);
} //else fprintf(stderr,"duplicate at j.%d\n",j);
} else Mining_start = 0;
} else Mining_start = 0;
@ -1393,7 +1393,7 @@ void static BitcoinMiner()
uint256 tmp = B.GetHash();
int32_t z; for (z=31; z>=0; z--)
fprintf(stderr,"%02x",((uint8_t *)&tmp)[z]);
fprintf(stderr," mined %s block %d!\n",ASSETCHAINS_SYMBOL,Mining_height);
fprintf(stderr," mined %s block %d!\n",SMART_CHAIN_SYMBOL,Mining_height);
}
CValidationState state;
if ( !TestBlockValidity(state,B, chainActive.LastTip(), true, false))
@ -1475,7 +1475,7 @@ void static BitcoinMiner()
int32_t i; uint256 hash = pblock->GetHash();
//for (i=0; i<32; i++)
// fprintf(stderr,"%02x",((uint8_t *)&hash)[i]);
//fprintf(stderr," <- %s Block found %d\n",ASSETCHAINS_SYMBOL,Mining_height);
//fprintf(stderr," <- %s Block found %d\n",SMART_CHAIN_SYMBOL,Mining_height);
//FOUND_BLOCK = 1;
//KOMODO_MAYBEMINED = Mining_height;
break;
@ -1498,7 +1498,7 @@ void static BitcoinMiner()
} */
if (vNodes.empty() && chainparams.MiningRequiresPeers())
{
if ( ASSETCHAINS_SYMBOL[0] == 0 || Mining_height > ASSETCHAINS_MINHEIGHT )
if ( SMART_CHAIN_SYMBOL[0] == 0 || Mining_height > ASSETCHAINS_MINHEIGHT )
{
fprintf(stderr,"no nodes, break\n");
break;
@ -1506,19 +1506,19 @@ void static BitcoinMiner()
}
if ((UintToArith256(pblock->nNonce) & 0xffff) == 0xffff)
{
//if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
//if ( 0 && SMART_CHAIN_SYMBOL[0] != 0 )
fprintf(stderr,"0xffff, break\n");
break;
}
if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast && GetTime() - nStart > 60)
{
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
if ( 0 && SMART_CHAIN_SYMBOL[0] != 0 )
fprintf(stderr,"timeout, break\n");
break;
}
if ( pindexPrev != chainActive.LastTip() )
{
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
if ( 0 && SMART_CHAIN_SYMBOL[0] != 0 )
fprintf(stderr,"Tip advanced, break\n");
break;
}

2
src/net.cpp

@ -94,7 +94,7 @@ namespace {
// Global state variables
//
extern uint16_t ASSETCHAINS_P2PPORT;
extern char ASSETCHAINS_SYMBOL[65];
extern char SMART_CHAIN_SYMBOL[65];
bool fDiscover = true;
bool fListen = true;

4
src/policy/fees.cpp

@ -68,13 +68,13 @@ void TxConfirmStats::ClearCurrent(unsigned int nBlockHeight)
unsigned int TxConfirmStats::FindBucketIndex(double val)
{
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
auto it = bucketMap.lower_bound(val);
if ( it != bucketMap.end() )
{
//static uint32_t counter;
//if ( counter++ < 1 )
// fprintf(stderr,"%s FindBucketIndex violation: from val %f\n",ASSETCHAINS_SYMBOL,val);
// fprintf(stderr,"%s FindBucketIndex violation: from val %f\n",SMART_CHAIN_SYMBOL,val);
}
return it->second;
}

6
src/pow.cpp

@ -657,7 +657,7 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
bool komodo_checkopret(CBlock *pblock, CScript &merkleroot);
CScript komodo_makeopret(CBlock *pblock, bool fNew);
extern int32_t KOMODO_CHOSEN_ONE;
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
#define KOMODO_ELECTION_GAP 2000
int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t blocktimes[66],int32_t *nonzpkeysp,int32_t height);
@ -683,7 +683,7 @@ bool CheckProofOfWork(const CBlockHeader &blkHeader, uint8_t *pubkey33, int32_t
height = komodo_currentheight() + 1;
//fprintf(stderr,"set height to %d\n",height);
}
if ( height > 34000 && ASSETCHAINS_SYMBOL[0] == 0 ) // 0 -> non-special notary
if ( height > 34000 && SMART_CHAIN_SYMBOL[0] == 0 ) // 0 -> non-special notary
{
special = komodo_chosennotary(&notaryid,height,pubkey33,tiptime);
for (i=0; i<33; i++)
@ -736,7 +736,7 @@ bool CheckProofOfWork(const CBlockHeader &blkHeader, uint8_t *pubkey33, int32_t
if ( KOMODO_LOADINGBLOCKS != 0 )
return true;
if ( ASSETCHAINS_SYMBOL[0] != 0 || height > 792000 )
if ( SMART_CHAIN_SYMBOL[0] != 0 || height > 792000 )
{
//if ( 0 && height > 792000 )
if ( Params().NetworkIDString() != "regtest" )

6
src/rpc/blockchain.cpp

@ -892,7 +892,7 @@ UniValue kvsearch(const UniValue& params, bool fHelp, const CPubKey& mypk)
LOCK(cs_main);
if ( (keylen= (int32_t)strlen(params[0].get_str().c_str())) > 0 )
{
ret.push_back(Pair("coin",(char *)(ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL)));
ret.push_back(Pair("coin",(char *)(SMART_CHAIN_SYMBOL[0] == 0 ? "HUSH" : SMART_CHAIN_SYMBOL)));
ret.push_back(Pair("currentheight", (int64_t)chainActive.LastTip()->GetHeight()));
ret.push_back(Pair("key",params[0].get_str()));
ret.push_back(Pair("keylen",keylen));
@ -1596,7 +1596,7 @@ void NetworkUpgradeDescPushBack(
UniValue getblockchaininfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
uint256 notarized_hash,notarized_desttxid; int32_t prevMoMheight,notarized_height,longestchain,kmdnotarized_height,txid_height;
uint256 notarized_hash,notarized_desttxid; int32_t prevMoMheight,notarized_height,longestchain,hushnotarized_height,txid_height;
if (fHelp || params.size() != 0)
throw runtime_error(
"getblockchaininfo\n"
@ -1648,7 +1648,7 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp, const CPubKey& my
LOCK(cs_main);
double progress;
if ( ASSETCHAINS_SYMBOL[0] == 0 ) {
if ( SMART_CHAIN_SYMBOL[0] == 0 ) {
progress = Checkpoints::GuessVerificationProgress(Params().Checkpoints(), chainActive.LastTip());
} else {
int32_t longestchain = KOMODO_LONGESTCHAIN;//komodo_longestchain();

38
src/rpc/crosschain.cpp

@ -109,7 +109,7 @@ UniValue height_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk)
}
//fprintf(stderr,"height_MoM height.%d\n",height);
depth = komodo_MoM(&notarized_height,&MoM,&kmdtxid,height,&MoMoM,&MoMoMoffset,&MoMoMdepth,&kmdstarti,&kmdendi);
ret.push_back(Pair("coin",(char *)(ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL)));
ret.push_back(Pair("coin",(char *)(SMART_CHAIN_SYMBOL[0] == 0 ? "HUSH" : SMART_CHAIN_SYMBOL)));
ret.push_back(Pair("height",height));
ret.push_back(Pair("timestamp",(uint64_t)timestamp));
if ( depth > 0 )
@ -118,7 +118,7 @@ UniValue height_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk)
ret.push_back(Pair("notarized_height",notarized_height));
ret.push_back(Pair("MoM",MoM.GetHex()));
ret.push_back(Pair("kmdtxid",kmdtxid.GetHex()));
if ( ASSETCHAINS_SYMBOL[0] != 0 )
if ( SMART_CHAIN_SYMBOL[0] != 0 )
{
ret.push_back(Pair("MoMoM",MoMoM.GetHex()));
ret.push_back(Pair("MoMoMoffset",MoMoMoffset));
@ -170,7 +170,7 @@ UniValue calc_MoM(const UniValue& params, bool fHelp, const CPubKey& mypk)
throw runtime_error("calc_MoM illegal height or MoMdepth\n");
//fprintf(stderr,"height_MoM height.%d\n",height);
MoM = komodo_calcMoM(height,MoMdepth);
ret.push_back(Pair("coin",(char *)(ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL)));
ret.push_back(Pair("coin",(char *)(SMART_CHAIN_SYMBOL[0] == 0 ? "HUSH" : SMART_CHAIN_SYMBOL)));
ret.push_back(Pair("height",height));
ret.push_back(Pair("MoMdepth",MoMdepth));
ret.push_back(Pair("MoM",MoM.GetHex()));
@ -195,7 +195,7 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp, const CPubK
if (ASSETCHAINS_CC < KOMODO_FIRSTFUNGIBLEID)
throw runtime_error("-ac_cc < KOMODO_FIRSTFUNGIBLEID");
if (ASSETCHAINS_SYMBOL[0] == 0)
if (SMART_CHAIN_SYMBOL[0] == 0)
throw runtime_error("Must be called on assetchain");
vector<uint8_t> txData(ParseHexV(params[0], "argument 1"));
@ -207,7 +207,7 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp, const CPubK
if (targetSymbol.size() == 0 || targetSymbol.size() > 32)
throw runtime_error("targetSymbol length must be >0 and <=32");
if (strcmp(ASSETCHAINS_SYMBOL,targetSymbol.c_str()) == 0)
if (strcmp(SMART_CHAIN_SYMBOL,targetSymbol.c_str()) == 0)
throw runtime_error("cant send a coin to the same chain");
/// Tested 44 vins p2pkh inputs as working. Set this at 25, but its a tx size limit.
@ -226,11 +226,11 @@ UniValue migrate_converttoexport(const UniValue& params, bool fHelp, const CPubK
throw JSONRPCError(RPC_TYPE_ERROR, "Cannot export more than 1 million coins per export.");
/* note: we marshal to rawproof in a different way (to be able to add other objects)
rawproof.resize(strlen(ASSETCHAINS_SYMBOL));
rawproof.resize(strlen(SMART_CHAIN_SYMBOL));
ptr = rawproof.data();
for (i=0; i<rawproof.size(); i++)
ptr[i] = ASSETCHAINS_SYMBOL[i]; */
const std::string chainSymbol(ASSETCHAINS_SYMBOL);
ptr[i] = SMART_CHAIN_SYMBOL[i]; */
const std::string chainSymbol(SMART_CHAIN_SYMBOL);
rawproof = E_MARSHAL(ss << chainSymbol); // add src chain name
CTxOut burnOut = MakeBurnOutput(burnAmount+txfee, ccid, targetSymbol, tx.vout,rawproof);
@ -269,7 +269,7 @@ UniValue migrate_createburntransaction(const UniValue& params, bool fHelp, const
if (ASSETCHAINS_CC < KOMODO_FIRSTFUNGIBLEID)
throw runtime_error("-ac_cc < KOMODO_FIRSTFUNGIBLEID");
if (ASSETCHAINS_SYMBOL[0] == 0)
if (SMART_CHAIN_SYMBOL[0] == 0)
throw runtime_error("Must be called on assetchain");
// if -pubkey not set it sends change to null pubkey.
@ -281,7 +281,7 @@ UniValue migrate_createburntransaction(const UniValue& params, bool fHelp, const
if (targetSymbol.size() == 0 || targetSymbol.size() > 32)
throw runtime_error("targetSymbol length must be >0 and <=32");
if (strcmp(ASSETCHAINS_SYMBOL, targetSymbol.c_str()) == 0)
if (strcmp(SMART_CHAIN_SYMBOL, targetSymbol.c_str()) == 0)
throw runtime_error("cant send a coin to the same chain");
std::string dest_addr_or_pubkey = params[1].get_str();
@ -307,7 +307,7 @@ UniValue migrate_createburntransaction(const UniValue& params, bool fHelp, const
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
const std::string chainSymbol(ASSETCHAINS_SYMBOL);
const std::string chainSymbol(SMART_CHAIN_SYMBOL);
std::vector<uint8_t> rawproof; //(chainSymbol.begin(), chainSymbol.end());
if (tokenid.IsNull()) { // coins
@ -502,13 +502,13 @@ void CheckBurnTxSource(uint256 burntxid, UniValue &info) {
throw std::runtime_error("No opreturn in burn tx");
if (sourceSymbol != ASSETCHAINS_SYMBOL)
if (sourceSymbol != SMART_CHAIN_SYMBOL)
throw std::runtime_error("Incorrect source chain in rawproof");
if (targetCCid != ASSETCHAINS_CC)
throw std::runtime_error("Incorrect CCid in burn tx");
if (targetSymbol == ASSETCHAINS_SYMBOL)
if (targetSymbol == SMART_CHAIN_SYMBOL)
throw std::runtime_error("Must not be called on the destination chain");
// fill info to return for the notary operator (if manual notarization) or user
@ -548,7 +548,7 @@ UniValue migrate_createimporttransaction(const UniValue& params, bool fHelp, con
if (ASSETCHAINS_CC < KOMODO_FIRSTFUNGIBLEID)
throw runtime_error("-ac_cc < KOMODO_FIRSTFUNGIBLEID");
if (ASSETCHAINS_SYMBOL[0] == 0)
if (SMART_CHAIN_SYMBOL[0] == 0)
throw runtime_error("Must be called on assetchain");
vector<uint8_t> txData(ParseHexV(params[0], "argument 1"));
@ -602,10 +602,10 @@ UniValue migrate_completeimporttransaction(const UniValue& params, bool fHelp, c
throw runtime_error("migrate_completeimporttransaction importTx [offset]\n\n"
"Takes a cross chain import tx with proof generated on assetchain "
"and extends proof to target chain proof root\n"
"offset is optional, use it to increase the used KMD height, use when import fails.");
"offset is optional, use it to increase the used HUSH height, use when import fails.");
if (ASSETCHAINS_SYMBOL[0] != 0)
throw runtime_error("Must be called on KMD");
if (SMART_CHAIN_SYMBOL[0] != 0)
throw runtime_error("Must be called on HUSH");
CTransaction importTx;
if (!E_UNMARSHAL(ParseHexV(params[0], "argument 1"), ss >> importTx))
@ -644,7 +644,7 @@ UniValue migrate_checkburntransactionsource(const UniValue& params, bool fHelp,
throw runtime_error("migrate_checkburntransactionsource burntxid\n\n"
"checks if params stored in the burn tx match to its tx chain");
if (ASSETCHAINS_SYMBOL[0] == 0)
if (SMART_CHAIN_SYMBOL[0] == 0)
throw runtime_error("Must be called on asset chain");
uint256 burntxid = Parseuint256(params[0].get_str().c_str());
@ -672,7 +672,7 @@ UniValue migrate_createnotaryapprovaltransaction(const UniValue& params, bool fH
"Creates a tx for destination chain with burn tx proof\n"
"txoutproof should be retrieved by komodo-cli migrate_checkburntransactionsource call on the source chain\n" );
if (ASSETCHAINS_SYMBOL[0] == 0)
if (SMART_CHAIN_SYMBOL[0] == 0)
throw runtime_error("Must be called on asset chain");
uint256 burntxid = Parseuint256(params[0].get_str().c_str());

2
src/rpc/mining.cpp

@ -388,7 +388,7 @@ UniValue genminingCSV(const UniValue& params, bool fHelp, const CPubKey& mypk)
if (fHelp || params.size() != 0 )
throw runtime_error("genminingCSV\n");
LOCK(cs_main);
sprintf(fname,"%s_mining.csv",ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL);
sprintf(fname,"%s_mining.csv",SMART_CHAIN_SYMBOL[0] == 0 ? "HUSH" : SMART_CHAIN_SYMBOL);
if ( (fp= fopen(fname,"wb")) != 0 )
{
fprintf(fp,"height,nTime,nBits,bnTarget,bnTargetB,diff,solvetime\n");

27
src/rpc/misc.cpp

@ -67,14 +67,14 @@ uint32_t komodo_chainactive_timestamp();
int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp);
extern uint64_t KOMODO_INTERESTSUM,KOMODO_WALLETBALANCE;
extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE,KOMODO_LONGESTCHAIN,IS_HUSH_NOTARY,HUSH_INSYNC;
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
uint32_t komodo_segid32(char *coinaddr);
int64_t komodo_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height);
int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heightp);
int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *hushnotarized_heightp);
uint64_t komodo_notarypayamount(int32_t nHeight, int64_t notarycount);
int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
// This is the last version of KMD upstream that was merged in
// This is the last version of upstream that was merged in
// We only cherry-pick since then
#define KOMODO_VERSION "0.5.0"
extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
@ -187,7 +187,7 @@ UniValue geterablockheights(const UniValue& params, bool fHelp, const CPubKey& m
UniValue getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
uint256 notarized_hash,notarized_desttxid; int32_t prevMoMheight,notarized_height,longestchain,kmdnotarized_height,txid_height;
uint256 notarized_hash,notarized_desttxid; int32_t prevMoMheight,notarized_height,longestchain,hushnotarized_height,txid_height;
if (fHelp || params.size() != 0)
throw runtime_error(
"getinfo\n"
@ -241,18 +241,19 @@ UniValue getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
obj.push_back(Pair("notarizedtxid", notarized_desttxid.ToString()));
if ( KOMODO_NSPV_FULLNODE )
{
txid_height = notarizedtxid_height(ASSETCHAINS_SYMBOL[0] != 0 ? (char *)"KMD" : (char *)"BTC",(char *)notarized_desttxid.ToString().c_str(),&kmdnotarized_height);
txid_height = notarizedtxid_height(SMART_CHAIN_SYMBOL[0] != 0 ? (char *)"HUSH" : (char *)"BTC",(char *)notarized_desttxid.ToString().c_str(),&hushnotarized_height);
if ( txid_height > 0 )
obj.push_back(Pair("notarizedtxid_height", txid_height));
else obj.push_back(Pair("notarizedtxid_height", "mempool"));
if ( ASSETCHAINS_SYMBOL[0] != 0 )
obj.push_back(Pair("KMDnotarized_height", kmdnotarized_height));
obj.push_back(Pair("notarized_confirms", txid_height < kmdnotarized_height ? (kmdnotarized_height - txid_height + 1) : 0));
if ( SMART_CHAIN_SYMBOL[0] != 0 ) {
obj.push_back(Pair("HUSHnotarized_height", hushnotarized_height));
}
obj.push_back(Pair("notarized_confirms", txid_height < hushnotarized_height ? (hushnotarized_height - txid_height + 1) : 0));
//fprintf(stderr,"after notarized_confirms %u\n",(uint32_t)time(NULL));
#ifdef ENABLE_WALLET
if (pwalletMain) {
obj.push_back(Pair("walletversion", pwalletMain->GetVersion()));
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
{
obj.push_back(Pair("interest", ValueFromAmount(KOMODO_INTERESTSUM)));
obj.push_back(Pair("balance", ValueFromAmount(KOMODO_WALLETBALANCE))); //pwalletMain->GetBalance()
@ -301,13 +302,13 @@ UniValue getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
}
if ( ASSETCHAINS_CC != 0 )
obj.push_back(Pair("CCid", (int)ASSETCHAINS_CC));
obj.push_back(Pair("name", ASSETCHAINS_SYMBOL[0] == 0 ? "HUSH" : ASSETCHAINS_SYMBOL));
obj.push_back(Pair("name", SMART_CHAIN_SYMBOL[0] == 0 ? "HUSH" : SMART_CHAIN_SYMBOL));
obj.push_back(Pair("p2pport", ASSETCHAINS_P2PPORT));
obj.push_back(Pair("rpcport", ASSETCHAINS_RPCPORT));
if ( ASSETCHAINS_SYMBOL[0] != 0 )
if ( SMART_CHAIN_SYMBOL[0] != 0 )
{
//obj.push_back(Pair("name", ASSETCHAINS_SYMBOL));
//obj.push_back(Pair("name", SMART_CHAIN_SYMBOL));
obj.push_back(Pair("magic", (int)ASSETCHAINS_MAGIC));
obj.push_back(Pair("premine", ASSETCHAINS_SUPPLY));
@ -434,7 +435,7 @@ UniValue coinsupply(const UniValue& params, bool fHelp, const CPubKey& mypk)
if ( (supply= komodo_coinsupply(&zfunds,&sproutfunds,height)) > 0 )
{
result.push_back(Pair("result", "success"));
result.push_back(Pair("coin", ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL));
result.push_back(Pair("coin", SMART_CHAIN_SYMBOL[0] == 0 ? "HUSH" : SMART_CHAIN_SYMBOL));
result.push_back(Pair("height", (int)height));
result.push_back(Pair("supply", ValueFromAmount(supply)));
result.push_back(Pair("zfunds", ValueFromAmount(zfunds)));

2
src/rpc/net.cpp

@ -217,7 +217,7 @@ int32_t komodo_longestchain()
if ( num > (n >> 1) )
{
if ( 0 && height != KOMODO_LONGESTCHAIN )
fprintf(stderr,"set %s KOMODO_LONGESTCHAIN <- %d\n",ASSETCHAINS_SYMBOL,height);
fprintf(stderr,"set %s KOMODO_LONGESTCHAIN <- %d\n",SMART_CHAIN_SYMBOL,height);
KOMODO_LONGESTCHAIN = height;
return(height);
}

6
src/rpc/rawtransaction.cpp

@ -56,7 +56,7 @@ int32_t komodo_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *
using namespace std;
extern char ASSETCHAINS_SYMBOL[];
extern char SMART_CHAIN_SYMBOL[];
int32_t hush_dpowconfs(int32_t height,int32_t numconfs);
void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex)
@ -217,7 +217,7 @@ void TxToJSONExpanded(const CTransaction& tx, const uint256 hashBlock, UniValue&
const CTxOut& txout = tx.vout[i];
UniValue out(UniValue::VOBJ);
out.push_back(Pair("value", ValueFromAmount(txout.nValue)));
if ( ASSETCHAINS_SYMBOL[0] == 0 && pindex != 0 && tx.nLockTime >= 500000000 && (tipindex= chainActive.LastTip()) != 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 && pindex != 0 && tx.nLockTime >= 500000000 && (tipindex= chainActive.LastTip()) != 0 )
{
int64_t interest; int32_t txheight; uint32_t locktime;
interest = komodo_accrued_interest(&txheight,&locktime,tx.GetHash(),i,0,txout.nValue,(int32_t)tipindex->GetHeight());
@ -316,7 +316,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
const CTxOut& txout = tx.vout[i];
UniValue out(UniValue::VOBJ);
out.push_back(Pair("value", ValueFromAmount(txout.nValue)));
if ( KOMODO_NSPV_FULLNODE && ASSETCHAINS_SYMBOL[0] == 0 && tx.nLockTime >= 500000000 && (tipindex= chainActive.LastTip()) != 0 )
if ( KOMODO_NSPV_FULLNODE && SMART_CHAIN_SYMBOL[0] == 0 && tx.nLockTime >= 500000000 && (tipindex= chainActive.LastTip()) != 0 )
{
int64_t interest; int32_t txheight; uint32_t locktime;
interest = komodo_accrued_interest(&txheight,&locktime,tx.GetHash(),i,0,txout.nValue,(int32_t)tipindex->GetHeight());

16
src/rpc/server.cpp

@ -255,7 +255,7 @@ UniValue help(const UniValue& params, bool fHelp, const CPubKey& mypk)
return tableRPC.help(strCommand);
}
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
#ifdef ENABLE_WALLET
void GenerateBitcoins(bool b, CWallet *pw, int t);
@ -282,10 +282,10 @@ UniValue stop(const UniValue& params, bool fHelp, const CPubKey& mypk)
// Shutdown will take long enough that the response should get back
StartShutdown();
if ((strncmp(ASSETCHAINS_SYMBOL, "HUSH3", 5) == 0) ) {
if ((strncmp(SMART_CHAIN_SYMBOL, "HUSH3", 5) == 0) ) {
sprintf(buf,"Hush server stopping...");
} else {
sprintf(buf,"%s server stopping...",ASSETCHAINS_SYMBOL);
sprintf(buf,"%s server stopping...",SMART_CHAIN_SYMBOL);
}
return buf;
}
@ -872,12 +872,12 @@ UniValue CRPCTable::execute(const std::string &strMethod, const UniValue &params
std::string HelpExampleCli(const std::string& methodname, const std::string& args)
{
if ( ASSETCHAINS_SYMBOL[0] == 0 ) {
if ( SMART_CHAIN_SYMBOL[0] == 0 ) {
return "> komodo-cli " + methodname + " " + args + "\n";
} else if ((strncmp(ASSETCHAINS_SYMBOL, "HUSH3", 5) == 0) ) {
} else if ((strncmp(SMART_CHAIN_SYMBOL, "HUSH3", 5) == 0) ) {
return "> hush-cli " + methodname + " " + args + "\n";
} else {
return "> komodo-cli -ac_name=" + strprintf("%s", ASSETCHAINS_SYMBOL) + " " + methodname + " " + args + "\n";
return "> komodo-cli -ac_name=" + strprintf("%s", SMART_CHAIN_SYMBOL) + " " + methodname + " " + args + "\n";
}
}
@ -889,8 +889,8 @@ std::string HelpExampleRpc(const std::string& methodname, const std::string& arg
string experimentalDisabledHelpMsg(const string& rpc, const string& enableArg)
{
string daemon = ASSETCHAINS_SYMBOL[0] == 0 ? "komodod" : "hushd";
string ticker = ASSETCHAINS_SYMBOL[0] == 0 ? "komodo" : ASSETCHAINS_SYMBOL;
string daemon = SMART_CHAIN_SYMBOL[0] == 0 ? "komodod" : "hushd";
string ticker = SMART_CHAIN_SYMBOL[0] == 0 ? "komodo" : SMART_CHAIN_SYMBOL;
return "\nWARNING: " + rpc + " is disabled.\n"
"To enable it, restart " + daemon + " with the -experimentalfeatures and\n"

4
src/test-hush/testutils.cpp

@ -55,8 +55,8 @@ void setupChain()
// Init blockchain
ClearDatadirCache();
auto pathTemp = GetTempPath() / strprintf("test_komodo_%li_%i", GetTime(), GetRand(100000));
if (ASSETCHAINS_SYMBOL[0])
pathTemp = pathTemp / strprintf("_%s", ASSETCHAINS_SYMBOL);
if (SMART_CHAIN_SYMBOL[0])
pathTemp = pathTemp / strprintf("_%s", SMART_CHAIN_SYMBOL);
boost::filesystem::create_directories(pathTemp);
mapArgs["-datadir"] = pathTemp.string();
pblocktree = new CBlockTreeDB(1 << 20, true);

8
src/txmempool.cpp

@ -399,8 +399,8 @@ int64_t komodo_block_unlocktime(uint32_t nHeight);
void CTxMemPool::removeForReorg(const CCoinsViewCache *pcoins, unsigned int nMemPoolHeight, int flags)
{
// Remove transactions spending a coinbase which are now immature
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
if ( ASSETCHAINS_SYMBOL[0] == 0 )
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
if ( SMART_CHAIN_SYMBOL[0] == 0 )
COINBASE_MATURITY = _COINBASE_MATURITY;
// Remove transactions spending a coinbase which are now immature and no-longer-final transactions
LOCK(cs);
@ -511,7 +511,7 @@ void CTxMemPool::removeConflicts(const CTransaction &tx, std::list<CTransaction>
}
int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_t nTime,int32_t dispflag);
extern char ASSETCHAINS_SYMBOL[];
extern char SMART_CHAIN_SYMBOL[];
std::vector<uint256> CTxMemPool::removeExpired(unsigned int nBlockHeight)
{
@ -524,7 +524,7 @@ std::vector<uint256> CTxMemPool::removeExpired(unsigned int nBlockHeight)
const CTransaction& tx = it->GetTx();
tipindex = chainActive.LastTip();
bool fInterestNotValidated = ASSETCHAINS_SYMBOL[0] == 0 && tipindex != 0 && komodo_validate_interest(tx,tipindex->GetHeight()+1,tipindex->GetMedianTimePast() + 777,0) < 0;
bool fInterestNotValidated = SMART_CHAIN_SYMBOL[0] == 0 && tipindex != 0 && komodo_validate_interest(tx,tipindex->GetHeight()+1,tipindex->GetMedianTimePast() + 777,0) < 0;
if (IsExpiredTx(tx, nBlockHeight) || fInterestNotValidated)
{
if (fInterestNotValidated && tipindex != 0)

12
src/util.cpp

@ -487,15 +487,15 @@ void PrintExceptionContinue(const std::exception* pex, const char* pszThread)
strMiscWarning = message;
}
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
//int64_t MAX_MONEY = 200000000 * 100000000LL;
boost::filesystem::path GetDefaultDataDir()
{
namespace fs = boost::filesystem;
char symbol[KOMODO_ASSETCHAIN_MAXLEN];
if ( ASSETCHAINS_SYMBOL[0] != 0 )
strcpy(symbol,ASSETCHAINS_SYMBOL);
char symbol[HUSH_SMART_CHAIN_MAXLEN];
if ( SMART_CHAIN_SYMBOL[0] != 0 )
strcpy(symbol,SMART_CHAIN_SYMBOL);
else symbol[0] = 0;
// Windows < Vista: C:\Documents and Settings\Username\Application Data\Komodo
// Windows >= Vista: C:\Users\Username\AppData\Roaming\Komodo
@ -652,8 +652,8 @@ void ClearDatadirCache()
boost::filesystem::path GetConfigFile()
{
char confname[512];
if ( ASSETCHAINS_SYMBOL[0] != 0 )
sprintf(confname,"%s.conf",ASSETCHAINS_SYMBOL);
if ( SMART_CHAIN_SYMBOL[0] != 0 )
sprintf(confname,"%s.conf",SMART_CHAIN_SYMBOL);
else
{
#ifdef __APPLE__

2
src/util.h

@ -292,7 +292,7 @@ template <typename Callable> void TraceThread(const char* name, Callable func)
// split string using by space or comma as a delimiter char
void SplitStr(const std::string& strVal, std::vector<std::string> &outVals);
#define KOMODO_ASSETCHAIN_MAXLEN 65
#define HUSH_SMART_CHAIN_MAXLEN 65
#endif // BITCOIN_UTIL_H

2
src/wallet-utility.cpp

@ -9,7 +9,7 @@
#include <boost/foreach.hpp>
#include "hush_defs.h"
char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
int64_t MAX_MONEY = 200000000 * 100000000LL;
uint64_t ASSETCHAINS_SUPPLY;
uint16_t BITCOIND_RPCPORT = 7771;

6
src/wallet/asyncrpcoperation_sendmany.cpp

@ -53,7 +53,7 @@
using namespace libzcash;
extern char ASSETCHAINS_SYMBOL[65];
extern char SMART_CHAIN_SYMBOL[65];
int32_t hush_dpowconfs(int32_t height,int32_t numconfs);
int32_t komodo_blockheight(uint256 hash);
@ -333,7 +333,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
}
// for Komodo, set lock time to accure interest, for other chains, set
// locktime to spend time locked coinbases
if (ASSETCHAINS_SYMBOL[0] == 0)
if (SMART_CHAIN_SYMBOL[0] == 0)
{
if ( !hush_hardfork_active((uint32_t)chainActive.LastTip()->nTime) )
builder_.SetLockTime((uint32_t)time(NULL) - 60); // set lock time for Komodo interest
@ -349,7 +349,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
CTxIn in(COutPoint(txid, vout));
rawTx.vin.push_back(in);
}
if (ASSETCHAINS_SYMBOL[0] == 0)
if (SMART_CHAIN_SYMBOL[0] == 0)
{
if ( !hush_hardfork_active((uint32_t)chainActive.LastTip()->nTime) )
rawTx.nLockTime = (uint32_t)time(NULL) - 60; // jl777

18
src/wallet/rpcwallet.cpp

@ -59,7 +59,7 @@
using namespace std;
using namespace libzcash;
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
extern std::string ASSETCHAINS_OVERRIDE_PUBKEY;
const std::string ADDR_TYPE_SAPLING = "sapling";
const std::string ADDR_TYPE_AMNESIA = "amnesia";
@ -172,7 +172,7 @@ string AccountFromValue(const UniValue& value)
char *komodo_chainname()
{
return(ASSETCHAINS_SYMBOL[0] == 0 ? (char *)"KMD" : ASSETCHAINS_SYMBOL);
return(SMART_CHAIN_SYMBOL[0] == 0 ? (char *)"KMD" : SMART_CHAIN_SYMBOL);
}
void OS_randombytes(unsigned char *x,long xlen);
@ -622,7 +622,7 @@ UniValue kvupdate(const UniValue& params, bool fHelp, const CPubKey& mypk)
);
if (!EnsureWalletIsAvailable(fHelp))
return 0;
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
return(0);
haveprivkey = 0;
memset(&sig,0,sizeof(sig));
@ -679,7 +679,7 @@ UniValue kvupdate(const UniValue& params, bool fHelp, const CPubKey& mypk)
//for (i=0; i<32; i++)
// printf("%02x",((uint8_t *)&sig)[i]);
//printf(" sig for keylen.%d + valuesize.%d\n",keylen,refvaluesize);
ret.push_back(Pair("coin",(char *)(ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL)));
ret.push_back(Pair("coin",(char *)(SMART_CHAIN_SYMBOL[0] == 0 ? "KMD" : SMART_CHAIN_SYMBOL)));
height = chainActive.LastTip()->GetHeight();
if ( memcmp(&zeroes,&refpubkey,sizeof(refpubkey)) != 0 )
ret.push_back(Pair("owner",refpubkey.GetHex()));
@ -780,7 +780,7 @@ UniValue paxdeposit(const UniValue& params, bool fHelp, const CPubKey& mypk)
UniValue paxwithdraw(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
CWalletTx wtx; std::string dest; int32_t kmdheight; uint64_t seed,komodoshis = 0; char destaddr[64]; uint8_t i,pubkey37[37]; bool fSubtractFeeFromAmount = false;
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
return(0);
if (!EnsureWalletIsAvailable(fHelp))
return 0;
@ -794,14 +794,14 @@ UniValue paxwithdraw(const UniValue& params, bool fHelp, const CPubKey& mypk)
if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address");
int64_t fiatoshis = atof(params[1].get_str().c_str()) * COIN;
komodoshis = PAX_fiatdest(&seed,1,destaddr,pubkey37,(char *)params[0].get_str().c_str(),kmdheight,ASSETCHAINS_SYMBOL,fiatoshis);
komodoshis = PAX_fiatdest(&seed,1,destaddr,pubkey37,(char *)params[0].get_str().c_str(),kmdheight,SMART_CHAIN_SYMBOL,fiatoshis);
dest.append(destaddr);
CBitcoinAddress destaddress(CRYPTO777_KMDADDR);
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(" kmdheight.%d srcaddr.(%s) %s fiatoshis.%lld -> dest.(%s) komodoshis.%llu seed.%llx\n",kmdheight,(char *)params[0].get_str().c_str(),ASSETCHAINS_SYMBOL,(long long)fiatoshis,destaddr,(long long)komodoshis,(long long)seed);
printf(" kmdheight.%d srcaddr.(%s) %s fiatoshis.%lld -> dest.(%s) komodoshis.%llu seed.%llx\n",kmdheight,(char *)params[0].get_str().c_str(),SMART_CHAIN_SYMBOL,(long long)fiatoshis,destaddr,(long long)komodoshis,(long long)seed);
EnsureWalletIsUnlocked();
uint8_t opretbuf[64]; int32_t opretlen; uint64_t fee = fiatoshis / 1000;
if ( fee < 10000 )
@ -2552,7 +2552,7 @@ UniValue encryptwallet(const UniValue& params, bool fHelp, const CPubKey& mypk)
return NullUniValue;
string enableArg = "developerencryptwallet";
int32_t flag = (komodo_acpublic(0) || ASSETCHAINS_SYMBOL[0] == 0);
int32_t flag = (komodo_acpublic(0) || SMART_CHAIN_SYMBOL[0] == 0);
auto fEnableWalletEncryption = fExperimentalMode && GetBoolArg("-" + enableArg, flag);
std::string strWalletEncryptionDisabledMsg = "";
@ -2993,7 +2993,7 @@ UniValue listunspent(const UniValue& params, bool fHelp, const CPubKey& mypk)
uint64_t komodo_interestsum()
{
#ifdef ENABLE_WALLET
if ( ASSETCHAINS_SYMBOL[0] == 0 && GetBoolArg("-disablewallet", false) == 0 && KOMODO_NSPV_FULLNODE )
if ( SMART_CHAIN_SYMBOL[0] == 0 && GetBoolArg("-disablewallet", false) == 0 && KOMODO_NSPV_FULLNODE )
{
uint64_t interest,sum = 0; int32_t txheight; uint32_t locktime;
vector<COutput> vecOutputs;

8
src/wallet/wallet.cpp

@ -3245,7 +3245,7 @@ void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const
if ( KOMODO_EXCHANGEWALLET == 0 )
{
uint32_t locktime; int32_t txheight; CBlockIndex *tipindex;
if ( ASSETCHAINS_SYMBOL[0] == 0 && chainActive.LastTip() != 0 && chainActive.LastTip()->GetHeight() >= 60000 )
if ( SMART_CHAIN_SYMBOL[0] == 0 && chainActive.LastTip() != 0 && chainActive.LastTip()->GetHeight() >= 60000 )
{
if ( pcoin->vout[i].nValue >= 10*COIN )
{
@ -3747,7 +3747,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
//a chance at a free transaction.
//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);
if ( KOMODO_EXCHANGEWALLET == 0 && ASSETCHAINS_SYMBOL[0] == 0 )
if ( KOMODO_EXCHANGEWALLET == 0 && SMART_CHAIN_SYMBOL[0] == 0 )
{
interest2 += pcoin.first->vout[pcoin.second].interest;
//fprintf(stderr,"%.8f ",(double)pcoin.first->vout[pcoin.second].interest/COIN);
@ -3762,7 +3762,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
//fprintf(stderr,"KOMODO_EXCHANGEWALLET disable interest sum %.8f, interest2 %.8f\n",(double)interest/COIN,(double)interest2/COIN);
//interest = 0; // interest2 also
//}
if ( ASSETCHAINS_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;
CTxOut newTxOut(interest2,scriptDonation);
@ -4799,7 +4799,7 @@ int CMerkleTx::GetDepthInMainChain(const CBlockIndex* &pindexRet) const
int CMerkleTx::GetBlocksToMaturity() const
{
if ( ASSETCHAINS_SYMBOL[0] == 0 )
if ( SMART_CHAIN_SYMBOL[0] == 0 )
COINBASE_MATURITY = _COINBASE_MATURITY;
if (!IsCoinBase())
return 0;

Loading…
Cancel
Save