mirror of
https://git.hush.is/hush/hush3.git
synced 2025-07-27 00:02:08 -04:00
Compare commits
14 Commits
c33bd61480
...
ae08c6ef56
Author | SHA1 | Date | |
---|---|---|---|
|
ae08c6ef56 | ||
|
e5dc287d2f | ||
|
90133dbc0e | ||
|
1db3fb0429 | ||
|
20fdc0e4fe | ||
|
19aa83ca80 | ||
|
2a2391f0f9 | ||
|
497ace0922 | ||
|
943ffbc1bf | ||
|
d8840beb3b | ||
|
0f5e291f9f | ||
|
77ab75c01d | ||
|
4b7f94effa | ||
|
43aa4a7d90 |
@ -7,14 +7,18 @@ use strict;
|
|||||||
|
|
||||||
# Given a block time, estimate when it will happen
|
# Given a block time, estimate when it will happen
|
||||||
my $block = shift || die "Usage: $0 123";
|
my $block = shift || die "Usage: $0 123";
|
||||||
|
my $coin = shift || '';
|
||||||
my $hush = "./src/hush-cli";
|
my $hush = "./src/hush-cli";
|
||||||
unless (-e $hush) {
|
unless (-e $hush) {
|
||||||
die "$hush does not exist, aborting";
|
die "$hush does not exist, aborting";
|
||||||
}
|
}
|
||||||
|
if ($coin) {
|
||||||
|
$hush .= " -ac_name=$coin";
|
||||||
|
}
|
||||||
my $blockcount = qx{$hush getblockcount};
|
my $blockcount = qx{$hush getblockcount};
|
||||||
|
|
||||||
unless ($blockcount = int($blockcount)) {
|
unless ($blockcount = int($blockcount)) {
|
||||||
print "Invalid response from hush-cli\n";
|
print "Invalid response from $hush\n";
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,13 +26,24 @@ if ($block <= $blockcount) {
|
|||||||
die "That block has already happened!";
|
die "That block has already happened!";
|
||||||
} else {
|
} else {
|
||||||
my $diff = $block - $blockcount;
|
my $diff = $block - $blockcount;
|
||||||
my $minutes = $diff*1.25; # 75s in minutes
|
my $minpb = 1.25; # 75s in minutes for HUSH3
|
||||||
|
if ($coin eq 'DRAGONX') {
|
||||||
|
$minpb = 0.6; # minutes per block
|
||||||
|
} elsif ($coin) {
|
||||||
|
# TODO: support custom bloctimes
|
||||||
|
$minpb = 1; # assumes default blocktime of 60s
|
||||||
|
}
|
||||||
|
my $minutes = $diff*$minpb;
|
||||||
my $seconds = $minutes*60;
|
my $seconds = $minutes*60;
|
||||||
my $now = time;
|
my $now = time;
|
||||||
my $then = $now + $seconds;
|
my $then = $now + $seconds;
|
||||||
my $ldate = localtime($then);
|
my $ldate = localtime($then);
|
||||||
my $gmdate = gmtime($then);
|
my $gmdate = gmtime($then);
|
||||||
print "Hush Block $block will happen at roughly:\n";
|
if ($coin) {
|
||||||
|
print "$coin Block $block will happen at roughly:\n";
|
||||||
|
} else {
|
||||||
|
print "Hush Block $block will happen at roughly:\n";
|
||||||
|
}
|
||||||
print "$ldate Eastern # $then\n";
|
print "$ldate Eastern # $then\n";
|
||||||
print "$gmdate GMT # $then\n";
|
print "$gmdate GMT # $then\n";
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,6 @@ BITCOIN_CORE_H = \
|
|||||||
consensus/validation.h \
|
consensus/validation.h \
|
||||||
core_io.h \
|
core_io.h \
|
||||||
core_memusage.h \
|
core_memusage.h \
|
||||||
deprecation.h \
|
|
||||||
fs.h \
|
fs.h \
|
||||||
hash.h \
|
hash.h \
|
||||||
httprpc.h \
|
httprpc.h \
|
||||||
@ -300,7 +299,6 @@ libbitcoin_server_a_SOURCES = \
|
|||||||
fs.cpp \
|
fs.cpp \
|
||||||
crosschain.cpp \
|
crosschain.cpp \
|
||||||
crosschain_authority.cpp \
|
crosschain_authority.cpp \
|
||||||
deprecation.cpp \
|
|
||||||
httprpc.cpp \
|
httprpc.cpp \
|
||||||
httpserver.cpp \
|
httpserver.cpp \
|
||||||
i2p.cpp \
|
i2p.cpp \
|
||||||
|
@ -1,62 +0,0 @@
|
|||||||
// Copyright (c) 2017 The Zcash developers
|
|
||||||
// Copyright (c) 2016-2023 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. *
|
|
||||||
* *
|
|
||||||
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
|
|
||||||
* the top-level directory of this distribution for the individual copyright *
|
|
||||||
* holder information and the developer policies on copyright and licensing. *
|
|
||||||
* *
|
|
||||||
* Unless otherwise agreed in a custom licensing agreement, no part of the *
|
|
||||||
* SuperNET software, including this file may be copied, modified, propagated *
|
|
||||||
* or distributed except according to the terms contained in the LICENSE file *
|
|
||||||
* *
|
|
||||||
* Removal or modification of this copyright notice is prohibited. *
|
|
||||||
* *
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
#include "deprecation.h"
|
|
||||||
#include "clientversion.h"
|
|
||||||
#include "init.h"
|
|
||||||
#include "ui_interface.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "chainparams.h"
|
|
||||||
|
|
||||||
static const std::string CLIENT_VERSION_STR = FormatVersion(CLIENT_VERSION);
|
|
||||||
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
|
|
||||||
|
|
||||||
void EnforceNodeDeprecation(int nHeight, bool forceLogging, bool fThread) {
|
|
||||||
|
|
||||||
// Do not enforce deprecation in regtest or on testnet
|
|
||||||
std::string networkID = Params().NetworkIDString();
|
|
||||||
std::string msg;
|
|
||||||
|
|
||||||
if (networkID != "main" || SMART_CHAIN_SYMBOL[0] != 0 ) return;
|
|
||||||
|
|
||||||
int blocksToDeprecation = DEPRECATION_HEIGHT - nHeight;
|
|
||||||
if (blocksToDeprecation <= 0) {
|
|
||||||
// In order to ensure we only log once per process when deprecation is
|
|
||||||
// disabled (to avoid log spam), we only need to log in two cases:
|
|
||||||
// - The deprecating block just arrived
|
|
||||||
// - This can be triggered more than once if a block chain reorg
|
|
||||||
// occurs, but that's an irregular event that won't cause spam.
|
|
||||||
// - The node is starting
|
|
||||||
if (blocksToDeprecation == 0 || forceLogging) {
|
|
||||||
msg = strprintf(_("This version has been deprecated as of block height %d."),
|
|
||||||
DEPRECATION_HEIGHT) + " " +
|
|
||||||
_("You should upgrade to the latest version of Hush.");
|
|
||||||
LogPrintf("*** %s\n", msg);
|
|
||||||
uiInterface.ThreadSafeMessageBox(msg, "", CClientUIInterface::MSG_ERROR);
|
|
||||||
}
|
|
||||||
StartShutdown();
|
|
||||||
} else if (blocksToDeprecation == DEPRECATION_WARN_LIMIT || (blocksToDeprecation < DEPRECATION_WARN_LIMIT && forceLogging)) {
|
|
||||||
msg = strprintf(_("This version will be deprecated at block height %d, and will automatically shut down."),
|
|
||||||
DEPRECATION_HEIGHT) + " " +
|
|
||||||
_("You should upgrade to the latest version of Hush.");
|
|
||||||
LogPrintf("*** %s\n", msg);
|
|
||||||
uiInterface.ThreadSafeMessageBox(msg, "", CClientUIInterface::MSG_WARNING);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
// Copyright (c) 2017 The Zcash developers
|
|
||||||
// Copyright (c) 2016-2023 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. *
|
|
||||||
* *
|
|
||||||
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
|
|
||||||
* the top-level directory of this distribution for the individual copyright *
|
|
||||||
* holder information and the developer policies on copyright and licensing. *
|
|
||||||
* *
|
|
||||||
* Unless otherwise agreed in a custom licensing agreement, no part of the *
|
|
||||||
* SuperNET software, including this file may be copied, modified, propagated *
|
|
||||||
* or distributed except according to the terms contained in the LICENSE file *
|
|
||||||
* *
|
|
||||||
* Removal or modification of this copyright notice is prohibited. *
|
|
||||||
* *
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
#ifndef ZCASH_DEPRECATION_H
|
|
||||||
#define ZCASH_DEPRECATION_H
|
|
||||||
|
|
||||||
// Deprecation policy:
|
|
||||||
// * Shut down WEEKS_UNTIL_DEPRECATION weeks' worth of blocks after the estimated release block height.
|
|
||||||
// * A warning is shown during the DEPRECATION_WARN_LIMIT worth of blocks prior to shut down.
|
|
||||||
static const int WEEKS_UNTIL_DEPRECATION = 52;
|
|
||||||
static const int DEPRECATION_HEIGHT = 5555555;
|
|
||||||
static const int APPROX_RELEASE_HEIGHT = DEPRECATION_HEIGHT - (WEEKS_UNTIL_DEPRECATION * 7 * 24 * 60);
|
|
||||||
|
|
||||||
// Number of blocks before deprecation to warn users
|
|
||||||
static const int DEPRECATION_WARN_LIMIT = 60 * 24 * 60; // 2 months
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether the node is deprecated based on the current block height, and
|
|
||||||
* shuts down the node with an error if so (and deprecation is not disabled for
|
|
||||||
* the current client version).
|
|
||||||
*/
|
|
||||||
void EnforceNodeDeprecation(int nHeight, bool forceLogging=false, bool fThread=true);
|
|
||||||
|
|
||||||
#endif // ZCASH_DEPRECATION_H
|
|
@ -1,153 +0,0 @@
|
|||||||
// Copyright (c) 2016-2023 The Hush developers
|
|
||||||
// Distributed under the GPLv3 software license, see the accompanying
|
|
||||||
// Released under the GPLv3
|
|
||||||
|
|
||||||
#include <gmock/gmock.h>
|
|
||||||
#include <gtest/gtest.h>
|
|
||||||
|
|
||||||
#include "chainparams.h"
|
|
||||||
#include "clientversion.h"
|
|
||||||
#include "deprecation.h"
|
|
||||||
#include "init.h"
|
|
||||||
#include "ui_interface.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "util/strencodings.h"
|
|
||||||
|
|
||||||
#include <boost/filesystem/operations.hpp>
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
using ::testing::StrictMock;
|
|
||||||
|
|
||||||
static const std::string CLIENT_VERSION_STR = FormatVersion(CLIENT_VERSION);
|
|
||||||
extern std::atomic<bool> fRequestShutdown;
|
|
||||||
|
|
||||||
class MockUIInterface {
|
|
||||||
public:
|
|
||||||
MOCK_METHOD3(ThreadSafeMessageBox, bool(const std::string& message,
|
|
||||||
const std::string& caption,
|
|
||||||
unsigned int style));
|
|
||||||
};
|
|
||||||
|
|
||||||
static bool ThreadSafeMessageBox(MockUIInterface *mock,
|
|
||||||
const std::string& message,
|
|
||||||
const std::string& caption,
|
|
||||||
unsigned int style)
|
|
||||||
{
|
|
||||||
return mock->ThreadSafeMessageBox(message, caption, style);
|
|
||||||
}
|
|
||||||
|
|
||||||
class DeprecationTest : public ::testing::Test {
|
|
||||||
protected:
|
|
||||||
virtual void SetUp() {
|
|
||||||
uiInterface.ThreadSafeMessageBox.disconnect_all_slots();
|
|
||||||
uiInterface.ThreadSafeMessageBox.connect(boost::bind(ThreadSafeMessageBox, &mock_, _1, _2, _3));
|
|
||||||
SelectParams(CBaseChainParams::MAIN);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void TearDown() {
|
|
||||||
fRequestShutdown = false;
|
|
||||||
mapArgs.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
StrictMock<MockUIInterface> mock_;
|
|
||||||
|
|
||||||
static std::vector<std::string> read_lines(boost::filesystem::path filepath) {
|
|
||||||
std::vector<std::string> result;
|
|
||||||
|
|
||||||
std::ifstream f(filepath.string().c_str());
|
|
||||||
std::string line;
|
|
||||||
while (std::getline(f,line)) {
|
|
||||||
result.push_back(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
TEST_F(DeprecationTest, NonDeprecatedNodeKeepsRunning) {
|
|
||||||
EXPECT_FALSE(ShutdownRequested());
|
|
||||||
EnforceNodeDeprecation(DEPRECATION_HEIGHT - DEPRECATION_WARN_LIMIT - 1);
|
|
||||||
EXPECT_FALSE(ShutdownRequested());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(DeprecationTest, NodeNearDeprecationIsWarned) {
|
|
||||||
EXPECT_FALSE(ShutdownRequested());
|
|
||||||
EXPECT_CALL(mock_, ThreadSafeMessageBox(::testing::_, "", CClientUIInterface::MSG_WARNING));
|
|
||||||
EnforceNodeDeprecation(DEPRECATION_HEIGHT - DEPRECATION_WARN_LIMIT);
|
|
||||||
EXPECT_FALSE(ShutdownRequested());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(DeprecationTest, NodeNearDeprecationWarningIsNotDuplicated) {
|
|
||||||
EXPECT_FALSE(ShutdownRequested());
|
|
||||||
EnforceNodeDeprecation(DEPRECATION_HEIGHT - DEPRECATION_WARN_LIMIT + 1);
|
|
||||||
EXPECT_FALSE(ShutdownRequested());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(DeprecationTest, NodeNearDeprecationWarningIsRepeatedOnStartup) {
|
|
||||||
EXPECT_FALSE(ShutdownRequested());
|
|
||||||
EXPECT_CALL(mock_, ThreadSafeMessageBox(::testing::_, "", CClientUIInterface::MSG_WARNING));
|
|
||||||
EnforceNodeDeprecation(DEPRECATION_HEIGHT - DEPRECATION_WARN_LIMIT + 1, true);
|
|
||||||
EXPECT_FALSE(ShutdownRequested());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(DeprecationTest, DeprecatedNodeShutsDown) {
|
|
||||||
EXPECT_FALSE(ShutdownRequested());
|
|
||||||
EXPECT_CALL(mock_, ThreadSafeMessageBox(::testing::_, "", CClientUIInterface::MSG_ERROR));
|
|
||||||
EnforceNodeDeprecation(DEPRECATION_HEIGHT);
|
|
||||||
EXPECT_TRUE(ShutdownRequested());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(DeprecationTest, DeprecatedNodeErrorIsNotDuplicated) {
|
|
||||||
EXPECT_FALSE(ShutdownRequested());
|
|
||||||
EnforceNodeDeprecation(DEPRECATION_HEIGHT + 1);
|
|
||||||
EXPECT_TRUE(ShutdownRequested());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(DeprecationTest, DeprecatedNodeErrorIsRepeatedOnStartup) {
|
|
||||||
EXPECT_FALSE(ShutdownRequested());
|
|
||||||
EXPECT_CALL(mock_, ThreadSafeMessageBox(::testing::_, "", CClientUIInterface::MSG_ERROR));
|
|
||||||
EnforceNodeDeprecation(DEPRECATION_HEIGHT + 1, true);
|
|
||||||
EXPECT_TRUE(ShutdownRequested());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(DeprecationTest, DeprecatedNodeIgnoredOnRegtest) {
|
|
||||||
SelectParams(CBaseChainParams::REGTEST);
|
|
||||||
EXPECT_FALSE(ShutdownRequested());
|
|
||||||
EnforceNodeDeprecation(DEPRECATION_HEIGHT+1);
|
|
||||||
EXPECT_FALSE(ShutdownRequested());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(DeprecationTest, DeprecatedNodeIgnoredOnTestnet) {
|
|
||||||
SelectParams(CBaseChainParams::TESTNET);
|
|
||||||
EXPECT_FALSE(ShutdownRequested());
|
|
||||||
EnforceNodeDeprecation(DEPRECATION_HEIGHT+1);
|
|
||||||
EXPECT_FALSE(ShutdownRequested());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(DeprecationTest, AlertNotify) {
|
|
||||||
boost::filesystem::path temp = GetTempPath() /
|
|
||||||
boost::filesystem::unique_path("alertnotify-%%%%.txt");
|
|
||||||
|
|
||||||
mapArgs["-alertnotify"] = std::string("echo %s >> ") + temp.string();
|
|
||||||
|
|
||||||
EXPECT_CALL(mock_, ThreadSafeMessageBox(::testing::_, "", CClientUIInterface::MSG_WARNING));
|
|
||||||
EnforceNodeDeprecation(DEPRECATION_HEIGHT - DEPRECATION_WARN_LIMIT, false, false);
|
|
||||||
|
|
||||||
std::vector<std::string> r = read_lines(temp);
|
|
||||||
EXPECT_EQ(r.size(), 1u);
|
|
||||||
|
|
||||||
// -alertnotify restricts the message to safe characters.
|
|
||||||
auto expectedMsg = strprintf(
|
|
||||||
"This version will be deprecated at block height %d, and will automatically shut down. You should upgrade to the latest version of Hush.",
|
|
||||||
DEPRECATION_HEIGHT);
|
|
||||||
|
|
||||||
// Windows built-in echo semantics are different than posixy shells. Quotes and
|
|
||||||
// whitespace are printed literally.
|
|
||||||
#ifndef WIN32
|
|
||||||
EXPECT_EQ(r[0], expectedMsg);
|
|
||||||
#else
|
|
||||||
EXPECT_EQ(r[0], strprintf("'%s' ", expectedMsg));
|
|
||||||
#endif
|
|
||||||
boost::filesystem::remove(temp);
|
|
||||||
}
|
|
@ -551,34 +551,6 @@ CScript hush_makeopret(CBlock *pblock, bool fNew)
|
|||||||
return(opret);
|
return(opret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*uint256 hush_getblockhash(int32_t height)
|
|
||||||
{
|
|
||||||
uint256 hash; char params[128],*hexstr,*jsonstr; cJSON *result; int32_t i; uint8_t revbuf[32];
|
|
||||||
memset(&hash,0,sizeof(hash));
|
|
||||||
sprintf(params,"[%d]",height);
|
|
||||||
if ( (jsonstr= hush_issuemethod(HUSHUSERPASS,(char *)"getblockhash",params,BITCOIND_RPCPORT)) != 0 )
|
|
||||||
{
|
|
||||||
if ( (result= cJSON_Parse(jsonstr)) != 0 )
|
|
||||||
{
|
|
||||||
if ( (hexstr= jstr(result,(char *)"result")) != 0 )
|
|
||||||
{
|
|
||||||
if ( is_hexstr(hexstr,0) == 64 )
|
|
||||||
{
|
|
||||||
decode_hex(revbuf,32,hexstr);
|
|
||||||
for (i=0; i<32; i++)
|
|
||||||
((uint8_t *)&hash)[i] = revbuf[31-i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free_json(result);
|
|
||||||
}
|
|
||||||
printf("HUSH3 hash.%d (%s) %x\n",height,jsonstr,*(uint32_t *)&hash);
|
|
||||||
free(jsonstr);
|
|
||||||
}
|
|
||||||
return(hash);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint256 _hush_getblockhash(int32_t height);*/
|
|
||||||
|
|
||||||
uint64_t hush_seed(int32_t height)
|
uint64_t hush_seed(int32_t height)
|
||||||
{
|
{
|
||||||
uint64_t seed = 0;
|
uint64_t seed = 0;
|
||||||
@ -724,6 +696,7 @@ int32_t hush_block2height(CBlock *block)
|
|||||||
return(height);
|
return(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return true if the first output of the first tx in a block is valid
|
||||||
int32_t hush_block2pubkey33(uint8_t *pubkey33,CBlock *block)
|
int32_t hush_block2pubkey33(uint8_t *pubkey33,CBlock *block)
|
||||||
{
|
{
|
||||||
int32_t n;
|
int32_t n;
|
||||||
@ -976,7 +949,7 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams);
|
|||||||
// 10% of all block rewards go towards Hush core team
|
// 10% of all block rewards go towards Hush core team
|
||||||
// If you do not like this, you are encouraged to fork the chain
|
// If you do not like this, you are encouraged to fork the chain
|
||||||
// or start your own Hush Smart Chain: https://git.hush.is/hush/hush-smart-chains
|
// or start your own Hush Smart Chain: https://git.hush.is/hush/hush-smart-chains
|
||||||
// HUSH supply curve cannot be exactly represented via KMD AC CLI args, so we do it ourselves.
|
// HUSH supply curve cannot be exactly represented via CLI args, so we do it ourselves.
|
||||||
// You specify the BR, and the FR % gets added so 10% of 12.5 is 1.25
|
// You specify the BR, and the FR % gets added so 10% of 12.5 is 1.25
|
||||||
// but to tell the AC params, I need to say "11% of 11.25" is 1.25
|
// but to tell the AC params, I need to say "11% of 11.25" is 1.25
|
||||||
// 11% ie. 1/9th cannot be exactly represented and so the FR has tiny amounts of error unless done manually
|
// 11% ie. 1/9th cannot be exactly represented and so the FR has tiny amounts of error unless done manually
|
||||||
@ -1619,7 +1592,10 @@ int64_t hush_checkcommission(CBlock *pblock,int32_t height)
|
|||||||
if(fDebug)
|
if(fDebug)
|
||||||
fprintf(stderr,"%s at height=%d\n",__func__,height);
|
fprintf(stderr,"%s at height=%d\n",__func__,height);
|
||||||
int64_t checktoshis=0; uint8_t *script,scripthex[8192]; int32_t scriptlen,matched = 0; static bool didinit = false;
|
int64_t checktoshis=0; uint8_t *script,scripthex[8192]; int32_t scriptlen,matched = 0; static bool didinit = false;
|
||||||
ASSETCHAINS_SCRIPTPUB = devtax_scriptpub_for_height(height);
|
|
||||||
|
// Create a local variable instead of modifying the global ASSETCHAINS_SCRIPTPUB
|
||||||
|
auto assetchains_scriptpub = devtax_scriptpub_for_height(height);
|
||||||
|
|
||||||
if ( ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_FOUNDERS_REWARD != 0 )
|
if ( ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_FOUNDERS_REWARD != 0 )
|
||||||
{
|
{
|
||||||
checktoshis = the_commission(pblock,height);
|
checktoshis = the_commission(pblock,height);
|
||||||
@ -1639,19 +1615,22 @@ int64_t hush_checkcommission(CBlock *pblock,int32_t height)
|
|||||||
fprintf(stderr,"%02x",script[i]);
|
fprintf(stderr,"%02x",script[i]);
|
||||||
fprintf(stderr," vout[1] %.8f vs %.8f\n",(double)checktoshis/COIN,(double)pblock->vtx[0].vout[1].nValue/COIN);
|
fprintf(stderr," vout[1] %.8f vs %.8f\n",(double)checktoshis/COIN,(double)pblock->vtx[0].vout[1].nValue/COIN);
|
||||||
}
|
}
|
||||||
if ( ASSETCHAINS_SCRIPTPUB.size() > 1 )
|
if ( assetchains_scriptpub.size() > 1 )
|
||||||
{
|
{
|
||||||
static bool didinit = false;
|
static bool didinit = false;
|
||||||
if ( !didinit && height > HUSH_EARLYTXID_HEIGHT && HUSH_EARLYTXID != zeroid && hush_appendACscriptpub() )
|
if ( !didinit && height > HUSH_EARLYTXID_HEIGHT && HUSH_EARLYTXID != zeroid && hush_appendACscriptpub() )
|
||||||
{
|
{
|
||||||
fprintf(stderr, "appended CC_op_return to ASSETCHAINS_SCRIPTPUB.%s\n", ASSETCHAINS_SCRIPTPUB.c_str());
|
fprintf(stderr, "appended CC_op_return to assetchains_scriptpub.%s\n", assetchains_scriptpub.c_str());
|
||||||
didinit = true;
|
didinit = true;
|
||||||
}
|
}
|
||||||
if ( ASSETCHAINS_SCRIPTPUB.size()/2 == scriptlen && scriptlen < sizeof(scripthex) )
|
if ( assetchains_scriptpub.size()/2 == scriptlen && scriptlen < sizeof(scripthex) )
|
||||||
{
|
{
|
||||||
decode_hex(scripthex,scriptlen,(char *)ASSETCHAINS_SCRIPTPUB.c_str());
|
decode_hex(scripthex,scriptlen,(char *)assetchains_scriptpub.c_str());
|
||||||
if ( memcmp(scripthex,script,scriptlen) == 0 )
|
if ( memcmp(scripthex,script,scriptlen) == 0 ) {
|
||||||
matched = scriptlen;
|
matched = scriptlen;
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "%s: assetchains_scriptpub != scripthex scriptlen=%d\n", __func__, scriptlen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( scriptlen == 35 && script[0] == 33 && script[34] == OP_CHECKSIG && memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) == 0 )
|
else if ( scriptlen == 35 && script[0] == 33 && script[34] == OP_CHECKSIG && memcmp(script+1,ASSETCHAINS_OVERRIDE_PUBKEY33,33) == 0 )
|
||||||
@ -1660,19 +1639,19 @@ int64_t hush_checkcommission(CBlock *pblock,int32_t height)
|
|||||||
matched = 25;
|
matched = 25;
|
||||||
if ( matched == 0 )
|
if ( matched == 0 )
|
||||||
{
|
{
|
||||||
if ( ASSETCHAINS_SCRIPTPUB.size() > 1 )
|
if ( assetchains_scriptpub.size() > 1 )
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
fprintf(stderr,"%s: ASSETCHAINS_SCRIPTPUB=", __func__);
|
fprintf(stderr,"%s: assetchains_scriptpub=", __func__);
|
||||||
for (i=0; i<ASSETCHAINS_SCRIPTPUB.size(); i++) {
|
for (i=0; i<assetchains_scriptpub.size(); i++) {
|
||||||
fprintf(stderr,"%02x",ASSETCHAINS_SCRIPTPUB[i]);
|
fprintf(stderr,"%02x",assetchains_scriptpub[i]);
|
||||||
}
|
}
|
||||||
fprintf(stderr," vs script=");
|
fprintf(stderr," vs script=");
|
||||||
for (i=0; i<scriptlen; i++) {
|
for (i=0; i<scriptlen; i++) {
|
||||||
fprintf(stderr,"%02x",script[i]);
|
fprintf(stderr,"%02x",script[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(stderr," -ac[%d] payment to wrong pubkey scriptlen.%d, scriptpub[%d] checktoshis.%llu\n",(int32_t)ASSETCHAINS_SCRIPTPUB.size(),scriptlen,(int32_t)ASSETCHAINS_SCRIPTPUB.size()/2,(long long)checktoshis);
|
fprintf(stderr," -ac[%d] payment to wrong pubkey scriptlen.%d, scriptpub[%d] checktoshis.%llu\n",(int32_t)assetchains_scriptpub.size(),scriptlen,(int32_t)assetchains_scriptpub.size()/2,(long long)checktoshis);
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1692,7 +1671,8 @@ bool HUSH_TEST_ASSETCHAIN_SKIP_POW = 0;
|
|||||||
|
|
||||||
int32_t hush_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
|
int32_t hush_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
|
||||||
{
|
{
|
||||||
uint256 hash,merkleroot; arith_uint256 bnTarget,bhash; bool fNegative,fOverflow; uint8_t *script,pubkey33[33],pubkeys[64][33]; int32_t i,scriptlen,possible,PoSperc,is_PoSblock=0,n,failed = 0,notaryid = -1; int64_t checktoshis,value; CBlockIndex *pprev;
|
uint256 hash,merkleroot; arith_uint256 bnTarget,bhash; bool fNegative,fOverflow; uint8_t *script,pubkey33[33];
|
||||||
|
int32_t i,scriptlen,possible,PoSperc,is_PoSblock=0,n,failed = 0,notaryid = -1; int64_t checktoshis,value; CBlockIndex *pprev;
|
||||||
if ( HUSH_TEST_ASSETCHAIN_SKIP_POW == 0 && Params().NetworkIDString() == "regtest" )
|
if ( HUSH_TEST_ASSETCHAIN_SKIP_POW == 0 && Params().NetworkIDString() == "regtest" )
|
||||||
HUSH_TEST_ASSETCHAIN_SKIP_POW = 1;
|
HUSH_TEST_ASSETCHAIN_SKIP_POW = 1;
|
||||||
if ( !CheckEquihashSolution(pblock, Params()) )
|
if ( !CheckEquihashSolution(pblock, Params()) )
|
||||||
@ -1718,18 +1698,7 @@ int32_t hush_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
|
|||||||
|
|
||||||
if ( (SMART_CHAIN_SYMBOL[0] != 0) && bhash > bnTarget ) {
|
if ( (SMART_CHAIN_SYMBOL[0] != 0) && bhash > bnTarget ) {
|
||||||
failed = 1;
|
failed = 1;
|
||||||
if ( height > 0 && SMART_CHAIN_SYMBOL[0] == 0 ) // for the fast case
|
if ( possible == 0 || SMART_CHAIN_SYMBOL[0] != 0 ) {
|
||||||
{
|
|
||||||
if ( (n= hush_notaries(pubkeys,height,pblock->nTime)) > 0 )
|
|
||||||
{
|
|
||||||
for (i=0; i<n; i++)
|
|
||||||
if ( memcmp(pubkey33,pubkeys[i],33) == 0 )
|
|
||||||
{
|
|
||||||
notaryid = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if ( possible == 0 || SMART_CHAIN_SYMBOL[0] != 0 ) {
|
|
||||||
if ( HUSH_TEST_ASSETCHAIN_SKIP_POW )
|
if ( HUSH_TEST_ASSETCHAIN_SKIP_POW )
|
||||||
return(0);
|
return(0);
|
||||||
if ( ASSETCHAINS_STAKED == 0 )
|
if ( ASSETCHAINS_STAKED == 0 )
|
||||||
@ -1738,13 +1707,14 @@ int32_t hush_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
|
|||||||
}
|
}
|
||||||
if ( failed == 0 && ASSETCHAINS_COMMISSION != 0 ) {
|
if ( failed == 0 && ASSETCHAINS_COMMISSION != 0 ) {
|
||||||
if ( height == 1 ) {
|
if ( height == 1 ) {
|
||||||
ASSETCHAINS_SCRIPTPUB = devtax_scriptpub_for_height(height);
|
// Create a local variable instead of modifying the global assetchains_scriptpub
|
||||||
if ( ASSETCHAINS_SCRIPTPUB.size() > 1 && ASSETCHAINS_SCRIPTPUB[ASSETCHAINS_SCRIPTPUB.back()] != 49 && ASSETCHAINS_SCRIPTPUB[ASSETCHAINS_SCRIPTPUB.back()-1] != 51 ) {
|
auto assetchains_scriptpub = devtax_scriptpub_for_height(height);
|
||||||
|
if ( assetchains_scriptpub.size() > 1 && assetchains_scriptpub[assetchains_scriptpub.back()] != 49 && assetchains_scriptpub[assetchains_scriptpub.back()-1] != 51 ) {
|
||||||
int32_t scriptlen; uint8_t scripthex[10000];
|
int32_t scriptlen; uint8_t scripthex[10000];
|
||||||
script = (uint8_t *)&pblock->vtx[0].vout[0].scriptPubKey[0];
|
script = (uint8_t *)&pblock->vtx[0].vout[0].scriptPubKey[0];
|
||||||
scriptlen = (int32_t)pblock->vtx[0].vout[0].scriptPubKey.size();
|
scriptlen = (int32_t)pblock->vtx[0].vout[0].scriptPubKey.size();
|
||||||
if ( ASSETCHAINS_SCRIPTPUB.size()/2 == scriptlen && scriptlen < sizeof(scripthex) ) {
|
if ( assetchains_scriptpub.size()/2 == scriptlen && scriptlen < sizeof(scripthex) ) {
|
||||||
decode_hex(scripthex,scriptlen,(char *)ASSETCHAINS_SCRIPTPUB.c_str());
|
decode_hex(scripthex,scriptlen,(char *)assetchains_scriptpub.c_str());
|
||||||
if ( memcmp(scripthex,script,scriptlen) != 0 )
|
if ( memcmp(scripthex,script,scriptlen) != 0 )
|
||||||
return(-1);
|
return(-1);
|
||||||
} else return(-1);
|
} else return(-1);
|
||||||
|
@ -858,7 +858,7 @@ int32_t unhex(char c)
|
|||||||
int32_t hex;
|
int32_t hex;
|
||||||
if ( (hex= _unhex(c)) < 0 )
|
if ( (hex= _unhex(c)) < 0 )
|
||||||
{
|
{
|
||||||
//printf("unhex: illegal hexchar.(%c)\n",c);
|
fprintf(stderr,"unhex: illegal hexchar.(%c)\n",c);
|
||||||
}
|
}
|
||||||
return(hex);
|
return(hex);
|
||||||
}
|
}
|
||||||
@ -1513,14 +1513,6 @@ int32_t hush_whoami(char *pubkeystr,int32_t height,uint32_t timestamp)
|
|||||||
return(notaryid);
|
return(notaryid);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *argv0suffix[] = {
|
|
||||||
(char *)"fuckjl777d", (char *)"fuckjl777-cli", (char *)"fuckjl777d.exe", (char *)"fuckjl777-cli.exe", (char *)"btchd", (char *)"btch-cli", (char *)"btchd.exe", (char *)"btch-cli.exe"
|
|
||||||
};
|
|
||||||
|
|
||||||
char *argv0names[] = {
|
|
||||||
(char *)"FUCKJL777", (char *)"FUCKJL777", (char *)"FUCKJL777", (char *)"FUCKJL777", (char *)"BTCH", (char *)"BTCH", (char *)"BTCH", (char *)"BTCH"
|
|
||||||
};
|
|
||||||
|
|
||||||
// Large total supplies lead to numerical errors, beware!
|
// Large total supplies lead to numerical errors, beware!
|
||||||
uint64_t hush_max_money()
|
uint64_t hush_max_money()
|
||||||
{
|
{
|
||||||
@ -1528,7 +1520,7 @@ uint64_t hush_max_money()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This implements the Hush Emission Curve, the miner subsidy part,
|
// This implements the Hush Emission Curve, the miner subsidy part,
|
||||||
// and must be kept in sync with hush_commision() in komoto_bitcoind.h!
|
// and must be kept in sync with hush_commision() in hush_bitcoind.h!
|
||||||
// Changing these functions are consensus changes!
|
// Changing these functions are consensus changes!
|
||||||
// Here Be Dragons! -- Duke Leto
|
// Here Be Dragons! -- Duke Leto
|
||||||
uint64_t hush_block_subsidy(int height)
|
uint64_t hush_block_subsidy(int height)
|
||||||
@ -1803,21 +1795,6 @@ void hush_args(char *argv0)
|
|||||||
name = GetArg("-ac_name","HUSH3");
|
name = GetArg("-ac_name","HUSH3");
|
||||||
fprintf(stderr,".oO Starting %s Full Node (Extreme Privacy!) with genproc=%d notary=%d\n",name.c_str(),HUSH_MININGTHREADS, IS_HUSH_NOTARY);
|
fprintf(stderr,".oO Starting %s Full Node (Extreme Privacy!) with genproc=%d notary=%d\n",name.c_str(),HUSH_MININGTHREADS, IS_HUSH_NOTARY);
|
||||||
|
|
||||||
if ( argv0 != 0 )
|
|
||||||
{
|
|
||||||
len = (int32_t)strlen(argv0);
|
|
||||||
for (i=0; i<sizeof(argv0suffix)/sizeof(*argv0suffix); i++)
|
|
||||||
{
|
|
||||||
n = (int32_t)strlen(argv0suffix[i]);
|
|
||||||
if ( strcmp(&argv0[len - n],argv0suffix[i]) == 0 )
|
|
||||||
{
|
|
||||||
//printf("ARGV0.(%s) -> matches suffix (%s) -> ac_name.(%s)\n",argv0,argv0suffix[i],argv0names[i]);
|
|
||||||
name = argv0names[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vector<string> HUSH_nodes= {"node1.hush.is","node2.hush.is","node3.hush.is",
|
vector<string> HUSH_nodes= {"node1.hush.is","node2.hush.is","node3.hush.is",
|
||||||
"node4.hush.is","node5.hush.is","node6.hush.is",
|
"node4.hush.is","node5.hush.is","node6.hush.is",
|
||||||
"node7.hush.is","node8.hush.is","node1.hush.land", "node2.hush.land", "node3.hush.land", "node4.hush.land", "node5.hush.land"};
|
"node7.hush.is","node8.hush.is","node1.hush.land", "node2.hush.land", "node3.hush.land", "node4.hush.land", "node5.hush.land"};
|
||||||
@ -1899,7 +1876,7 @@ void hush_args(char *argv0)
|
|||||||
printf("ASSETCHAINS_ALGO, %s not supported. using equihash\n", selectedAlgo.c_str());
|
printf("ASSETCHAINS_ALGO, %s not supported. using equihash\n", selectedAlgo.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set our symobl from -ac_name value
|
// Set our symbol from -ac_name value
|
||||||
strncpy(SMART_CHAIN_SYMBOL,name.c_str(),sizeof(SMART_CHAIN_SYMBOL)-1);
|
strncpy(SMART_CHAIN_SYMBOL,name.c_str(),sizeof(SMART_CHAIN_SYMBOL)-1);
|
||||||
bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
|
bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "checkqueue.h"
|
#include "checkqueue.h"
|
||||||
#include "consensus/upgrades.h"
|
#include "consensus/upgrades.h"
|
||||||
#include "consensus/validation.h"
|
#include "consensus/validation.h"
|
||||||
#include "deprecation.h"
|
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
#include "merkleblock.h"
|
#include "merkleblock.h"
|
||||||
#include "metrics.h"
|
#include "metrics.h"
|
||||||
@ -3713,9 +3712,12 @@ bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode) {
|
|||||||
// Now that we have written the block indices to the database, we do not
|
// Now that we have written the block indices to the database, we do not
|
||||||
// need to store solutions for these CBlockIndex objects in memory.
|
// need to store solutions for these CBlockIndex objects in memory.
|
||||||
// cs_main must be held here.
|
// cs_main must be held here.
|
||||||
|
uint32_t nTrimmed = 0;
|
||||||
for (CBlockIndex *pblockindex : vBlocks) {
|
for (CBlockIndex *pblockindex : vBlocks) {
|
||||||
pblockindex->TrimSolution();
|
pblockindex->TrimSolution();
|
||||||
|
++nTrimmed;
|
||||||
}
|
}
|
||||||
|
LogPrintf("%s: trimmed %d solutions from block index mode=%d\n", __func__, nTrimmed, mode);
|
||||||
}
|
}
|
||||||
// Finally remove any pruned files
|
// Finally remove any pruned files
|
||||||
if (fFlushForPrune)
|
if (fFlushForPrune)
|
||||||
@ -4027,8 +4029,6 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
|
|||||||
recentlyConflictedTxs.insert(std::make_pair(pindexNew, txConflicted));
|
recentlyConflictedTxs.insert(std::make_pair(pindexNew, txConflicted));
|
||||||
nRecentlyConflictedSequence += 1;
|
nRecentlyConflictedSequence += 1;
|
||||||
|
|
||||||
EnforceNodeDeprecation(pindexNew->GetHeight());
|
|
||||||
|
|
||||||
int64_t nTime6 = GetTimeMicros(); nTimePostConnect += nTime6 - nTime5; nTimeTotal += nTime6 - nTime1;
|
int64_t nTime6 = GetTimeMicros(); nTimePostConnect += nTime6 - nTime5; nTimeTotal += nTime6 - nTime1;
|
||||||
LogPrint("bench", " - Connect postprocess: %.2fms [%.2fs]\n", (nTime6 - nTime5) * 0.001, nTimePostConnect * 0.000001);
|
LogPrint("bench", " - Connect postprocess: %.2fms [%.2fs]\n", (nTime6 - nTime5) * 0.001, nTimePostConnect * 0.000001);
|
||||||
LogPrint("bench", "- Connect block: %.2fms [%.2fs]\n", (nTime6 - nTime1) * 0.001, nTimeTotal * 0.000001);
|
LogPrint("bench", "- Connect block: %.2fms [%.2fs]\n", (nTime6 - nTime1) * 0.001, nTimeTotal * 0.000001);
|
||||||
@ -5992,7 +5992,6 @@ bool static LoadBlockIndexDB()
|
|||||||
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.LastTip()->GetBlockTime()),
|
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.LastTip()->GetBlockTime()),
|
||||||
progress);
|
progress);
|
||||||
|
|
||||||
EnforceNodeDeprecation(chainActive.Height(), true);
|
|
||||||
CBlockIndex *pindex;
|
CBlockIndex *pindex;
|
||||||
if ( (pindex= chainActive.LastTip()) != 0 )
|
if ( (pindex= chainActive.LastTip()) != 0 )
|
||||||
{
|
{
|
||||||
|
@ -660,27 +660,29 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
|||||||
|
|
||||||
pblock->vtx[0] = txNew;
|
pblock->vtx[0] = txNew;
|
||||||
|
|
||||||
ASSETCHAINS_SCRIPTPUB = devtax_scriptpub_for_height(nHeight);
|
// Create a local variable instead of modifying the global ASSETCHAINS_SCRIPTPUB
|
||||||
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= the_commission((CBlock*)&pblocktemplate->block,(int32_t)nHeight)) != 0 )
|
auto assetchains_scriptpub = devtax_scriptpub_for_height(nHeight);
|
||||||
|
|
||||||
|
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= the_commission((CBlock*)&pblocktemplate->block,(int32_t)nHeight)) != 0 )
|
||||||
{
|
{
|
||||||
int32_t i; uint8_t *ptr;
|
int32_t i; uint8_t *ptr;
|
||||||
txNew.vout.resize(2);
|
txNew.vout.resize(2);
|
||||||
txNew.vout[1].nValue = commission;
|
txNew.vout[1].nValue = commission;
|
||||||
if ( ASSETCHAINS_SCRIPTPUB.size() > 1 )
|
if ( assetchains_scriptpub.size() > 1 )
|
||||||
{
|
{
|
||||||
static bool didinit = false;
|
static bool didinit = false;
|
||||||
if ( !didinit && nHeight > HUSH_EARLYTXID_HEIGHT && HUSH_EARLYTXID != zeroid && hush_appendACscriptpub() )
|
if ( !didinit && nHeight > HUSH_EARLYTXID_HEIGHT && HUSH_EARLYTXID != zeroid && hush_appendACscriptpub() )
|
||||||
{
|
{
|
||||||
fprintf(stderr, "appended ccopreturn to ASSETCHAINS_SCRIPTPUB.%s\n", ASSETCHAINS_SCRIPTPUB.c_str());
|
fprintf(stderr, "appended ccopreturn to assetchains_scriptpub.%s\n", assetchains_scriptpub.c_str());
|
||||||
didinit = true;
|
didinit = true;
|
||||||
}
|
}
|
||||||
//fprintf(stderr,"mine to -ac_script\n");
|
//fprintf(stderr,"mine to -ac_script\n");
|
||||||
//txNew.vout[1].scriptPubKey = CScript() << ParseHex();
|
//txNew.vout[1].scriptPubKey = CScript() << ParseHex();
|
||||||
int32_t len = strlen(ASSETCHAINS_SCRIPTPUB.c_str());
|
int32_t len = strlen(assetchains_scriptpub.c_str());
|
||||||
len >>= 1;
|
len >>= 1;
|
||||||
txNew.vout[1].scriptPubKey.resize(len);
|
txNew.vout[1].scriptPubKey.resize(len);
|
||||||
ptr = (uint8_t *)&txNew.vout[1].scriptPubKey[0];
|
ptr = (uint8_t *)&txNew.vout[1].scriptPubKey[0];
|
||||||
decode_hex(ptr,len,(char *)ASSETCHAINS_SCRIPTPUB.c_str());
|
decode_hex(ptr,len,(char *)assetchains_scriptpub.c_str());
|
||||||
} else {
|
} else {
|
||||||
txNew.vout[1].scriptPubKey.resize(35);
|
txNew.vout[1].scriptPubKey.resize(35);
|
||||||
ptr = (uint8_t *)&txNew.vout[1].scriptPubKey[0];
|
ptr = (uint8_t *)&txNew.vout[1].scriptPubKey[0];
|
||||||
@ -850,8 +852,10 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight,
|
|||||||
{
|
{
|
||||||
CPubKey pubkey; CScript scriptPubKey; uint8_t *script,*ptr; int32_t i,len;
|
CPubKey pubkey; CScript scriptPubKey; uint8_t *script,*ptr; int32_t i,len;
|
||||||
// fprintf(stderr,"%s: with nHeight=%d\n", __func__, nHeight);
|
// fprintf(stderr,"%s: with nHeight=%d\n", __func__, nHeight);
|
||||||
ASSETCHAINS_SCRIPTPUB = devtax_scriptpub_for_height(nHeight);
|
|
||||||
if ( nHeight == 1 && ASSETCHAINS_COMMISSION != 0 && ASSETCHAINS_SCRIPTPUB[ASSETCHAINS_SCRIPTPUB.back()] != 49 && ASSETCHAINS_SCRIPTPUB[ASSETCHAINS_SCRIPTPUB.back()-1] != 51 )
|
// Create a local variable instead of modifying the global assetchains_scriptpub
|
||||||
|
auto assetchains_scriptpub = devtax_scriptpub_for_height(nHeight);
|
||||||
|
if ( nHeight == 1 && ASSETCHAINS_COMMISSION != 0 && assetchains_scriptpub[assetchains_scriptpub.back()] != 49 && assetchains_scriptpub[assetchains_scriptpub.back()-1] != 51 )
|
||||||
{
|
{
|
||||||
if ( ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 )
|
if ( ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 )
|
||||||
{
|
{
|
||||||
@ -859,11 +863,11 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight,
|
|||||||
scriptPubKey = CScript() << ParseHex(HexStr(pubkey)) << OP_CHECKSIG;
|
scriptPubKey = CScript() << ParseHex(HexStr(pubkey)) << OP_CHECKSIG;
|
||||||
// fprintf(stderr,"%s: with pubkey=%s\n", __func__, HexStr(pubkey).c_str() );
|
// fprintf(stderr,"%s: with pubkey=%s\n", __func__, HexStr(pubkey).c_str() );
|
||||||
} else {
|
} else {
|
||||||
len = strlen(ASSETCHAINS_SCRIPTPUB.c_str());
|
len = strlen(assetchains_scriptpub.c_str());
|
||||||
len >>= 1;
|
len >>= 1;
|
||||||
scriptPubKey.resize(len);
|
scriptPubKey.resize(len);
|
||||||
ptr = (uint8_t *)&scriptPubKey[0];
|
ptr = (uint8_t *)&scriptPubKey[0];
|
||||||
decode_hex(ptr,len,(char *)ASSETCHAINS_SCRIPTPUB.c_str());
|
decode_hex(ptr,len,(char *)assetchains_scriptpub.c_str());
|
||||||
}
|
}
|
||||||
} else if ( USE_EXTERNAL_PUBKEY != 0 ) {
|
} else if ( USE_EXTERNAL_PUBKEY != 0 ) {
|
||||||
//fprintf(stderr,"use notary pubkey\n");
|
//fprintf(stderr,"use notary pubkey\n");
|
||||||
@ -1266,7 +1270,6 @@ void static RandomXMiner()
|
|||||||
LogPrintf("Running HushRandomXMiner with %u transactions in block (%u bytes)\n",pblock->vtx.size(),::GetSerializeSize(*pblock,SER_NETWORK,PROTOCOL_VERSION));
|
LogPrintf("Running HushRandomXMiner with %u transactions in block (%u bytes)\n",pblock->vtx.size(),::GetSerializeSize(*pblock,SER_NETWORK,PROTOCOL_VERSION));
|
||||||
|
|
||||||
// Search
|
// Search
|
||||||
uint8_t pubkeys[66][33]; arith_uint256 bnMaxPoSdiff; uint32_t blocktimes[66]; int mids[256],nonzpkeys,i,j,externalflag;
|
|
||||||
uint32_t savebits;
|
uint32_t savebits;
|
||||||
int64_t nStart = GetTime();
|
int64_t nStart = GetTime();
|
||||||
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
||||||
@ -1613,7 +1616,7 @@ void static BitcoinMiner()
|
|||||||
LogPrintf("Running HushMiner.%s with %u transactions in block (%u bytes)\n",solver.c_str(),pblock->vtx.size(),::GetSerializeSize(*pblock,SER_NETWORK,PROTOCOL_VERSION));
|
LogPrintf("Running HushMiner.%s with %u transactions in block (%u bytes)\n",solver.c_str(),pblock->vtx.size(),::GetSerializeSize(*pblock,SER_NETWORK,PROTOCOL_VERSION));
|
||||||
|
|
||||||
// Search
|
// Search
|
||||||
uint8_t pubkeys[66][33]; arith_uint256 bnMaxPoSdiff; uint32_t blocktimes[66]; int mids[256],nonzpkeys,i,j,externalflag; uint32_t savebits; int64_t nStart = GetTime();
|
uint32_t savebits; int64_t nStart = GetTime();
|
||||||
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
||||||
savebits = pblock->nBits;
|
savebits = pblock->nBits;
|
||||||
HASHTarget = arith_uint256().SetCompact(savebits);
|
HASHTarget = arith_uint256().SetCompact(savebits);
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "timedata.h"
|
#include "timedata.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "deprecation.h"
|
|
||||||
#include "hush/utiltls.h"
|
#include "hush/utiltls.h"
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <univalue.h>
|
#include <univalue.h>
|
||||||
@ -495,33 +494,6 @@ static UniValue GetNetworksInfo()
|
|||||||
return networks;
|
return networks;
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue getdeprecationinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
|
||||||
{
|
|
||||||
const CChainParams& chainparams = Params();
|
|
||||||
if (fHelp || params.size() != 0 || chainparams.NetworkIDString() != "main")
|
|
||||||
throw runtime_error(
|
|
||||||
"getdeprecationinfo\n"
|
|
||||||
"Returns an object containing current version and deprecation block height. Applicable only on mainnet.\n"
|
|
||||||
"\nResult:\n"
|
|
||||||
"{\n"
|
|
||||||
" \"version\": xxxxx, (numeric) the server version\n"
|
|
||||||
" \"subversion\": \"/GoldenSandtrout:x.y.z[-v]/\", (string) the server subversion string\n"
|
|
||||||
" \"deprecationheight\": xxxxx, (numeric) the block height at which this version will deprecate and shut down\n"
|
|
||||||
"}\n"
|
|
||||||
"\nExamples:\n"
|
|
||||||
+ HelpExampleCli("getdeprecationinfo", "")
|
|
||||||
+ HelpExampleRpc("getdeprecationinfo", "")
|
|
||||||
);
|
|
||||||
|
|
||||||
UniValue obj(UniValue::VOBJ);
|
|
||||||
obj.push_back(Pair("version", CLIENT_VERSION));
|
|
||||||
obj.push_back(Pair("subversion",
|
|
||||||
FormatSubVersion(GetArg("-clientname","GoldenSandtrout"), CLIENT_VERSION, std::vector<string>())));
|
|
||||||
obj.push_back(Pair("deprecationheight", DEPRECATION_HEIGHT));
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
UniValue getnetworkinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
UniValue getnetworkinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||||
{
|
{
|
||||||
if (fHelp || params.size() != 0)
|
if (fHelp || params.size() != 0)
|
||||||
@ -710,7 +682,6 @@ static const CRPCCommand commands[] =
|
|||||||
{ // category name actor (function) okSafeMode
|
{ // category name actor (function) okSafeMode
|
||||||
// --------------------- ------------------------ ----------------------- ----------
|
// --------------------- ------------------------ ----------------------- ----------
|
||||||
{ "network", "getconnectioncount", &getconnectioncount, true },
|
{ "network", "getconnectioncount", &getconnectioncount, true },
|
||||||
{ "network", "getdeprecationinfo", &getdeprecationinfo, true },
|
|
||||||
{ "network", "ping", &ping, true },
|
{ "network", "ping", &ping, true },
|
||||||
{ "network", "getpeerlist", &getpeerlist, true },
|
{ "network", "getpeerlist", &getpeerlist, true },
|
||||||
{ "network", "getpeerinfo", &getpeerinfo, true },
|
{ "network", "getpeerinfo", &getpeerinfo, true },
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "consensus/validation.h"
|
#include "consensus/validation.h"
|
||||||
#include "core_io.h"
|
#include "core_io.h"
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
#include "deprecation.h"
|
|
||||||
#include "key_io.h"
|
#include "key_io.h"
|
||||||
#include "keystore.h"
|
#include "keystore.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
@ -299,7 +299,6 @@ static const CRPCCommand vRPCCommands[] =
|
|||||||
|
|
||||||
/* P2P networking */
|
/* P2P networking */
|
||||||
{ "network", "getnetworkinfo", &getnetworkinfo, true },
|
{ "network", "getnetworkinfo", &getnetworkinfo, true },
|
||||||
{ "network", "getdeprecationinfo", &getdeprecationinfo, true },
|
|
||||||
{ "network", "addnode", &addnode, true },
|
{ "network", "addnode", &addnode, true },
|
||||||
{ "network", "disconnectnode", &disconnectnode, true },
|
{ "network", "disconnectnode", &disconnectnode, true },
|
||||||
{ "network", "getaddednodeinfo", &getaddednodeinfo, true },
|
{ "network", "getaddednodeinfo", &getaddednodeinfo, true },
|
||||||
|
@ -391,7 +391,6 @@ extern UniValue setstakingsplit(const UniValue& params, bool fHelp, const CPubKe
|
|||||||
extern UniValue getwalletinfo(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
extern UniValue getwalletinfo(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||||
extern UniValue getblockchaininfo(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
extern UniValue getblockchaininfo(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||||
extern UniValue getnetworkinfo(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
extern UniValue getnetworkinfo(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||||
extern UniValue getdeprecationinfo(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
|
||||||
extern UniValue setmocktime(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
extern UniValue setmocktime(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||||
extern UniValue resendwallettransactions(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
extern UniValue resendwallettransactions(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user