Remove the unsupported concept of staked notaries

This commit is contained in:
Duke Leto
2020-11-15 10:28:53 -05:00
parent 7dbe028c59
commit a23b0e8388
31 changed files with 119 additions and 352 deletions

View File

@@ -180,7 +180,6 @@ BITCOIN_CORE_H = \
mruset.h \ mruset.h \
net.h \ net.h \
netbase.h \ netbase.h \
notaries_staked.h \
noui.h \ noui.h \
policy/fees.h \ policy/fees.h \
pow.h \ pow.h \
@@ -302,7 +301,6 @@ libbitcoin_server_a_SOURCES = \
metrics.h \ metrics.h \
miner.cpp \ miner.cpp \
net.cpp \ net.cpp \
notaries_staked.cpp \
noui.cpp \ noui.cpp \
notarisationdb.cpp \ notarisationdb.cpp \
policy/fees.cpp \ policy/fees.cpp \

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 The Bitcoin Core developers // Copyright (c) 2009-2013 The Bitcoin Core developers
// Copyright (c) 2019 The Hush developers // Copyright (c) 2019-2020 The Hush developers
// Distributed under the GPLv3 software license, see the accompanying // Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html // file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
@@ -28,11 +28,9 @@
#include "util.h" #include "util.h"
#include "httpserver.h" #include "httpserver.h"
#include "httprpc.h" #include "httprpc.h"
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <stdio.h> #include <stdio.h>
#ifdef _WIN32 #ifdef _WIN32
@@ -72,22 +70,6 @@ void WaitForShutdown(boost::thread_group* threadGroup)
{ {
int32_t i,height; CBlockIndex *pindex; bool fShutdown = ShutdownRequested(); const uint256 zeroid; int32_t i,height; CBlockIndex *pindex; bool fShutdown = ShutdownRequested(); const uint256 zeroid;
// Tell the main threads to shutdown. // Tell the main threads to shutdown.
/*
if (komodo_currentheight()>KOMODO_EARLYTXID_HEIGHT && KOMODO_EARLYTXID!=zeroid && ((height=tx_height(KOMODO_EARLYTXID))==0 || height>KOMODO_EARLYTXID_HEIGHT))
{
fprintf(stderr,"%s: error: earlytx must be before block height %d or tx does not exist\n",__FUNCTION__, KOMODO_EARLYTXID_HEIGHT);
fprintf(stderr,"%s: earlytxid=%s, tx_height=%d, komodo_currentheight=%d\n", __FUNCTION__, KOMODO_EARLYTXID.GetHex().c_str(), tx_height(KOMODO_EARLYTXID), komodo_currentheight() );
StartShutdown();
}
*/
/*if ( ASSETCHAINS_STAKED == 0 && ASSETCHAINS_ADAPTIVEPOW == 0 && (pindex= komodo_chainactive(1)) != 0 )
{
if ( pindex->nTime > ADAPTIVEPOW_CHANGETO_DEFAULTON )
{
ASSETCHAINS_ADAPTIVEPOW = 1;
fprintf(stderr,"default activate adaptivepow\n");
} else fprintf(stderr,"height1 time %u vs %u\n",pindex->nTime,ADAPTIVEPOW_CHANGETO_DEFAULTON);
} //else fprintf(stderr,"cant find height 1\n");*/
if ( ASSETCHAINS_CBOPRET != 0 ) { if ( ASSETCHAINS_CBOPRET != 0 ) {
komodo_pricesinit(); komodo_pricesinit();
@@ -135,7 +117,7 @@ void WaitForShutdown(boost::thread_group* threadGroup)
// //
// Start // Start
// //
extern int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY; extern int32_t IS_HUSH_NOTARY,USE_EXTERNAL_PUBKEY;
extern uint32_t ASSETCHAIN_INIT; extern uint32_t ASSETCHAIN_INIT;
extern std::string NOTARY_PUBKEY; extern std::string NOTARY_PUBKEY;
int32_t komodo_is_issuer(); int32_t komodo_is_issuer();

View File

@@ -1,3 +1,6 @@
// Copyright (c) 2019-2020 The Hush developers
// Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
/****************************************************************************** /******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. * * Copyright © 2014-2019 The SuperNET Developers. *
* * * *
@@ -50,8 +53,6 @@ Details.
/// so it can lookup directly all transactions to any address. /// so it can lookup directly all transactions to any address.
/// This is a key performance boosting thing as if it wasnt there, trying to get all the utxo for an address not in the wallet is quite time consuming. /// This is a key performance boosting thing as if it wasnt there, trying to get all the utxo for an address not in the wallet is quite time consuming.
/// ///
/// More information about Antara framework:
/// https://developers.komodoplatform.com/basic-docs/start-here/about-komodo-platform/product-introductions.html#smart-chains-antara
#include <cc/eval.h> #include <cc/eval.h>
#include <script/cc.h> #include <script/cc.h>

View File

@@ -1,3 +1,6 @@
// Copyright (c) 2019-2020 The Hush developers
// Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
/****************************************************************************** /******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. * * Copyright © 2014-2019 The SuperNET Developers. *
* * * *
@@ -17,7 +20,6 @@
#define CC_EVAL_H #define CC_EVAL_H
#include <cryptoconditions.h> #include <cryptoconditions.h>
#include "cc/utils.h" #include "cc/utils.h"
#include "chain.h" #include "chain.h"
#include "streams.h" #include "streams.h"
@@ -36,7 +38,6 @@
* there should be a code identifying it. For example, * there should be a code identifying it. For example,
* a possible code is EVAL_BITCOIN_SCRIPT, where the entire binary * a possible code is EVAL_BITCOIN_SCRIPT, where the entire binary
* after the code is interpreted as a bitcoin script. * after the code is interpreted as a bitcoin script.
* Verus EVAL_STAKEGUARD is 0x01
*/ */
#define FOREACH_EVAL(EVAL) \ #define FOREACH_EVAL(EVAL) \
EVAL(EVAL_IMPORTPAYOUT, 0xe1) \ EVAL(EVAL_IMPORTPAYOUT, 0xe1) \

View File

@@ -1,3 +1,6 @@
// Copyright (c) 2019-2020 The Hush developers
// Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
/****************************************************************************** /******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. * * Copyright © 2014-2019 The SuperNET Developers. *
* * * *
@@ -535,8 +538,6 @@ bool CheckMigration(Eval *eval, const CTransaction &importTx, const CTransaction
uint256 tokenid = zeroid; uint256 tokenid = zeroid;
if (vimportOpret.begin()[0] == EVAL_TOKENS) { // for tokens (new opret with tokens) if (vimportOpret.begin()[0] == EVAL_TOKENS) { // for tokens (new opret with tokens)
if ( is_STAKED(ASSETCHAINS_SYMBOL) == 1 )
return eval->Invalid("no-tokens-migrate-on-LABS");
struct CCcontract_info *cpTokens, CCtokens_info; struct CCcontract_info *cpTokens, CCtokens_info;
std::vector<std::pair<uint8_t, vscript_t>> oprets; std::vector<std::pair<uint8_t, vscript_t>> oprets;
uint8_t evalCodeInOpret; uint8_t evalCodeInOpret;

View File

@@ -29,13 +29,10 @@ class CChainPower;
#include "pow.h" #include "pow.h"
#include "tinyformat.h" #include "tinyformat.h"
#include "uint256.h" #include "uint256.h"
extern int8_t is_STAKED(const char *chain_name);
extern bool fZindex;
#include <vector> #include <vector>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
extern bool fZindex;
static const int SPROUT_VALUE_VERSION = 1001400; static const int SPROUT_VALUE_VERSION = 1001400;
static const int SAPLING_VALUE_VERSION = 1010100; static const int SAPLING_VALUE_VERSION = 1010100;
extern int32_t ASSETCHAINS_LWMAPOS; extern int32_t ASSETCHAINS_LWMAPOS;

View File

@@ -1,3 +1,6 @@
// Copyright (c) 2019-2020 The Hush developers
// Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
/****************************************************************************** /******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. * * Copyright © 2014-2019 The SuperNET Developers. *
* * * *
@@ -15,12 +18,9 @@
#ifndef CROSSCHAIN_H #ifndef CROSSCHAIN_H
#define CROSSCHAIN_H #define CROSSCHAIN_H
#include "cc/eval.h" #include "cc/eval.h"
const int CROSSCHAIN_KOMODO = 1; const int CROSSCHAIN_HUSH = 1;
const int CROSSCHAIN_TXSCL = 2;
const int CROSSCHAIN_STAKED = 3;
typedef struct CrosschainAuthority { typedef struct CrosschainAuthority {
uint8_t notaries[64][33]; uint8_t notaries[64][33];
@@ -34,7 +34,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth);
/* On assetchain */ /* On assetchain */
TxProof GetAssetchainProof(uint256 hash,CTransaction burnTx); TxProof GetAssetchainProof(uint256 hash,CTransaction burnTx);
/* On KMD */ /* On HUSH */
uint256 CalculateProofRoot(const char* symbol, uint32_t targetCCid, int kmdHeight, uint256 CalculateProofRoot(const char* symbol, uint32_t targetCCid, int kmdHeight,
std::vector<uint256> &moms, uint256 &destNotarisationTxid); std::vector<uint256> &moms, uint256 &destNotarisationTxid);
TxProof GetCrossChainProof(const uint256 txid, const char* targetSymbol, uint32_t targetCCid, TxProof GetCrossChainProof(const uint256 txid, const char* targetSymbol, uint32_t targetCCid,

View File

@@ -1,18 +1,13 @@
// Copyright (c) 2019-2020 The Hush developers
// Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
#include "cc/eval.h" #include "cc/eval.h"
#include "crosschain.h" #include "crosschain.h"
#include "notarisationdb.h" #include "notarisationdb.h"
int GetSymbolAuthority(const char* symbol) int GetSymbolAuthority(const char* symbol)
{ {
if (strncmp(symbol, "TXSCL", 5) == 0) return CROSSCHAIN_HUSH;
return CROSSCHAIN_TXSCL;
if (is_STAKED(symbol) != 0) {
//printf("RETURNED CROSSCHAIN STAKED AS TRUE\n");
return CROSSCHAIN_STAKED;
}
//printf("RETURNED CROSSCHAIN KOMODO AS TRUE\n");
return CROSSCHAIN_KOMODO;
} }
@@ -55,16 +50,3 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth)
return true; return true;
} }
/*
const CrosschainAuthority auth_STAKED = [&](){
CrosschainAuthority auth;
auth.requiredSigs = (num_notaries_STAKED / 5);
auth.size = num_notaries_STAKED;
for (int n=0; n<auth.size; n++)
for (size_t i=0; i<33; i++)
sscanf(notaries_STAKED[n][1]+(i*2), "%2hhx", auth.notaries[n]+i);
return auth;
}();
*/

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 The Bitcoin Core developers // Copyright (c) 2009-2013 The Bitcoin Core developers
// Copyright (c) 2019 The Hush developers // Copyright (c) 2019-2020 The Hush developers
// Distributed under the GPLv3 software license, see the accompanying // Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html // file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html

View File

@@ -1,4 +1,6 @@
// Copyright (c) 2019-2020 The Hush developers // Copyright (c) 2019-2020 The Hush developers
// Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
/****************************************************************************** /******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. * * Copyright © 2014-2019 The SuperNET Developers. *
* * * *
@@ -366,7 +368,7 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar
} }
if ( (sp= komodo_stateptr(symbol,dest)) == 0 ) if ( (sp= komodo_stateptr(symbol,dest)) == 0 )
{ {
KOMODO_INITDONE = (uint32_t)time(NULL); HUSH_INITDONE = (uint32_t)time(NULL);
printf("[%s] no komodo_stateptr\n",ASSETCHAINS_SYMBOL); printf("[%s] no komodo_stateptr\n",ASSETCHAINS_SYMBOL);
return; return;
} }
@@ -385,7 +387,7 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar
; ;
} }
} else fp = fopen(fname,"wb+"); } else fp = fopen(fname,"wb+");
KOMODO_INITDONE = (uint32_t)time(NULL); HUSH_INITDONE = (uint32_t)time(NULL);
} }
if ( height <= 0 ) if ( height <= 0 )
{ {
@@ -544,7 +546,7 @@ int32_t komodo_voutupdate(bool fJustCheck,int32_t *isratificationp,int32_t notar
return(-1); return(-1);
if ( scriptlen == 35 && scriptbuf[0] == 33 && scriptbuf[34] == 0xac ) if ( scriptlen == 35 && scriptbuf[0] == 33 && scriptbuf[34] == 0xac )
{ {
if ( i == 0 && j == 0 && memcmp(NOTARY_PUBKEY33,scriptbuf+1,33) == 0 && IS_KOMODO_NOTARY != 0 ) 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",ASSETCHAINS_SYMBOL,KOMODO_LASTMINED,height);
prevKOMODO_LASTMINED = KOMODO_LASTMINED; prevKOMODO_LASTMINED = KOMODO_LASTMINED;
@@ -805,10 +807,7 @@ int32_t komodo_notarycmp(uint8_t *scriptPubKey,int32_t scriptlen,uint8_t pubkeys
return(-1); return(-1);
} }
// int32_t (!!!) // Connect a Hush Block
/*
read blackjok3rtt comments in main.cpp
*/
int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block) int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
{ {
static int32_t hwmheight; static int32_t hwmheight;
@@ -824,7 +823,7 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
} }
memset(&zero,0,sizeof(zero)); memset(&zero,0,sizeof(zero));
komodo_init(pindex->GetHeight()); komodo_init(pindex->GetHeight());
KOMODO_INITDONE = (uint32_t)time(NULL); HUSH_INITDONE = (uint32_t)time(NULL);
if ( (sp= komodo_stateptr(symbol,dest)) == 0 ) if ( (sp= komodo_stateptr(symbol,dest)) == 0 )
{ {
fprintf(stderr,"unexpected null komodostateptr.[%s]\n",ASSETCHAINS_SYMBOL); fprintf(stderr,"unexpected null komodostateptr.[%s]\n",ASSETCHAINS_SYMBOL);
@@ -858,10 +857,6 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
txn_count = block.vtx.size(); txn_count = block.vtx.size();
for (i=0; i<txn_count; i++) for (i=0; i<txn_count; i++)
{ {
if ( (is_STAKED(ASSETCHAINS_SYMBOL) != 0 && staked_era == 0) || (is_STAKED(ASSETCHAINS_SYMBOL) == 255) ) {
// in era gap or chain banned, no point checking any invlaid notarisations.
break;
}
// Notary pay chains need notarisation in position 1, ignore the rest on validation. Check notarisation is 1 on check. // Notary pay chains need notarisation in position 1, ignore the rest on validation. Check notarisation is 1 on check.
if ( !fJustCheck && i > 1 && ASSETCHAINS_NOTARY_PAY[0] != 0 ) if ( !fJustCheck && i > 1 && ASSETCHAINS_NOTARY_PAY[0] != 0 )
break; break;
@@ -922,7 +917,7 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
sp->NOTARIZED_HASH = block.GetHash(); sp->NOTARIZED_HASH = block.GetHash();
sp->NOTARIZED_DESTTXID = txhash; sp->NOTARIZED_DESTTXID = txhash;
} }
if ( IS_KOMODO_NOTARY != 0 && ASSETCHAINS_SYMBOL[0] == 0 ) if ( IS_HUSH_NOTARY != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
printf("(tx.%d: ",i); printf("(tx.%d: ",i);
for (j=0; j<numvouts; j++) for (j=0; j<numvouts; j++)
{ {
@@ -940,7 +935,7 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
} }
} }
}*/ }*/
if ( IS_KOMODO_NOTARY != 0 && ASSETCHAINS_SYMBOL[0] == 0 ) if ( IS_HUSH_NOTARY != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
printf("%.8f ",dstr(block.vtx[i].vout[j].nValue)); printf("%.8f ",dstr(block.vtx[i].vout[j].nValue));
len = block.vtx[i].vout[j].scriptPubKey.size(); len = block.vtx[i].vout[j].scriptPubKey.size();
@@ -961,7 +956,7 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
} }
} }
} }
if ( IS_KOMODO_NOTARY != 0 && ASSETCHAINS_SYMBOL[0] == 0 ) if ( IS_HUSH_NOTARY != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
printf(") "); printf(") ");
if ( 0 && ASSETCHAINS_SYMBOL[0] == 0 ) 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); 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);
@@ -1003,14 +998,14 @@ int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
} }
} }
} }
if ( !fJustCheck && IS_KOMODO_NOTARY != 0 && ASSETCHAINS_SYMBOL[0] == 0 ) if ( !fJustCheck && IS_HUSH_NOTARY != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
printf("%s ht.%d\n",ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL,height); printf("%s ht.%d\n",ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL,height);
if ( !fJustCheck && pindex->GetHeight() == hwmheight ) 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); komodo_stateupdate(height,0,0,0,zero,0,0,0,0,height,(uint32_t)pindex->nTime,0,0,0,0,zero,0);
} }
else else
{ fprintf(stderr,"hush_connectblock: unexpected null pindex\n"); return(0); } { fprintf(stderr,"hush_connectblock: unexpected null pindex\n"); return(0); }
//KOMODO_INITDONE = (uint32_t)time(NULL); //HUSH_INITDONE = (uint32_t)time(NULL);
//fprintf(stderr,"%s end connect.%d\n",ASSETCHAINS_SYMBOL,pindex->GetHeight()); //fprintf(stderr,"%s end connect.%d\n",ASSETCHAINS_SYMBOL,pindex->GetHeight());
if (fJustCheck) if (fJustCheck)
{ {

View File

@@ -104,18 +104,18 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam
{ {
if ( didinit[hush_season-1] == 0 ) if ( didinit[hush_season-1] == 0 )
{ {
for (i=0; i<NUM_KMD_NOTARIES; i++) for (i=0; i<NUM_HUSH_NOTARIES; i++)
decode_hex(kmd_pubkeys[hush_season-1][i],33,(char *)notaries_elected[hush_season-1][i][1]); decode_hex(kmd_pubkeys[hush_season-1][i],33,(char *)notaries_elected[hush_season-1][i][1]);
if ( ASSETCHAINS_PRIVATE != 0 ) if ( ASSETCHAINS_PRIVATE != 0 )
{ {
// we need to populate the address array for the notary exemptions. // we need to populate the address array for the notary exemptions.
for (i = 0; i<NUM_KMD_NOTARIES; i++) for (i = 0; i<NUM_HUSH_NOTARIES; i++)
pubkey2addr((char *)NOTARY_ADDRESSES[hush_season-1][i],(uint8_t *)kmd_pubkeys[hush_season-1][i]); pubkey2addr((char *)NOTARY_ADDRESSES[hush_season-1][i],(uint8_t *)kmd_pubkeys[hush_season-1][i]);
} }
didinit[hush_season-1] = 1; didinit[hush_season-1] = 1;
} }
memcpy(pubkeys,kmd_pubkeys[hush_season-1],NUM_KMD_NOTARIES * 33); memcpy(pubkeys,kmd_pubkeys[hush_season-1],NUM_HUSH_NOTARIES * 33);
return(NUM_KMD_NOTARIES); return(NUM_HUSH_NOTARIES);
} }
//TODO: delete staked chain junk //TODO: delete staked chain junk

View File

@@ -1,4 +1,6 @@
// Copyright (c) 2019-2020 The Hush developers // Copyright (c) 2019-2020 The Hush developers
// Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
/****************************************************************************** /******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. * * Copyright © 2014-2019 The SuperNET Developers. *
* * * *
@@ -1768,8 +1770,7 @@ void komodo_args(char *argv0)
std::string name,addn,hexstr,symbol; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[32756],disablebits[32],*extraptr=0; std::string name,addn,hexstr,symbol; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[32756],disablebits[32],*extraptr=0;
FILE *fp; uint64_t val; uint16_t port; int32_t i,nonz=0,baseid,len,n,extralen = 0; uint64_t ccenables[256], ccEnablesHeight[512] = {0}; CTransaction earlytx; uint256 hashBlock; FILE *fp; uint64_t val; uint16_t port; int32_t i,nonz=0,baseid,len,n,extralen = 0; uint64_t ccenables[256], ccEnablesHeight[512] = {0}; CTransaction earlytx; uint256 hashBlock;
IS_KOMODO_NOTARY = GetBoolArg("-notary", false); IS_HUSH_NOTARY = GetBoolArg("-notary", false);
IS_STAKED_NOTARY = GetArg("-stakednotary", -1);
KOMODO_NSPV = GetArg("-nSPV",0); KOMODO_NSPV = GetArg("-nSPV",0);
memset(ccenables,0,sizeof(ccenables)); memset(ccenables,0,sizeof(ccenables));
memset(disablebits,0,sizeof(disablebits)); memset(disablebits,0,sizeof(disablebits));
@@ -1788,7 +1789,7 @@ void komodo_args(char *argv0)
{ {
decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str()); decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str());
USE_EXTERNAL_PUBKEY = 1; USE_EXTERNAL_PUBKEY = 1;
if ( IS_KOMODO_NOTARY == 0 ) if ( IS_HUSH_NOTARY == 0 )
{ {
// We dont have any chain data yet, so use system clock to guess. // We dont have any chain data yet, so use system clock to guess.
// I think on season change should reccomend notaries to use -notary to avoid needing this. // I think on season change should reccomend notaries to use -notary to avoid needing this.
@@ -1797,20 +1798,16 @@ void komodo_args(char *argv0)
{ {
if ( strcmp(NOTARY_PUBKEY.c_str(),notaries_elected[hush_season-1][i][1]) == 0 ) if ( strcmp(NOTARY_PUBKEY.c_str(),notaries_elected[hush_season-1][i][1]) == 0 )
{ {
IS_KOMODO_NOTARY = 1; IS_HUSH_NOTARY = 1;
KOMODO_MININGTHREADS = 1; KOMODO_MININGTHREADS = 1;
mapArgs ["-genproclimit"] = itostr(KOMODO_MININGTHREADS); mapArgs ["-genproclimit"] = itostr(KOMODO_MININGTHREADS);
IS_STAKED_NOTARY = -1;
fprintf(stderr,"running as notary.%d %s\n",i,notaries_elected[hush_season-1][i][0]); fprintf(stderr,"running as notary.%d %s\n",i,notaries_elected[hush_season-1][i][0]);
break; break;
} }
} }
} }
} }
if ( IS_STAKED_NOTARY != -1 && IS_KOMODO_NOTARY == true ) {
fprintf(stderr, "Cannot be STAKED and KMD notary at the same time!\n");
StartShutdown();
}
name = GetArg("-ac_name",""); name = GetArg("-ac_name","");
if ( argv0 != 0 ) if ( argv0 != 0 )
{ {
@@ -2352,7 +2349,7 @@ fprintf(stderr,"extralen.%d before disable bits\n",extralen);
if (ASSETCHAINS_CBMATURITY != 0) if (ASSETCHAINS_CBMATURITY != 0)
COINBASE_MATURITY = ASSETCHAINS_CBMATURITY; COINBASE_MATURITY = ASSETCHAINS_CBMATURITY;
else if (ASSETCHAINS_LASTERA == 0 || is_STAKED(ASSETCHAINS_SYMBOL) != 0) else if (ASSETCHAINS_LASTERA == 0)
COINBASE_MATURITY = 1; COINBASE_MATURITY = 1;
if (COINBASE_MATURITY < 1) if (COINBASE_MATURITY < 1)
{ {
@@ -2429,7 +2426,7 @@ fprintf(stderr,"extralen.%d before disable bits\n",extralen);
fclose(fp); fclose(fp);
//printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS); //printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS);
} //else printf("couldnt open.(%s)\n",fname); } //else printf("couldnt open.(%s)\n",fname);
if ( IS_KOMODO_NOTARY == 0 ) if ( IS_HUSH_NOTARY == 0 )
break; break;
} }
} }

View File

@@ -621,7 +621,7 @@ uint32_t komodo_txtime(CScript &opret,uint64_t *valuep,uint256 hash, int32_t n,
CTxDestination address; CTransaction tx; uint256 hashBlock; int32_t numvouts; CTxDestination address; CTransaction tx; uint256 hashBlock; int32_t numvouts;
*valuep = 0; *valuep = 0;
if (!GetTransaction(hash, tx, if (!GetTransaction(hash, tx,
#ifndef KOMODO_ZCASH #ifndef HUSH_ZCASH
Params().GetConsensus(), Params().GetConsensus(),
#endif #endif
hashBlock, true)) hashBlock, true))
@@ -652,7 +652,7 @@ uint32_t komodo_txtime2(uint64_t *valuep,uint256 hash,int32_t n,char *destaddr)
CTxDestination address; CBlockIndex *pindex; CTransaction tx; uint256 hashBlock; uint32_t txtime = 0; CTxDestination address; CBlockIndex *pindex; CTransaction tx; uint256 hashBlock; uint32_t txtime = 0;
*valuep = 0; *valuep = 0;
if (!GetTransaction(hash, tx, if (!GetTransaction(hash, tx,
#ifndef KOMODO_ZCASH #ifndef HUSH_ZCASH
Params().GetConsensus(), Params().GetConsensus(),
#endif #endif
hashBlock, true)) hashBlock, true))

View File

@@ -45,7 +45,7 @@
// to add seasons, change NUM_KMD_SEASONS, and add timestamp and height of activation to these arrays. // to add seasons, change NUM_KMD_SEASONS, and add timestamp and height of activation to these arrays.
#define NUM_KMD_SEASONS 6 #define NUM_KMD_SEASONS 6
#define NUM_KMD_NOTARIES 64 #define NUM_HUSH_NOTARIES 64
// $ ./contrib/block_time.pl 166250 // $ ./contrib/block_time.pl 166250
// Hush Block 166250 will happen at roughly: // Hush Block 166250 will happen at roughly:
@@ -64,7 +64,7 @@ static const uint32_t KMD_SEASON_TIMESTAMPS[NUM_KMD_SEASONS] = {1525132800, 1563
static const int32_t KMD_SEASON_HEIGHTS[NUM_KMD_SEASONS] = {1,2,nHushHardforkHeight, nHushHardforkHeight2, (int)340000, 5*nHushHardforkHeight2}; static const int32_t KMD_SEASON_HEIGHTS[NUM_KMD_SEASONS] = {1,2,nHushHardforkHeight, nHushHardforkHeight2, (int)340000, 5*nHushHardforkHeight2};
// Era array of pubkeys. Add extra seasons to bottom as requried, after adding appropriate info above. // Era array of pubkeys. Add extra seasons to bottom as requried, after adding appropriate info above.
static const char *notaries_elected[NUM_KMD_SEASONS][NUM_KMD_NOTARIES][2] = static const char *notaries_elected[NUM_KMD_SEASONS][NUM_HUSH_NOTARIES][2] =
{ {
{ {
{ "0_jl777_testA", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, { "0_jl777_testA", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" },
@@ -427,9 +427,9 @@ extern int32_t ASSETCHAINS_LWMAPOS, ASSETCHAINS_SAPLING, ASSETCHAINS_OVERWINTER,
extern int32_t KOMODO_BLOCK_POSUNITS, KOMODO_CONSECUTIVE_POS_THRESHOLD, KOMODO_NOPOS_THRESHHOLD; extern int32_t KOMODO_BLOCK_POSUNITS, KOMODO_CONSECUTIVE_POS_THRESHOLD, KOMODO_NOPOS_THRESHHOLD;
extern uint64_t ASSETCHAINS_TIMELOCKGTE; extern uint64_t ASSETCHAINS_TIMELOCKGTE;
extern uint32_t ASSETCHAINS_ALGO,ASSETCHAINS_EQUIHASH,KOMODO_INITDONE; extern uint32_t ASSETCHAINS_ALGO,ASSETCHAINS_EQUIHASH,HUSH_INITDONE;
extern int32_t KOMODO_MININGTHREADS,KOMODO_LONGESTCHAIN,ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,KOMODO_ON_DEMAND,KOMODO_PASSPORT_INITDONE,ASSETCHAINS_STAKED,KOMODO_NSPV; extern int32_t KOMODO_MININGTHREADS,KOMODO_LONGESTCHAIN,ASSETCHAINS_SEED,IS_HUSH_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,KOMODO_ON_DEMAND,KOMODO_PASSPORT_INITDONE,ASSETCHAINS_STAKED,KOMODO_NSPV;
extern uint64_t ASSETCHAINS_COMMISSION, ASSETCHAINS_LASTERA,ASSETCHAINS_CBOPRET; extern uint64_t ASSETCHAINS_COMMISSION, ASSETCHAINS_LASTERA,ASSETCHAINS_CBOPRET;
extern uint64_t ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_TIMELOCKGTE, ASSETCHAINS_NONCEMASK[],ASSETCHAINS_NK[2]; extern uint64_t ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_TIMELOCKGTE, ASSETCHAINS_NONCEMASK[],ASSETCHAINS_NK[2];
extern const char *ASSETCHAINS_ALGORITHMS[]; extern const char *ASSETCHAINS_ALGORITHMS[];
@@ -453,7 +453,7 @@ extern uint8_t ASSETCHAINS_PRIVATE;
extern int32_t USE_EXTERNAL_PUBKEY; extern int32_t USE_EXTERNAL_PUBKEY;
extern char NOTARYADDRS[64][64]; extern char NOTARYADDRS[64][64];
extern char NOTARY_ADDRESSES[NUM_KMD_SEASONS][64][64]; extern char NOTARY_ADDRESSES[NUM_KMD_SEASONS][64][64];
extern int32_t KOMODO_TESTNODE, KOMODO_SNAPSHOT_INTERVAL,IS_STAKED_NOTARY,STAKED_ERA; extern int32_t KOMODO_TESTNODE, KOMODO_SNAPSHOT_INTERVAL;
extern int32_t ASSETCHAINS_EARLYTXIDCONTRACT; extern int32_t ASSETCHAINS_EARLYTXIDCONTRACT;
extern int32_t ASSETCHAINS_STAKED_SPLIT_PERCENTAGE; extern int32_t ASSETCHAINS_STAKED_SPLIT_PERCENTAGE;
int tx_height( const uint256 &hash ); int tx_height( const uint256 &hash );

View File

@@ -41,14 +41,14 @@ void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t heig
{ {
static uint32_t counter; int32_t verified=0; char *coin; struct komodo_event_notarized N; 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 = (ASSETCHAINS_SYMBOL[0] == 0) ? (char *)"KMD" : ASSETCHAINS_SYMBOL;
if ( IS_KOMODO_NOTARY != 0 && (verified= komodo_verifynotarization(symbol,dest,height,notarizedheight,notarized_hash,notarized_desttxid)) < 0 ) if ( IS_HUSH_NOTARY != 0 && (verified= komodo_verifynotarization(symbol,dest,height,notarizedheight,notarized_hash,notarized_desttxid)) < 0 )
{ {
if ( counter++ < 100 ) 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",ASSETCHAINS_SYMBOL,height,notarizedheight,dest);
} }
else if ( strcmp(symbol,coin) == 0 ) else if ( strcmp(symbol,coin) == 0 )
{ {
if ( 0 && IS_KOMODO_NOTARY != 0 && verified != 0 ) if ( 0 && IS_HUSH_NOTARY != 0 && verified != 0 )
fprintf(stderr,"validated [%s] ht.%d notarized %d\n",coin,height,notarizedheight); fprintf(stderr,"validated [%s] ht.%d notarized %d\n",coin,height,notarizedheight);
memset(&N,0,sizeof(N)); memset(&N,0,sizeof(N));
N.blockhash = notarized_hash; N.blockhash = notarized_hash;

View File

@@ -1429,9 +1429,9 @@ void komodo_passport_iteration()
int32_t maxseconds = 10; 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[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; uint32_t buf[3],starttime; uint64_t RTmask = 0; //CBlockIndex *pindex;
expired = 0; expired = 0;
while ( 0 && KOMODO_INITDONE == 0 ) while ( 0 && HUSH_INITDONE == 0 )
{ {
fprintf(stderr,"[%s] PASSPORT iteration waiting for KOMODO_INITDONE\n",ASSETCHAINS_SYMBOL); fprintf(stderr,"[%s] PASSPORT iteration waiting for HUSH_INITDONE\n",ASSETCHAINS_SYMBOL);
sleep(3); sleep(3);
} }
if ( komodo_chainactive_timestamp() > lastinterest ) if ( komodo_chainactive_timestamp() > lastinterest )

View File

@@ -1,4 +1,6 @@
// Copyright 2019-2020 The Hush Developers // Copyright 2019-2020 The Hush Developers
// Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
/****************************************************************************** /******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. * * Copyright © 2014-2019 The SuperNET Developers. *
@@ -49,7 +51,7 @@ int COINBASE_MATURITY = _COINBASE_MATURITY;//100;
unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+10; unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+10;
uint256 KOMODO_EARLYTXID; uint256 KOMODO_EARLYTXID;
int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,IS_STAKED_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1,KOMODO_DEALERNODE,KOMODO_EXTRASATOSHI,ASSETCHAINS_FOUNDERS,ASSETCHAINS_CBMATURITY,KOMODO_NSPV; int32_t KOMODO_MININGTHREADS = -1,IS_HUSH_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1,KOMODO_DEALERNODE,KOMODO_EXTRASATOSHI,ASSETCHAINS_FOUNDERS,ASSETCHAINS_CBMATURITY,KOMODO_NSPV;
int32_t HUSH_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1; int32_t HUSH_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1;
std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY,ASSETCHAINS_SCRIPTPUB,NOTARY_ADDRESS,ASSETCHAINS_SELFIMPORT,ASSETCHAINS_CCLIB; std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY,ASSETCHAINS_SCRIPTPUB,NOTARY_ADDRESS,ASSETCHAINS_SELFIMPORT,ASSETCHAINS_CCLIB;
uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEYHASH[20],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW,ASSETCHAINS_MARMARA; uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEYHASH[20],ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE,ASSETCHAINS_TXPOW,ASSETCHAINS_MARMARA;
@@ -99,7 +101,7 @@ uint64_t KOMODO_INTERESTSUM,KOMODO_WALLETBALANCE;
int32_t ASSETCHAINS_STAKED; int32_t ASSETCHAINS_STAKED;
uint64_t ASSETCHAINS_COMMISSION,ASSETCHAINS_SUPPLY = 10,ASSETCHAINS_FOUNDERS_REWARD; uint64_t ASSETCHAINS_COMMISSION,ASSETCHAINS_SUPPLY = 10,ASSETCHAINS_FOUNDERS_REWARD;
uint32_t KOMODO_INITDONE; uint32_t HUSH_INITDONE;
char KMDUSERPASS[8192+512+1],BTCUSERPASS[8192]; uint16_t KMD_PORT = 7771,BITCOIND_RPCPORT = 7771; char KMDUSERPASS[8192+512+1],BTCUSERPASS[8192]; uint16_t KMD_PORT = 7771,BITCOIND_RPCPORT = 7771;
uint64_t PENDING_KOMODO_TX; uint64_t PENDING_KOMODO_TX;
extern int32_t KOMODO_LOADINGBLOCKS; extern int32_t KOMODO_LOADINGBLOCKS;

View File

@@ -21,7 +21,6 @@
#include "main.h" #include "main.h"
#include "sodium.h" #include "sodium.h"
#include "addrman.h" #include "addrman.h"
#include "alert.h" #include "alert.h"
#include "arith_uint256.h" #include "arith_uint256.h"
@@ -639,8 +638,8 @@ CBlockTreeDB *pblocktree = NULL;
// Komodo globals // Komodo globals
#define KOMODO_ZCASH #define HUSH_ZCASH
#include "komodo.h" #include "hush.h"
UniValue komodo_snapshot(int top) UniValue komodo_snapshot(int top)
{ {
@@ -1384,7 +1383,7 @@ int32_t komodo_isnotaryvout(char *coinaddr,uint32_t tiptime) // from ac_private
} }
if ( strcmp(coinaddr,CRYPTO777_KMDADDR) == 0 ) if ( strcmp(coinaddr,CRYPTO777_KMDADDR) == 0 )
return(1); return(1);
for (int32_t i = 0; i < NUM_KMD_NOTARIES; i++) for (int32_t i = 0; i < NUM_HUSH_NOTARIES; i++)
{ {
if ( strcmp(coinaddr,NOTARY_ADDRESSES[season-1][i]) == 0 ) if ( strcmp(coinaddr,NOTARY_ADDRESSES[season-1][i]) == 0 )
{ {
@@ -3697,7 +3696,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
error("ConnectBlock(): coinbase pays too much (actual=%d vs limit=%d)", error("ConnectBlock(): coinbase pays too much (actual=%d vs limit=%d)",
block.vtx[0].GetValueOut(), blockReward), block.vtx[0].GetValueOut(), blockReward),
REJECT_INVALID, "bad-cb-amount"); REJECT_INVALID, "bad-cb-amount");
} else if ( IS_KOMODO_NOTARY != 0 ) } else if ( IS_HUSH_NOTARY != 0 )
fprintf(stderr,"allow nHeight.%d coinbase %.8f vs %.8f interest %.8f\n",(int32_t)pindex->GetHeight(),dstr(block.vtx[0].GetValueOut()),dstr(blockReward),dstr(sum)); fprintf(stderr,"allow nHeight.%d coinbase %.8f vs %.8f interest %.8f\n",(int32_t)pindex->GetHeight(),dstr(block.vtx[0].GetValueOut()),dstr(blockReward),dstr(sum));
} }
if (!control.Wait()) if (!control.Wait())
@@ -7799,7 +7798,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
} }
pfrom->PushMessage("headers", vHeaders); pfrom->PushMessage("headers", vHeaders);
} }
/*else if ( IS_KOMODO_NOTARY != 0 ) /*else if ( IS_HUSH_NOTARY != 0 )
{ {
static uint32_t counter; static uint32_t counter;
if ( counter++ < 3 ) if ( counter++ < 3 )

View File

@@ -55,8 +55,6 @@
#include "sodium.h" #include "sodium.h"
#include "notaries_staked.h"
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#ifdef ENABLE_MINING #ifdef ENABLE_MINING
@@ -628,7 +626,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
else txNew.nLockTime = std::max((int64_t)(pindexPrev->nTime+1), GetTime()); else txNew.nLockTime = std::max((int64_t)(pindexPrev->nTime+1), GetTime());
if ( ASSETCHAINS_SYMBOL[0] == 0 && IS_KOMODO_NOTARY != 0 && My_notaryid >= 0 ) if ( ASSETCHAINS_SYMBOL[0] == 0 && IS_HUSH_NOTARY != 0 && My_notaryid >= 0 )
txNew.vout[0].nValue += 5000; txNew.vout[0].nValue += 5000;
pblock->vtx[0] = txNew; pblock->vtx[0] = txNew;
@@ -731,7 +729,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
} }
pblock->nSolution.clear(); pblock->nSolution.clear();
pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]); pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]);
if ( ASSETCHAINS_SYMBOL[0] == 0 && IS_KOMODO_NOTARY != 0 && My_notaryid >= 0 ) if ( ASSETCHAINS_SYMBOL[0] == 0 && IS_HUSH_NOTARY != 0 && My_notaryid >= 0 )
{ {
uint32_t r; CScript opret; void **ptr=0; uint32_t r; CScript opret; void **ptr=0;
@@ -770,7 +768,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
return(0); return(0);
} }
} }
else if ( ASSETCHAINS_CC == 0 && pindexPrev != 0 && ASSETCHAINS_STAKED == 0 && (ASSETCHAINS_SYMBOL[0] != 0 || IS_KOMODO_NOTARY == 0 || My_notaryid < 0) ) else if ( ASSETCHAINS_CC == 0 && pindexPrev != 0 && ASSETCHAINS_STAKED == 0 && (ASSETCHAINS_SYMBOL[0] != 0 || IS_HUSH_NOTARY == 0 || My_notaryid < 0) )
{ {
CValidationState state; CValidationState state;
//fprintf(stderr,"check validity\n"); //fprintf(stderr,"check validity\n");
@@ -988,7 +986,7 @@ static bool ProcessBlockFound(CBlock* pblock)
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
// Remove key from key pool // Remove key from key pool
if ( IS_KOMODO_NOTARY == 0 ) if ( IS_HUSH_NOTARY == 0 )
{ {
if (GetArg("-mineraddress", "").empty()) { if (GetArg("-mineraddress", "").empty()) {
// Remove key from key pool // Remove key from key pool
@@ -1112,7 +1110,7 @@ void static BitcoinMiner()
unsigned int n = chainparams.EquihashN(); unsigned int n = chainparams.EquihashN();
unsigned int k = chainparams.EquihashK(); unsigned int k = chainparams.EquihashK();
uint8_t *script; uint64_t total; int32_t i,j,gpucount=KOMODO_MAXGPUCOUNT,notaryid = -1; uint8_t *script; uint64_t total; int32_t i,j,gpucount=KOMODO_MAXGPUCOUNT,notaryid = -1;
while ( (ASSETCHAIN_INIT == 0 || KOMODO_INITDONE == 0) ) while ( (ASSETCHAIN_INIT == 0 || HUSH_INITDONE == 0) )
{ {
sleep(1); sleep(1);
if ( komodo_baseid(ASSETCHAINS_SYMBOL) < 0 ) if ( komodo_baseid(ASSETCHAINS_SYMBOL) < 0 )
@@ -1260,7 +1258,7 @@ void static BitcoinMiner()
if ( i == 33 ) if ( i == 33 )
externalflag = 1; externalflag = 1;
else externalflag = 0; else externalflag = 0;
if ( IS_KOMODO_NOTARY != 0 ) if ( IS_HUSH_NOTARY != 0 )
{ {
for (i=1; i<66; i++) for (i=1; i<66; i++)
if ( memcmp(pubkeys[i],pubkeys[0],33) == 0 ) if ( memcmp(pubkeys[i],pubkeys[0],33) == 0 )
@@ -1368,7 +1366,7 @@ void static BitcoinMiner()
// MilliSleep(30); // MilliSleep(30);
return false; return false;
} }
if ( IS_KOMODO_NOTARY != 0 && B.nTime > GetTime() ) if ( IS_HUSH_NOTARY != 0 && B.nTime > GetTime() )
{ {
//fprintf(stderr,"need to wait %d seconds to submit block\n",(int32_t)(B.nTime - GetTime())); //fprintf(stderr,"need to wait %d seconds to submit block\n",(int32_t)(B.nTime - GetTime()));
while ( GetTime() < B.nTime-2 ) while ( GetTime() < B.nTime-2 )
@@ -1383,7 +1381,7 @@ void static BitcoinMiner()
} }
if ( ASSETCHAINS_STAKED == 0 ) if ( ASSETCHAINS_STAKED == 0 )
{ {
if ( IS_KOMODO_NOTARY != 0 ) if ( IS_HUSH_NOTARY != 0 )
{ {
int32_t r; int32_t r;
if ( (r= ((Mining_height + NOTARY_PUBKEY33[16]) % 64) / 8) > 0 ) if ( (r= ((Mining_height + NOTARY_PUBKEY33[16]) % 64) / 8) > 0 )

View File

@@ -94,7 +94,6 @@ namespace {
// Global state variables // Global state variables
// //
extern uint16_t ASSETCHAINS_P2PPORT; extern uint16_t ASSETCHAINS_P2PPORT;
extern int8_t is_STAKED(const char *chain_name);
extern char ASSETCHAINS_SYMBOL[65]; extern char ASSETCHAINS_SYMBOL[65];
bool fDiscover = true; bool fDiscover = true;
@@ -1607,11 +1606,8 @@ void ThreadOpenConnections()
static bool done = false; static bool done = false;
if (!done) { if (!done) {
// skip DNS seeds for staked chains. // skip DNS seeds for staked chains.
if ( is_STAKED(ASSETCHAINS_SYMBOL) == 0 ) { LogPrintf("Adding fixed seed nodes.\n");
//LogPrintf("Adding fixed seed nodes as DNS doesn't seem to be available.\n"); addrman.Add(convertSeed6(Params().FixedSeeds()), CNetAddr("127.0.0.1"));
LogPrintf("Adding fixed seed nodes.\n");
addrman.Add(convertSeed6(Params().FixedSeeds()), CNetAddr("127.0.0.1"));
}
done = true; done = true;
} }
} }
@@ -2070,12 +2066,6 @@ void StartNode(boost::thread_group& threadGroup, CScheduler& scheduler)
LogPrintf("TLS is not used!\n"); LogPrintf("TLS is not used!\n");
#endif #endif
// skip DNS seeds for staked chains.
extern int8_t is_STAKED(const char *chain_name);
extern char ASSETCHAINS_SYMBOL[65];
if ( is_STAKED(ASSETCHAINS_SYMBOL) != 0 )
SoftSetBoolArg("-dnsseed", false);
// //
// Start threads // Start threads
// //

View File

@@ -1,29 +0,0 @@
#include "notaries_staked.h"
#include "crosschain.h"
#include "cc/CCinclude.h"
#include "komodo_defs.h"
#include <cstring>
extern pthread_mutex_t staked_mutex;
int8_t is_STAKED(const char *chain_name)
{
return 0;
};
int32_t STAKED_era(int timestamp)
{
return(0);
};
int8_t StakedNotaryID(std::string &notaryname, char *Raddress) {
return(-1);
}
int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era) {
return 0;
}
void UpdateNotaryAddrs(uint8_t pubkeys[64][33],int8_t numNotaries) {
}

View File

@@ -1,100 +0,0 @@
#ifndef NOTARIES_STAKED
#define NOTARIES_STAKED
#include "crosschain.h"
#include "cc/CCinclude.h"
static const int32_t dragonPort = 9333;
static const int8_t BTCminsigs = 13;
static const int8_t overrideMinSigs = 7;
static const char *dragonSeeds[8][1] =
{
{"94.23.1.95"},
{"103.6.12.112"},
{"18.224.176.46"},
{"45.76.120.247"},
{"185.62.57.32"},
{"149.28.253.160"},
{"68.183.226.124"},
{"149.28.246.230"},
};
static const int STAKED_ERA_GAP = 777;
static const int NUM_STAKED_ERAS = 4;
// Set timestamp for notary change over in position 1:
static const int STAKED_NOTARIES_TIMESTAMP[NUM_STAKED_ERAS] = {1572523200, 1704244444, 1704244444, 1704244444}; // Oct 31 noon UTC
// Set the number of keys in position 2:
static const int32_t num_notaries_STAKED[NUM_STAKED_ERAS] = { 22, 24, 1, 1 };
// Era array of pubkeys.
static const char *notaries_STAKED[NUM_STAKED_ERAS][64][2] =
{
{
{"blackjok3r", "035fc678bf796ad52f69e1f5759be54ec671c559a22adf27eed067e0ddf1531574" }, // RTcYRJ6WopYkUqcmksyjxoV1CueYyqxFuk right
{"Alright", "02b718c60a035f77b7103a507d36aed942b4f655b8d13bce6f28b8eac523944278" }, //RG77F4mQpP1K1q2CDSc2vZSJvKUZgF8R26
{"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8 right
{"CrisF", "03745656c8991c4597828aad2820760c43c00ff2e3b381fef3b5c040f32a7b3a34" }, // RNhYJAaPHJCVXGWNVEJeP3TfepEPdhjrRr right
{"smk762", "02381616fbc02d3f0398c912fe7b7daf2f3f29e55dc35287f686b15686d8135a9f" }, // RSchwBApVquaG6mXH31bQ6P83kMN4Hound right
{"jorian", "0343eec31037d7b909efd968a5b5e7af60321bf7e464da28f815f0fb23ee7aadd7" }, // RJorianBXNwfNDYPxtNYJJ6vX7Z3VdTR25 right
{"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev
{"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL right
{"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2 right
{"gt", "02312dcecb6e4a32927a075972d3c009f3c68635d8100562cc1813ea66751b9fde" }, // RCg4tzKWQ7i3wrZEU8bvCbCQ4xRJnHnyoo right
{"CMaurice", "026c6d094523e810641b89f2d7f0ddd8f0b59d97c32e1fa97f0e3e0ac119c26ae4" }, // RSjayeSuYUE1E22rBjnqoexobaRjbAZ2Yb right
{"Bar_F1sh_Rel", "0395f2d9dd9ccb78caf74bff49b6d959afb95af746462e1b35f4a167d8e82b3666" }, // RBbLxJagCA9QHDazQvfnDZe874V1K4Gu8t
{"zatJUM", "030fff499b6dc0215344b28a0b6b4becdfb00cd34cd1b36b983ec14f47965fd4bc" }, // RSoEDLBasth7anxS8gbkg6KgeGiz8rhqv1 right
{"dwy", "03669457b2934d98b5761121dd01b243aed336479625b293be9f8c43a6ae7aaeff" }, // RKhZMqRF361FSGFAzstP5AhozekPjoVh5q
{"gcharang", "021569dd350d99e685a739c5b36bd01f217efb4f448a6f9a56da80c5edf6ce20ee" }, // RE8SsNwhYoygXJSvw9DuQbJicDc28dwR78 right
{"computergenie", "027313dabde94fb72f823231d0a1c59fc7baa2e5b3bb2af97ca7d70aae116026b9" }, // RLabsCGxTRqJcJvz6foKuXAB61puJ2x8yt right
{"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943" }, //
{"SHossain", "02791f5c215b8a19c143a98e3371ff03b5613df9ac430c4a331ca55fed5761c800" }, // RKdLoHkyeorXmMtj91B1AAnAGiwsdt9MdF
{"Nabob", "03ee91c20b6d26e3604022f42df6bb8de6f669da4591f93b568778cba13d9e9ddf" }, // RRwCLPZDzpHEFJnLev4phy51e2stHRUAaU
{"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx
{"PHBA2061", "039fc98c764bc85aed97d690d7942a4fd1190b2fa4f5f4c5c8e0957fac5c6ede00" }, // RPHba2o61hcpX4ds91oj3sKJ8aDXv6QdQf right
{"Exile13", "0247b2120a39faf83678b5de6883e039180ff42925bcb298d32f3792cd59001aae" }, // RTDJ3CDZ6ANbeDKab8nqTVrGw7ViAKLeDV right
},
{
{"blackjok3r", "035fc678bf796ad52f69e1f5759be54ec671c559a22adf27eed067e0ddf1531574"}, //RTcYRJ6WopYkUqcmksyjxoV1CueYyqxFuk
{"Alright", "02b718c60a035f77b7103a507d36aed942b4f655b8d13bce6f28b8eac523944278"}, //RG77F4mQpP1K1q2CDSc2vZSJvKUZgF8R26
{"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d"}, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8
{"CrisF", "03745656c8991c4597828aad2820760c43c00ff2e3b381fef3b5c040f32a7b3a34"}, //RNhYJAaPHJCVXGWNVEJeP3TfepEPdhjrRr
{"smk762", "02381616fbc02d3f0398c912fe7b7daf2f3f29e55dc35287f686b15686d8135a9f"}, //RSchwBApVquaG6mXH31bQ6P83kMN4Hound
{"jorian", "0343eec31037d7b909efd968a5b5e7af60321bf7e464da28f815f0fb23ee7aadd7"}, //RJorianBXNwfNDYPxtNYJJ6vX7Z3VdTR25
{"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96"}, //RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev
{"CHMEX", "031938a89a44b3c11d53ac332d01a465384a75394fddfe98055ca3fed00ccff236"}, //RCyHdP6EvVDdfpFPzbfACHMhQAN6Wd3Wdv
{"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10"}, //RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2
{"gt", "02312dcecb6e4a32927a075972d3c009f3c68635d8100562cc1813ea66751b9fde"}, //RCg4tzKWQ7i3wrZEU8bvCbCQ4xRJnHnyoo
{"CMaurice", "026c6d094523e810641b89f2d7f0ddd8f0b59d97c32e1fa97f0e3e0ac119c26ae4"}, //RSjayeSuYUE1E22rBjnqoexobaRjbAZ2Yb
{"Bar_F1sh_Rel", "0395f2d9dd9ccb78caf74bff49b6d959afb95af746462e1b35f4a167d8e82b3666"}, //RBbLxJagCA9QHDazQvfnDZe874V1K4Gu8t
{"zatJUM", "030fff499b6dc0215344b28a0b6b4becdfb00cd34cd1b36b983ec14f47965fd4bc"}, //RSoEDLBasth7anxS8gbkg6KgeGiz8rhqv1
{"Oszy", "02d1dd4c5d5c00039322295aa965f9787a87d234ed4f8174231bbd6162e384eba8"}, //RWQmJQfYrZBxQhuazVrordif6sHPFJRP9W
{"gcharang", "021569dd350d99e685a739c5b36bd01f217efb4f448a6f9a56da80c5edf6ce20ee"}, //RE8SsNwhYoygXJSvw9DuQbJicDc28dwR78
{"computergenie", "027313dabde94fb72f823231d0a1c59fc7baa2e5b3bb2af97ca7d70aae116026b9"}, //RLabsCGxTRqJcJvz6foKuXAB61puJ2x8yt
{"daemonfox", "0383484bdc745b2b953c85b5a0c496a1f27bc42ae971f15779ed1532421b3dd943"}, //REScxcZm3dsWmERSax1yVgoPPadh8BYQ6k
{"SHossain", "033e90f5550dfea6c61f8d26a026ec5edcb9ecf9c69230da246f9762ee9542782d"}, //RKTwJMAs9jVSmXQq4x6jCw48i8g5xkTeQp
{"Nabob", "03ee91c20b6d26e3604022f42df6bb8de6f669da4591f93b568778cba13d9e9ddf"}, //RRwCLPZDzpHEFJnLev4phy51e2stHRUAaU
{"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09"}, //RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx
{"PHBA2061", "03f4d3b286bb3d75d0095761dcca4aef778d9eb82065f95b5f9f8b8be8cad82bc7"}, //RPHba2o61CBZ1aUQhEGhgHJhJEGsR5T68i
{"ml777", "03438497e857f346e91bb269fc00d3509ab2a4d9df14931de86c8ac39aa8d82507"}, //RCRd3jESCdEgfX4gPoZsXx1Q1RQMqMa2kR
{"bishop", "026acce6b8ac3f0ed44271f1e275f220bb66ab9ff628b70bccb67b1d7d2411b320"}, //RQEUDihRhhN316K8gVLHY1neWBJjAbrtd5
{"OldManPhil", "03d0bb79578613bb8c160d0466027ce0e7dd4d0dc6777b37460ac05342cd1e6c5b"}, //RVX3cr4J2FBDoztgF8rCuQN6vTf42XAL2U
},
{
{"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x
},
{
{"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x
}
};
int8_t is_STAKED(const char *chain_name);
int32_t STAKED_era(int timestamp);
int8_t numStakedNotaries(uint8_t pubkeys[64][33],int8_t era);
int8_t StakedNotaryID(std::string &notaryname, char *Raddress);
void UpdateNotaryAddrs(uint8_t pubkeys[64][33],int8_t numNotaries);
CrosschainAuthority Choose_auth_STAKED(int32_t chosen_era);
#endif

View File

@@ -1,17 +1,16 @@
// Copyright (c) 2019-2020 The Hush developers
// Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
#include "dbwrapper.h" #include "dbwrapper.h"
#include "notarisationdb.h" #include "notarisationdb.h"
#include "uint256.h" #include "uint256.h"
#include "cc/eval.h" #include "cc/eval.h"
#include "crosschain.h" #include "crosschain.h"
#include "main.h" #include "main.h"
#include "notaries_staked.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
NotarisationDB *pnotarisations; NotarisationDB *pnotarisations;
NotarisationDB::NotarisationDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(GetDataDir() / "notarisations", nCacheSize, fMemory, fWipe, false, 64) { } NotarisationDB::NotarisationDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWrapper(GetDataDir() / "notarisations", nCacheSize, fMemory, fWipe, false, 64) { }
@@ -19,7 +18,6 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight)
{ {
EvalRef eval; EvalRef eval;
NotarisationsInBlock vNotarisations; NotarisationsInBlock vNotarisations;
CrosschainAuthority auth_STAKED;
int timestamp = block.nTime; int timestamp = block.nTime;
for (unsigned int i = 0; i < block.vtx.size(); i++) { for (unsigned int i = 0; i < block.vtx.size(); i++) {
@@ -34,12 +32,10 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight)
//printf("Checked notarisation data for %s \n",data.symbol); //printf("Checked notarisation data for %s \n",data.symbol);
int authority = GetSymbolAuthority(data.symbol); int authority = GetSymbolAuthority(data.symbol);
if (authority == CROSSCHAIN_KOMODO) { if (authority == CROSSCHAIN_HUSH) {
if (!eval->CheckNotaryInputs(tx, nHeight, block.nTime)) if (!eval->CheckNotaryInputs(tx, nHeight, block.nTime))
continue; continue;
//printf("Authorised notarisation data for %s \n",data.symbol); //printf("Authorised notarisation data for %s \n",data.symbol);
} else if (authority == CROSSCHAIN_STAKED) {
continue;
} }
if (parsed) { if (parsed) {

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin Core developers // Copyright (c) 2009-2014 The Bitcoin Core developers
// Copyright (c) 2019 The Hush developers // Copyright (c) 2019-2020 The Hush developers
// Distributed under the GPLv3 software license, see the accompanying // Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html // file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html

View File

@@ -1,3 +1,6 @@
// Copyright (c) 2019-2020 The Hush developers
// Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
/****************************************************************************** /******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. * * Copyright © 2014-2019 The SuperNET Developers. *
* * * *
@@ -34,12 +37,9 @@
#include "script/script_error.h" #include "script/script_error.h"
#include "script/sign.h" #include "script/sign.h"
#include "script/standard.h" #include "script/standard.h"
#include "notaries_staked.h"
#include "key_io.h" #include "key_io.h"
#include "cc/CCImportGateway.h" #include "cc/CCImportGateway.h"
#include "cc/CCtokens.h" #include "cc/CCtokens.h"
#include <stdint.h> #include <stdint.h>
#include <univalue.h> #include <univalue.h>
#include <regex> #include <regex>
@@ -301,9 +301,6 @@ UniValue migrate_createburntransaction(const UniValue& params, bool fHelp, const
if( params.size() == 4 ) if( params.size() == 4 )
tokenid = Parseuint256(params[3].get_str().c_str()); tokenid = Parseuint256(params[3].get_str().c_str());
if ( tokenid != zeroid && strcmp("LABS", targetSymbol.c_str()))
throw JSONRPCError(RPC_TYPE_ERROR, "There is no tokens support on LABS.");
CPubKey myPubKey = Mypubkey(); CPubKey myPubKey = Mypubkey();
struct CCcontract_info *cpTokens, C; struct CCcontract_info *cpTokens, C;
cpTokens = CCinit(&C, EVAL_TOKENS); cpTokens = CCinit(&C, EVAL_TOKENS);
@@ -1143,11 +1140,9 @@ UniValue getNotarisationsForBlock(const UniValue& params, bool fHelp, const CPub
GetBlockNotarisations(blockHash, nibs); GetBlockNotarisations(blockHash, nibs);
UniValue out(UniValue::VOBJ); UniValue out(UniValue::VOBJ);
//out.push_back(make_pair("blocktime",(int))); //out.push_back(make_pair("blocktime",(int)));
UniValue labs(UniValue::VARR); UniValue hush(UniValue::VARR);
UniValue kmd(UniValue::VARR); int8_t numNN = 0; uint8_t notarypubkeys[64][33] = {0};
int8_t numNN = 0, numSN = 0; uint8_t notarypubkeys[64][33] = {0}; uint8_t LABSpubkeys[64][33] = {0};
numNN = komodo_notaries(notarypubkeys, height, chainActive[height]->nTime); numNN = komodo_notaries(notarypubkeys, height, chainActive[height]->nTime);
numSN = numStakedNotaries(LABSpubkeys,STAKED_era(chainActive[height]->nTime));
BOOST_FOREACH(const Notarisation& n, nibs) BOOST_FOREACH(const Notarisation& n, nibs)
{ {
@@ -1155,33 +1150,21 @@ UniValue getNotarisationsForBlock(const UniValue& params, bool fHelp, const CPub
uint256 hash; CTransaction tx; uint256 hash; CTransaction tx;
if ( myGetTransaction(n.first,tx,hash) ) if ( myGetTransaction(n.first,tx,hash) )
{ {
if ( is_STAKED(n.second.symbol) != 0 ) if ( !GetNotarisationNotaries(notarypubkeys, numNN, tx.vin, NotarisationNotaries) )
{ continue;
if ( !GetNotarisationNotaries(LABSpubkeys, numSN, tx.vin, NotarisationNotaries) )
continue;
}
else
{
if ( !GetNotarisationNotaries(notarypubkeys, numNN, tx.vin, NotarisationNotaries) )
continue;
}
} }
item.push_back(make_pair("txid", n.first.GetHex())); item.push_back(make_pair("txid", n.first.GetHex()));
item.push_back(make_pair("chain", n.second.symbol)); item.push_back(make_pair("chain", n.second.symbol));
item.push_back(make_pair("height", (int)n.second.height)); item.push_back(make_pair("height", (int)n.second.height));
item.push_back(make_pair("blockhash", n.second.blockHash.GetHex())); item.push_back(make_pair("blockhash", n.second.blockHash.GetHex()));
//item.push_back(make_pair("KMD_height", height)); // for when timstamp input is used. //item.push_back(make_pair("HUSH_height", height)); // for when timstamp input is used.
for ( auto notary : NotarisationNotaries ) for ( auto notary : NotarisationNotaries )
notaryarr.push_back(notary); notaryarr.push_back(notary);
item.push_back(make_pair("notaries",notaryarr)); item.push_back(make_pair("notaries",notaryarr));
if ( is_STAKED(n.second.symbol) != 0 ) hush.push_back(item);
labs.push_back(item);
else
kmd.push_back(item);
} }
out.push_back(make_pair("KMD", kmd)); out.push_back(make_pair("HUSH", hush));
out.push_back(make_pair("LABS", labs));
return out; return out;
} }

View File

@@ -29,7 +29,6 @@
#include "timedata.h" #include "timedata.h"
#include "txmempool.h" #include "txmempool.h"
#include "util.h" #include "util.h"
#include "notaries_staked.h"
#include "cc/eval.h" #include "cc/eval.h"
#include "cc/CCinclude.h" #include "cc/CCinclude.h"
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
@@ -38,11 +37,8 @@
#endif #endif
#include <stdint.h> #include <stdint.h>
#include <boost/assign/list_of.hpp> #include <boost/assign/list_of.hpp>
#include <univalue.h> #include <univalue.h>
#include "zcash/Address.hpp" #include "zcash/Address.hpp"
using namespace std; using namespace std;
@@ -70,15 +66,16 @@ bool komodo_txnotarizedconfirmed(uint256 txid);
uint32_t komodo_chainactive_timestamp(); uint32_t komodo_chainactive_timestamp();
int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp); int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp);
extern uint64_t KOMODO_INTERESTSUM,KOMODO_WALLETBALANCE; extern uint64_t KOMODO_INTERESTSUM,KOMODO_WALLETBALANCE;
extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE,KOMODO_LONGESTCHAIN,IS_STAKED_NOTARY,IS_KOMODO_NOTARY,STAKED_ERA,HUSH_INSYNC; extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE,KOMODO_LONGESTCHAIN,IS_HUSH_NOTARY,HUSH_INSYNC;
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
uint32_t komodo_segid32(char *coinaddr); uint32_t komodo_segid32(char *coinaddr);
int64_t komodo_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height); 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 *kmdnotarized_heightp);
int8_t StakedNotaryID(std::string &notaryname, char *Raddress);
uint64_t komodo_notarypayamount(int32_t nHeight, int64_t notarycount); 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); 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
// We only cherry-pick since then
#define KOMODO_VERSION "0.5.0" #define KOMODO_VERSION "0.5.0"
extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
extern uint32_t ASSETCHAINS_CC; extern uint32_t ASSETCHAINS_CC;
@@ -88,13 +85,10 @@ extern int32_t ASSETCHAINS_SAPLING;
extern uint64_t ASSETCHAINS_ENDSUBSIDY[],ASSETCHAINS_REWARD[],ASSETCHAINS_HALVING[],ASSETCHAINS_DECAY[],ASSETCHAINS_NOTARY_PAY[]; extern uint64_t ASSETCHAINS_ENDSUBSIDY[],ASSETCHAINS_REWARD[],ASSETCHAINS_HALVING[],ASSETCHAINS_DECAY[],ASSETCHAINS_NOTARY_PAY[];
extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; extern uint8_t NOTARY_PUBKEY33[]; extern std::string NOTARY_PUBKEY,NOTARY_ADDRESS; extern uint8_t NOTARY_PUBKEY33[];
//TODO: use non-staked eras
// Currently HUSH only uses block heights to define eras
int32_t getera(int timestamp) int32_t getera(int timestamp)
{ {
for (int32_t i = 0; i < NUM_STAKED_ERAS; i++) {
if ( timestamp <= STAKED_NOTARIES_TIMESTAMP[i] ) {
return(i);
}
}
return(0); return(0);
} }
@@ -113,23 +107,21 @@ UniValue getdragonjson(const UniValue& params, bool fHelp, const CPubKey& mypk)
// loop over seeds array and push back to json array for seeds // loop over seeds array and push back to json array for seeds
for (int8_t i = 0; i < 8; i++) { for (int8_t i = 0; i < 8; i++) {
seeds.push_back(dragonSeeds[i][0]); //seeds.push_back(dragonSeeds[i][0]);
} }
// loop over era's notaries and push back each pair to the notary array // get all current notaries
for (int8_t i = 0; i < num_notaries_STAKED[era]; i++) { for (int8_t i = 0; i < NUM_HUSH_NOTARIES; i++) {
UniValue notary(UniValue::VOBJ); UniValue notary(UniValue::VOBJ);
notary.push_back(Pair(notaries_STAKED[era][i][0],notaries_STAKED[era][i][1])); notary.push_back(notaries_elected[era][i][0]);
notaries.push_back(notary); notaries.push_back(notary);
} }
// get the min sigs .. this always rounds UP so min sigs in dragon is +1 min sigs in komodod, due to some rounding error. // TODO: should be a config param
int minsigs; int minsigs = 13;
if ( num_notaries_STAKED[era]/5 > overrideMinSigs ) int BTCminsigs = 13;
minsigs = (num_notaries_STAKED[era] / 5) + 1;
else
minsigs = overrideMinSigs;
int dragonPort = 5555;
json.push_back(Pair("port",dragonPort)); json.push_back(Pair("port",dragonPort));
json.push_back(Pair("BTCminsigs",BTCminsigs)); json.push_back(Pair("BTCminsigs",BTCminsigs));
json.push_back(Pair("minsigs",minsigs)); json.push_back(Pair("minsigs",minsigs));
@@ -153,13 +145,14 @@ UniValue getnotarysendmany(const UniValue& params, bool fHelp, const CPubKey& my
amount = params[0].get_int(); amount = params[0].get_int();
} }
//TODO: this is broke
int era = getera(time(NULL)); int era = getera(time(NULL));
UniValue ret(UniValue::VOBJ); UniValue ret(UniValue::VOBJ);
for (int i = 0; i<num_notaries_STAKED[era]; i++) for (int i = 0; i<NUM_HUSH_NOTARIES; i++)
{ {
char Raddress[18]; uint8_t pubkey33[33]; char Raddress[18]; uint8_t pubkey33[33];
decode_hex(pubkey33,33,(char *)notaries_STAKED[era][i][1]); decode_hex(pubkey33,33,(char *)notaries_elected[era][i][1]);
pubkey2addr((char *)Raddress,(uint8_t *)pubkey33); pubkey2addr((char *)Raddress,(uint8_t *)pubkey33);
ret.push_back(Pair(Raddress,amount)); ret.push_back(Pair(Raddress,amount));
} }
@@ -237,7 +230,7 @@ UniValue getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
UniValue obj(UniValue::VOBJ); UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("version", CLIENT_VERSION)); obj.push_back(Pair("version", CLIENT_VERSION));
obj.push_back(Pair("protocolversion", PROTOCOL_VERSION)); obj.push_back(Pair("protocolversion", PROTOCOL_VERSION));
// this KMD version represents the last time we did a full merge, we only cherry-pick or take nothing // this KMD version represents the last time we did a full merge, we no longer merge
// in the post-KYC "era" of KMD // in the post-KYC "era" of KMD
obj.push_back(Pair("KMDversion", KOMODO_VERSION)); // never change this again, it's set in stone. -- Duke obj.push_back(Pair("KMDversion", KOMODO_VERSION)); // never change this again, it's set in stone. -- Duke
obj.push_back(Pair("synced", HUSH_INSYNC!=0)); obj.push_back(Pair("synced", HUSH_INSYNC!=0));
@@ -299,10 +292,7 @@ UniValue getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
obj.push_back(Pair("errors", GetWarnings("statusbar"))); obj.push_back(Pair("errors", GetWarnings("statusbar")));
if ( NOTARY_PUBKEY33[0] != 0 ) { if ( NOTARY_PUBKEY33[0] != 0 ) {
char pubkeystr[65]; int32_t notaryid; std::string notaryname; char pubkeystr[65]; int32_t notaryid; std::string notaryname;
if ( (notaryid= StakedNotaryID(notaryname, (char *)NOTARY_ADDRESS.c_str())) != -1 ) { if( (notaryid= komodo_whoami(pubkeystr,(int32_t)chainActive.LastTip()->GetHeight(),komodo_chainactive_timestamp())) >= 0 ) {
obj.push_back(Pair("notaryid", notaryid));
obj.push_back(Pair("notaryname", notaryname));
} else if( (notaryid= komodo_whoami(pubkeystr,(int32_t)chainActive.LastTip()->GetHeight(),komodo_chainactive_timestamp())) >= 0 ) {
obj.push_back(Pair("notaryid", notaryid)); obj.push_back(Pair("notaryid", notaryid));
if ( KOMODO_LASTMINED != 0 ) if ( KOMODO_LASTMINED != 0 )
obj.push_back(Pair("lastmined", KOMODO_LASTMINED)); obj.push_back(Pair("lastmined", KOMODO_LASTMINED));
@@ -311,7 +301,7 @@ UniValue getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
} }
if ( ASSETCHAINS_CC != 0 ) if ( ASSETCHAINS_CC != 0 )
obj.push_back(Pair("CCid", (int)ASSETCHAINS_CC)); obj.push_back(Pair("CCid", (int)ASSETCHAINS_CC));
obj.push_back(Pair("name", ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL)); obj.push_back(Pair("name", ASSETCHAINS_SYMBOL[0] == 0 ? "HUSH" : ASSETCHAINS_SYMBOL));
obj.push_back(Pair("p2pport", ASSETCHAINS_P2PPORT)); obj.push_back(Pair("p2pport", ASSETCHAINS_P2PPORT));
obj.push_back(Pair("rpcport", ASSETCHAINS_RPCPORT)); obj.push_back(Pair("rpcport", ASSETCHAINS_RPCPORT));
@@ -333,14 +323,12 @@ UniValue getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
acDecay = std::to_string(ASSETCHAINS_DECAY[i]); acDecay = std::to_string(ASSETCHAINS_DECAY[i]);
acEndSubsidy = std::to_string(ASSETCHAINS_ENDSUBSIDY[i]); acEndSubsidy = std::to_string(ASSETCHAINS_ENDSUBSIDY[i]);
acNotaryPay = std::to_string(ASSETCHAINS_NOTARY_PAY[i]); acNotaryPay = std::to_string(ASSETCHAINS_NOTARY_PAY[i]);
} } else {
else acReward += "," + std::to_string(ASSETCHAINS_REWARD[i]);
{ acHalving += "," + std::to_string(ASSETCHAINS_HALVING[i]);
acReward += "," + std::to_string(ASSETCHAINS_REWARD[i]); acDecay += "," + std::to_string(ASSETCHAINS_DECAY[i]);
acHalving += "," + std::to_string(ASSETCHAINS_HALVING[i]);
acDecay += "," + std::to_string(ASSETCHAINS_DECAY[i]);
acEndSubsidy += "," + std::to_string(ASSETCHAINS_ENDSUBSIDY[i]); acEndSubsidy += "," + std::to_string(ASSETCHAINS_ENDSUBSIDY[i]);
acNotaryPay += "," + std::to_string(ASSETCHAINS_NOTARY_PAY[i]); acNotaryPay += "," + std::to_string(ASSETCHAINS_NOTARY_PAY[i]);
} }
} }
if (ASSETCHAINS_LASTERA > 0) if (ASSETCHAINS_LASTERA > 0)

View File

@@ -776,7 +776,7 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp, const CPubKey&
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Hush address or script: ") + name_); throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Hush address or script: ") + name_);
} }
if (!(fExperimentalMode && IS_KOMODO_NOTARY)) { if (!(fExperimentalMode && IS_HUSH_NOTARY)) {
// support of sending duplicates in createrawtransaction requires experimental features enabled and // support of sending duplicates in createrawtransaction requires experimental features enabled and
// notary flag, to prevent common users to get messed up with duplicates // notary flag, to prevent common users to get messed up with duplicates

View File

@@ -335,7 +335,6 @@ bool AsyncRPCOperation_sendmany::main_impl() {
// locktime to spend time locked coinbases // locktime to spend time locked coinbases
if (ASSETCHAINS_SYMBOL[0] == 0) if (ASSETCHAINS_SYMBOL[0] == 0)
{ {
//if ((uint32_t)chainActive.LastTip()->nTime < ASSETCHAINS_STAKED_HF_TIMESTAMP)
if ( !hush_hardfork_active((uint32_t)chainActive.LastTip()->nTime) ) if ( !hush_hardfork_active((uint32_t)chainActive.LastTip()->nTime) )
builder_.SetLockTime((uint32_t)time(NULL) - 60); // set lock time for Komodo interest builder_.SetLockTime((uint32_t)time(NULL) - 60); // set lock time for Komodo interest
else else
@@ -352,7 +351,6 @@ bool AsyncRPCOperation_sendmany::main_impl() {
} }
if (ASSETCHAINS_SYMBOL[0] == 0) if (ASSETCHAINS_SYMBOL[0] == 0)
{ {
//if ((uint32_t)chainActive.LastTip()->nTime < ASSETCHAINS_STAKED_HF_TIMESTAMP)
if ( !hush_hardfork_active((uint32_t)chainActive.LastTip()->nTime) ) if ( !hush_hardfork_active((uint32_t)chainActive.LastTip()->nTime) )
rawTx.nLockTime = (uint32_t)time(NULL) - 60; // jl777 rawTx.nLockTime = (uint32_t)time(NULL) - 60; // jl777
else else
@@ -716,7 +714,6 @@ void AsyncRPCOperation_sendmany::add_taddr_outputs_to_tx() {
CTxOut out(nAmount, scriptPubKey); CTxOut out(nAmount, scriptPubKey);
rawTx.vout.push_back(out); rawTx.vout.push_back(out);
} }
//if ((uint32_t)chainActive.LastTip()->nTime < ASSETCHAINS_STAKED_HF_TIMESTAMP)
if ( !hush_hardfork_active((uint32_t)chainActive.LastTip()->nTime) ) if ( !hush_hardfork_active((uint32_t)chainActive.LastTip()->nTime) )
rawTx.nLockTime = (uint32_t)time(NULL) - 60; // jl777 rawTx.nLockTime = (uint32_t)time(NULL) - 60; // jl777
else else
@@ -747,7 +744,6 @@ void AsyncRPCOperation_sendmany::add_taddr_change_output_to_tx(CBitcoinAddress *
CMutableTransaction rawTx(tx_); CMutableTransaction rawTx(tx_);
rawTx.vout.push_back(out); rawTx.vout.push_back(out);
//if ((uint32_t)chainActive.LastTip()->nTime < ASSETCHAINS_STAKED_HF_TIMESTAMP)
if ( !hush_hardfork_active((uint32_t)chainActive.LastTip()->nTime) ) if ( !hush_hardfork_active((uint32_t)chainActive.LastTip()->nTime) )
rawTx.nLockTime = (uint32_t)time(NULL) - 60; // jl777 rawTx.nLockTime = (uint32_t)time(NULL) - 60; // jl777
else else

View File

@@ -39,34 +39,24 @@
#include "script/interpreter.h" #include "script/interpreter.h"
#include "zcash/zip32.h" #include "zcash/zip32.h"
#include "zcash/Note.hpp" #include "zcash/Note.hpp"
#include "notaries_staked.h"
#include "utiltime.h" #include "utiltime.h"
#include "asyncrpcoperation.h" #include "asyncrpcoperation.h"
#include "asyncrpcqueue.h" #include "asyncrpcqueue.h"
#include "wallet/asyncrpcoperation_mergetoaddress.h" #include "wallet/asyncrpcoperation_mergetoaddress.h"
#include "wallet/asyncrpcoperation_sendmany.h" #include "wallet/asyncrpcoperation_sendmany.h"
#include "wallet/asyncrpcoperation_shieldcoinbase.h" #include "wallet/asyncrpcoperation_shieldcoinbase.h"
#include "consensus/upgrades.h" #include "consensus/upgrades.h"
#include "sodium.h" #include "sodium.h"
#include <stdint.h> #include <stdint.h>
#include <boost/assign/list_of.hpp> #include <boost/assign/list_of.hpp>
#include <utf8.h> #include <utf8.h>
#include <univalue.h> #include <univalue.h>
#include <numeric> #include <numeric>
#include "komodo_defs.h" #include "komodo_defs.h"
#include <string.h> #include <string.h>
#include "rpchushwallet.h" #include "rpchushwallet.h"
using namespace std; using namespace std;
using namespace libzcash; using namespace libzcash;
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
@@ -88,6 +78,7 @@ extern string newSietchZaddr();
int64_t nWalletUnlockTime; int64_t nWalletUnlockTime;
static CCriticalSection cs_nWalletUnlockTime; static CCriticalSection cs_nWalletUnlockTime;
std::string CCerror; std::string CCerror;
char *uint256_str(char *dest,uint256 txid);
// Private method: // Private method:
UniValue z_getoperationstatus_IMPL(const UniValue&, bool); UniValue z_getoperationstatus_IMPL(const UniValue&, bool);
@@ -4424,7 +4415,7 @@ UniValue z_viewtransaction(const UniValue& params, bool fHelp, const CPubKey& my
entry.push_back(Pair("anchor", uint256_str(str,spend.anchor))); entry.push_back(Pair("anchor", uint256_str(str,spend.anchor)));
entry.push_back(Pair("commitment", uint256_str(str,spend.cv))); entry.push_back(Pair("commitment", uint256_str(str,spend.cv)));
entry.push_back(Pair("rk", uint256_str(str,spend.rk))); entry.push_back(Pair("rk", uint256_str(str,spend.rk)));
//TODO: how to get list of wtinesses and height? //TODO: how to get list of witnesses and height?
//entry.push_back(Pair("witnessHeight", op.witnessHeight)); //entry.push_back(Pair("witnessHeight", op.witnessHeight));
entry.push_back(Pair("spendAuthSig", HexStr(spend.spendAuthSig.begin(), spend.spendAuthSig.end()))); entry.push_back(Pair("spendAuthSig", HexStr(spend.spendAuthSig.begin(), spend.spendAuthSig.end())));
entry.push_back(Pair("zkproof", HexStr(spend.zkproof.begin(), spend.zkproof.end()))); entry.push_back(Pair("zkproof", HexStr(spend.zkproof.begin(), spend.zkproof.end())));

View File

@@ -3633,7 +3633,6 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
int nextBlockHeight = chainActive.Height() + 1; int nextBlockHeight = chainActive.Height() + 1;
CMutableTransaction txNew = CreateNewContextualCMutableTransaction(Params().GetConsensus(), nextBlockHeight); CMutableTransaction txNew = CreateNewContextualCMutableTransaction(Params().GetConsensus(), nextBlockHeight);
//if ((uint32_t)chainActive.LastTip()->nTime < ASSETCHAINS_STAKED_HF_TIMESTAMP)
if ( !hush_hardfork_active((uint32_t)chainActive.LastTip()->nTime) ) if ( !hush_hardfork_active((uint32_t)chainActive.LastTip()->nTime) )
txNew.nLockTime = (uint32_t)chainActive.LastTip()->nTime + 1; // set to a time close to now txNew.nLockTime = (uint32_t)chainActive.LastTip()->nTime + 1; // set to a time close to now
else else

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright (c) 2019 The Hush developers # Copyright (c) 2019-2020 The Hush developers
# Released under the GPLv3 # Released under the GPLv3
set -eu -o pipefail set -eu -o pipefail