Merge branch 'dev' into duke
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Copyright 2019-2020 The Hush developers
|
||||
# Copyright 2016-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
|
||||
|
||||
@@ -302,7 +302,7 @@ libbitcoin_server_a_SOURCES = \
|
||||
miner.cpp \
|
||||
net.cpp \
|
||||
noui.cpp \
|
||||
notarisationdb.cpp \
|
||||
notarizationdb.cpp \
|
||||
policy/fees.cpp \
|
||||
pow.cpp \
|
||||
rest.cpp \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2019-2020 Hush developers
|
||||
# Copyright (c) 2016-2020 The Hush developers
|
||||
# Released under the GPLv3
|
||||
TESTS += komodo-gtest
|
||||
bin_PROGRAMS += komodo-gtest
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2019-2020 The Hush developers
|
||||
# Copyright (c) 2016-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
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@ BITCOIN_TESTS =\
|
||||
test/arith_uint256_tests.cpp \
|
||||
test/bignum.h \
|
||||
test/addrman_tests.cpp \
|
||||
test/alert_tests.cpp \
|
||||
test/allocator_tests.cpp \
|
||||
test/base32_tests.cpp \
|
||||
test/base58_tests.cpp \
|
||||
|
||||
326
src/ac.json
326
src/ac.json
@@ -1,319 +1,4 @@
|
||||
{
|
||||
"REVS": {
|
||||
"ac_supply": "1300000"
|
||||
}
|
||||
,
|
||||
|
||||
"SUPERNET": {
|
||||
"ac_supply": "816061"
|
||||
}
|
||||
,
|
||||
|
||||
"DEX": {
|
||||
"ac_supply": "999999"
|
||||
}
|
||||
,
|
||||
|
||||
"PANGEA": {
|
||||
"ac_supply": "999999"
|
||||
}
|
||||
|
||||
,
|
||||
"JUMBLR": {
|
||||
"ac_supply": "999999"
|
||||
}
|
||||
,
|
||||
|
||||
"BET": {
|
||||
"ac_supply": "999999"
|
||||
}
|
||||
,
|
||||
|
||||
"CRYPTO": {
|
||||
"ac_supply": "999999"
|
||||
}
|
||||
,
|
||||
|
||||
"HODL": {
|
||||
"ac_supply": "9999999"
|
||||
}
|
||||
,
|
||||
|
||||
"MSHARK": {
|
||||
"ac_supply": "1400000"
|
||||
}
|
||||
,
|
||||
|
||||
"BOTS": {
|
||||
"ac_supply": "999999"
|
||||
}
|
||||
,
|
||||
|
||||
"MGW": {
|
||||
"ac_supply": "999999"
|
||||
}
|
||||
,
|
||||
"COQUICASH": {
|
||||
"ac_supply": "72000000",
|
||||
"ac_reward": "7200000000",
|
||||
"ac_staked": "50",
|
||||
"ac_halving": "420000",
|
||||
"ac_cc": "2",
|
||||
"ac_ccenable": "227,235,236,241",
|
||||
"addnode": [
|
||||
"78.47.108.168"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"WLC": {
|
||||
"ac_supply": "210000000"
|
||||
}
|
||||
,
|
||||
|
||||
"KV": {
|
||||
"ac_supply": "1000000"
|
||||
}
|
||||
,
|
||||
|
||||
"CEAL": {
|
||||
"ac_supply": "366666666"
|
||||
}
|
||||
,
|
||||
|
||||
"MESH": {
|
||||
"ac_supply": "1000007"
|
||||
}
|
||||
,
|
||||
|
||||
"AXO": {
|
||||
"ac_supply": "200000000",
|
||||
"ac_ccactivate": "130000"
|
||||
}
|
||||
,
|
||||
|
||||
"ETOMIC": {
|
||||
"ac_supply": "100000000"
|
||||
}
|
||||
,
|
||||
|
||||
"BTCH": {
|
||||
"ac_supply": "20998641"
|
||||
}
|
||||
,
|
||||
|
||||
"PIZZA": {
|
||||
"ac_supply": "100000000"
|
||||
}
|
||||
,
|
||||
|
||||
"BEER": {
|
||||
"ac_supply": "100000000"
|
||||
}
|
||||
,
|
||||
|
||||
"NINJA": {
|
||||
"ac_supply": "100000000"
|
||||
}
|
||||
,
|
||||
|
||||
"OOT": {
|
||||
"ac_supply": "216000000",
|
||||
"ac_sapling": "5000000"
|
||||
}
|
||||
,
|
||||
|
||||
"BNTN": {
|
||||
"ac_supply": "500000000"
|
||||
}
|
||||
,
|
||||
|
||||
"CHAIN": {
|
||||
"ac_supply": "999999"
|
||||
}
|
||||
,
|
||||
|
||||
"PRLPAY": {
|
||||
"ac_supply": "500000000"
|
||||
}
|
||||
,
|
||||
|
||||
"DSEC": {
|
||||
"ac_supply": "7000000"
|
||||
}
|
||||
,
|
||||
|
||||
"GLXT": {
|
||||
"ac_supply": "10000000000"
|
||||
}
|
||||
,
|
||||
|
||||
"EQL": {
|
||||
"ac_supply": "500000000",
|
||||
"ac_ccactivate": "205000"
|
||||
}
|
||||
,
|
||||
|
||||
"ZILLA": {
|
||||
"ac_supply": "11000000",
|
||||
"ac_sapling": "5000000",
|
||||
"addnode": [
|
||||
"51.68.215.104"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"RFOX": {
|
||||
"ac_supply": "1000000000",
|
||||
"ac_reward": "100000000"
|
||||
}
|
||||
,
|
||||
|
||||
"SEC": {
|
||||
"ac_supply": "1000000000",
|
||||
"ac_cc": "333"
|
||||
}
|
||||
,
|
||||
|
||||
"CCL": {
|
||||
"ac_supply": "200000000",
|
||||
"ac_end": "1",
|
||||
"ac_cc": "2",
|
||||
"addressindex": "1",
|
||||
"spentindex": "1",
|
||||
"addnode": [
|
||||
"142.93.136.89",
|
||||
"195.201.22.89"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"PIRATE": {
|
||||
"ac_supply": "0",
|
||||
"ac_reward": "25600000000",
|
||||
"ac_halving": "77777",
|
||||
"ac_private": "1",
|
||||
"addnode": [
|
||||
"136.243.102.225"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"PGT": {
|
||||
"ac_supply": "10000000",
|
||||
"ac_end": "1",
|
||||
"addnode": [
|
||||
"190.114.254.104"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"DION": {
|
||||
"ac_supply": "3900000000",
|
||||
"ac_reward": "22260000000",
|
||||
"ac_staked": "100",
|
||||
"ac_cc": "1",
|
||||
"ac_end": "4300000000",
|
||||
"addnode": [
|
||||
"51.75.124.34"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"KMDICE": {
|
||||
"ac_supply": "10500000",
|
||||
"ac_reward": "2500000000",
|
||||
"ac_halving": "210000",
|
||||
"ac_cc": "2",
|
||||
"addressindex": "1",
|
||||
"spentindex": "1",
|
||||
"addnode": [
|
||||
"144.76.217.232"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"KSB": {
|
||||
"ac_supply": "1000000000",
|
||||
"ac_end": "1",
|
||||
"ac_public": "1",
|
||||
"addnode": [
|
||||
"37.187.225.231"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"OUR": {
|
||||
"ac_reward": "1478310502",
|
||||
"ac_halving": "525600",
|
||||
"ac_cc": "42",
|
||||
"ac_supply": "100000000",
|
||||
"ac_perc": "77700",
|
||||
"ac_staked": "93",
|
||||
"ac_pubkey": "02652a3f3e00b3a1875a918314f0bac838d6dd189a346fa623f5efe9541ac0b98c",
|
||||
"ac_public": "1",
|
||||
"addnode": [
|
||||
"51.255.195.65",
|
||||
"217.182.129.38",
|
||||
"37.187.225.231"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"ILN": {
|
||||
"ac_supply": "10000000000",
|
||||
"ac_cc": "2",
|
||||
"addnode": ["51.75.122.83"]
|
||||
}
|
||||
,
|
||||
|
||||
"RICK": {
|
||||
"ac_supply": "90000000000",
|
||||
"ac_reward": "100000000",
|
||||
"ac_cc": "3",
|
||||
"addnode": ["138.201.136.145"]
|
||||
}
|
||||
,
|
||||
|
||||
"MORTY": {
|
||||
"ac_supply": "90000000000",
|
||||
"ac_reward": "100000000",
|
||||
"ac_cc": "3",
|
||||
"addnode": ["138.201.136.145"]
|
||||
}
|
||||
,
|
||||
|
||||
"KOIN": {
|
||||
"ac_supply": "125000000",
|
||||
"addnode": ["3.0.32.10"]
|
||||
}
|
||||
,
|
||||
|
||||
"ZEXO": {
|
||||
"ac_reward": "1478310502",
|
||||
"ac_halving": "525600",
|
||||
"ac_cc": "42",
|
||||
"ac_ccenable": "236",
|
||||
"ac_supply": "100000000",
|
||||
"ac_perc": "77700",
|
||||
"ac_staked": "93",
|
||||
"ac_pubkey": "02713bd85e054db923694b6b7a85306264edf4d6bd6d331814f2b40af444b3ebbc",
|
||||
"ac_public": "1",
|
||||
"addnode": [
|
||||
"195.201.20.230",
|
||||
"80.240.17.222"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"K64": {
|
||||
"ac_reward": "0",
|
||||
"ac_supply": "64000777",
|
||||
"ac_staked": "10",
|
||||
"addnode": ["18.197.20.21"]
|
||||
}
|
||||
,
|
||||
|
||||
"HUSH3": {
|
||||
"ac_sapling": "1",
|
||||
"ac_founders": "1",
|
||||
@@ -330,9 +15,14 @@
|
||||
"ac_script": "76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac",
|
||||
"clientname": "GoldenSandtrout",
|
||||
"addnode": [
|
||||
"188.165.212.101",
|
||||
"136.243.227.142",
|
||||
"5.9.224.250"
|
||||
"node1.hush.is",
|
||||
"node2.hush.is",
|
||||
"node3.hush.is",
|
||||
"node4.hush.is",
|
||||
"node5.hush.is",
|
||||
"node6.hush.is",
|
||||
"node7.hush.is",
|
||||
"node8.hush.is"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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
|
||||
|
||||
#ifndef BITCOIN_ADDRESSINDEX_H
|
||||
#define BITCOIN_ADDRESSINDEX_H
|
||||
#ifndef HUSH_ADDRESSINDEX_H
|
||||
#define HUSH_ADDRESSINDEX_H
|
||||
|
||||
#include "uint256.h"
|
||||
#include "amount.h"
|
||||
@@ -80,4 +80,4 @@ struct CMempoolAddressDeltaKeyCompare
|
||||
}
|
||||
};
|
||||
|
||||
#endif // BITCOIN_ADDRESSINDEX_H
|
||||
#endif // HUSH_ADDRESSINDEX_H
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2012 Pieter Wuille
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2012 Pieter Wuille
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BITCOIN_ADDRMAN_H
|
||||
#define BITCOIN_ADDRMAN_H
|
||||
#ifndef HUSH_ADDRMAN_H
|
||||
#define HUSH_ADDRMAN_H
|
||||
|
||||
#include "netbase.h"
|
||||
#include "protocol.h"
|
||||
@@ -645,4 +645,4 @@ public:
|
||||
|
||||
};
|
||||
|
||||
#endif // BITCOIN_ADDRMAN_H
|
||||
#endif // HUSH_ADDRMAN_H
|
||||
|
||||
132
src/alert.cpp
132
src/alert.cpp
@@ -1,9 +1,8 @@
|
||||
// Copyright (c) 2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -18,20 +17,16 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "alert.h"
|
||||
|
||||
#include "clientversion.h"
|
||||
#include "net.h"
|
||||
#include "pubkey.h"
|
||||
#include "timedata.h"
|
||||
#include "ui_interface.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
@@ -118,7 +113,7 @@ uint256 CAlert::GetHash() const
|
||||
|
||||
bool CAlert::IsInEffect() const
|
||||
{
|
||||
return (GetTime() < nExpiration);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CAlert::Cancels(const CAlert& alert) const
|
||||
@@ -138,146 +133,31 @@ bool CAlert::AppliesTo(int nVersion, const std::string& strSubVerIn) const
|
||||
|
||||
bool CAlert::AppliesToMe() const
|
||||
{
|
||||
return AppliesTo(PROTOCOL_VERSION, FormatSubVersion(GetArg("-clientname","MagicBean"), CLIENT_VERSION, std::vector<std::string>()));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CAlert::RelayTo(CNode* pnode) const
|
||||
{
|
||||
if (!IsInEffect())
|
||||
return false;
|
||||
// don't relay to nodes which haven't sent their version message
|
||||
if (pnode->nVersion == 0)
|
||||
return false;
|
||||
// returns true if wasn't already contained in the set
|
||||
if (pnode->setKnown.insert(GetHash()).second)
|
||||
{
|
||||
if (AppliesTo(pnode->nVersion, pnode->strSubVer) ||
|
||||
AppliesToMe() ||
|
||||
GetTime() < nRelayUntil)
|
||||
{
|
||||
pnode->PushMessage("alert", *this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CAlert::CheckSignature(const std::vector<unsigned char>& alertKey) const
|
||||
{
|
||||
CPubKey key(alertKey);
|
||||
if (!key.Verify(Hash(vchMsg.begin(), vchMsg.end()), vchSig))
|
||||
return error("CAlert::CheckSignature(): verify signature failed");
|
||||
|
||||
// Now unserialize the data
|
||||
CDataStream sMsg(vchMsg, SER_NETWORK, PROTOCOL_VERSION);
|
||||
sMsg >> *(CUnsignedAlert*)this;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
CAlert CAlert::getAlertByHash(const uint256 &hash)
|
||||
{
|
||||
CAlert retval;
|
||||
{
|
||||
LOCK(cs_mapAlerts);
|
||||
map<uint256, CAlert>::iterator mi = mapAlerts.find(hash);
|
||||
if(mi != mapAlerts.end())
|
||||
retval = mi->second;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool CAlert::ProcessAlert(const std::vector<unsigned char>& alertKey, bool fThread)
|
||||
{
|
||||
if (!CheckSignature(alertKey))
|
||||
return false;
|
||||
if (!IsInEffect())
|
||||
return false;
|
||||
|
||||
// alert.nID=max is reserved for if the alert key is
|
||||
// compromised. It must have a pre-defined message,
|
||||
// must never expire, must apply to all versions,
|
||||
// and must cancel all previous
|
||||
// alerts or it will be ignored (so an attacker can't
|
||||
// send an "everything is OK, don't panic" version that
|
||||
// cannot be overridden):
|
||||
int maxInt = std::numeric_limits<int>::max();
|
||||
if (nID == maxInt)
|
||||
{
|
||||
if (!(
|
||||
nExpiration == maxInt &&
|
||||
nCancel == (maxInt-1) &&
|
||||
nMinVer == 0 &&
|
||||
nMaxVer == maxInt &&
|
||||
setSubVer.empty() &&
|
||||
nPriority == maxInt &&
|
||||
strStatusBar == "URGENT: Alert key compromised, upgrade required"
|
||||
))
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
LOCK(cs_mapAlerts);
|
||||
// Cancel previous alerts
|
||||
for (map<uint256, CAlert>::iterator mi = mapAlerts.begin(); mi != mapAlerts.end();)
|
||||
{
|
||||
const CAlert& alert = (*mi).second;
|
||||
if (Cancels(alert))
|
||||
{
|
||||
LogPrint("alert", "cancelling alert %d\n", alert.nID);
|
||||
uiInterface.NotifyAlertChanged((*mi).first, CT_DELETED);
|
||||
mapAlerts.erase(mi++);
|
||||
}
|
||||
else if (!alert.IsInEffect())
|
||||
{
|
||||
LogPrint("alert", "expiring alert %d\n", alert.nID);
|
||||
uiInterface.NotifyAlertChanged((*mi).first, CT_DELETED);
|
||||
mapAlerts.erase(mi++);
|
||||
}
|
||||
else
|
||||
mi++;
|
||||
}
|
||||
|
||||
// Check if this alert has been cancelled
|
||||
BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts)
|
||||
{
|
||||
const CAlert& alert = item.second;
|
||||
if (alert.Cancels(*this))
|
||||
{
|
||||
LogPrint("alert", "alert already cancelled by %d\n", alert.nID);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Add to mapAlerts
|
||||
mapAlerts.insert(make_pair(GetHash(), *this));
|
||||
// Notify UI and -alertnotify if it applies to me
|
||||
if(AppliesToMe())
|
||||
{
|
||||
uiInterface.NotifyAlertChanged(GetHash(), CT_NEW);
|
||||
Notify(strStatusBar, fThread);
|
||||
}
|
||||
}
|
||||
|
||||
LogPrint("alert", "accepted alert %d, AppliesToMe()=%d\n", nID, AppliesToMe());
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CAlert::Notify(const std::string& strMessage, bool fThread)
|
||||
void CAlert::Notify(const std::string& strMessage, bool fThread)
|
||||
{
|
||||
std::string strCmd = GetArg("-alertnotify", "");
|
||||
if (strCmd.empty()) return;
|
||||
|
||||
// Alert text should be plain ascii coming from a trusted source, but to
|
||||
// be safe we first strip anything not in safeChars, then add single quotes around
|
||||
// the whole string before passing it to the shell:
|
||||
std::string singleQuote("'");
|
||||
std::string safeStatus = SanitizeString(strMessage);
|
||||
safeStatus = singleQuote+safeStatus+singleQuote;
|
||||
boost::replace_all(strCmd, "%s", safeStatus);
|
||||
|
||||
if (fThread)
|
||||
boost::thread t(runCommand, strCmd); // thread runs free
|
||||
else
|
||||
runCommand(strCmd);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright (c) 2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2013 The Bitcoin Core developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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
|
||||
|
||||
@@ -19,12 +19,11 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BITCOIN_ALERT_H
|
||||
#define BITCOIN_ALERT_H
|
||||
#ifndef HUSH_ALERT_H
|
||||
#define HUSH_ALERT_H
|
||||
|
||||
#include "serialize.h"
|
||||
#include "sync.h"
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <stdint.h>
|
||||
@@ -125,4 +124,4 @@ public:
|
||||
static CAlert getAlertByHash(const uint256 &hash);
|
||||
};
|
||||
|
||||
#endif // BITCOIN_ALERT_H
|
||||
#endif // HUSH_ALERT_H
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -14,8 +16,8 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BITCOIN_ALERTKEYS_H
|
||||
#define BITCOIN_ALERTKEYS_H
|
||||
#ifndef HUSH_ALERTKEYS_H
|
||||
#define HUSH_ALERTKEYS_H
|
||||
|
||||
// REMINDER: DO NOT COMMIT YOUR PRIVATE KEYS TO THE GIT REPOSITORY, lulz
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -17,12 +17,10 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "amount.h"
|
||||
|
||||
#include "tinyformat.h"
|
||||
|
||||
const std::string CURRENCY_UNIT = "KMD";
|
||||
const std::string CURRENCY_UNIT = "HUSH";
|
||||
|
||||
CFeeRate::CFeeRate(const CAmount& nFeePaid, size_t nSize)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BITCOIN_AMOUNT_H
|
||||
#define BITCOIN_AMOUNT_H
|
||||
#ifndef HUSH_AMOUNT_H
|
||||
#define HUSH_AMOUNT_H
|
||||
|
||||
#include "serialize.h"
|
||||
|
||||
@@ -79,4 +79,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#endif // BITCOIN_AMOUNT_H
|
||||
#endif // HUSH_AMOUNT_H
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin developers
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -17,13 +17,10 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "arith_uint256.h"
|
||||
|
||||
#include "uint256.h"
|
||||
#include "utilstrencodings.h"
|
||||
#include "crypto/common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BITCOIN_ARITH_UINT256_H
|
||||
#define BITCOIN_ARITH_UINT256_H
|
||||
#ifndef HUSH_ARITH_UINT256_H
|
||||
#define HUSH_ARITH_UINT256_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <cstring>
|
||||
@@ -303,4 +303,4 @@ public:
|
||||
uint256 ArithToUint256(const arith_uint256 &);
|
||||
arith_uint256 UintToArith256(const uint256 &);
|
||||
|
||||
#endif // BITCOIN_ARITH_UINT256_H
|
||||
#endif // HUSH_ARITH_UINT256_H
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2016 The Zcash developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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
|
||||
/******************************************************************************
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2016 The Zcash developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Copyright (c) 2016 The Zcash 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. *
|
||||
* *
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2016 The Zcash developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
* - E-mail usually won't line-break if there's no punctuation to break at.
|
||||
* - Double-clicking selects the whole string as one word if it's all alphanumeric.
|
||||
*/
|
||||
#ifndef BITCOIN_BASE58_H
|
||||
#define BITCOIN_BASE58_H
|
||||
#ifndef HUSH_BASE58_H
|
||||
#define HUSH_BASE58_H
|
||||
|
||||
#include "chainparams.h"
|
||||
#include "key.h"
|
||||
@@ -224,4 +224,4 @@ public:
|
||||
typedef CBitcoinExtKeyBase<CExtKey, 74, CChainParams::EXT_SECRET_KEY> CBitcoinExtKey;
|
||||
typedef CBitcoinExtKeyBase<CExtPubKey, 74, CChainParams::EXT_PUBLIC_KEY> CBitcoinExtPubKey;
|
||||
|
||||
#endif // BITCOIN_BASE58_H
|
||||
#endif // HUSH_BASE58_H
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2017 Pieter Wuille
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2017 Pieter Wuille
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
//
|
||||
// For more information, see BIP 173.
|
||||
|
||||
#ifndef BITCOIN_BECH32_H
|
||||
#define BITCOIN_BECH32_H
|
||||
#ifndef HUSH_BECH32_H
|
||||
#define HUSH_BECH32_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
@@ -28,4 +28,4 @@ std::pair<std::string, std::vector<uint8_t>> Decode(const std::string& str);
|
||||
|
||||
} // namespace bech32
|
||||
|
||||
#endif // BITCOIN_BECH32_H
|
||||
#endif // HUSH_BECH32_H
|
||||
|
||||
@@ -17,13 +17,13 @@ BEGIN
|
||||
BLOCK "040904E4" // U.S. English - multilingual (hex)
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Hush"
|
||||
VALUE "FileDescription", "komodo-cli (JSON-RPC client for Hush-flavored Komodo)"
|
||||
VALUE "FileDescription", "hush-cli (JSON-RPC client for Hush full node)"
|
||||
VALUE "FileVersion", VER_FILEVERSION_STR
|
||||
VALUE "InternalName", "komodo-cli"
|
||||
VALUE "InternalName", "hush-cli"
|
||||
VALUE "LegalCopyright", COPYRIGHT_STR
|
||||
VALUE "LegalTrademarks1", "Distributed under the GPLv3 software license, see the accompanying file COPYING or https://www.opensource.org/licenses/mit-license.php"
|
||||
VALUE "OriginalFilename", "komodo-cli.exe"
|
||||
VALUE "ProductName", "komodo-cli"
|
||||
VALUE "LegalTrademarks1", "Distributed under the GPLv3 software license"
|
||||
VALUE "OriginalFilename", "hush-cli.exe"
|
||||
VALUE "ProductName", "hush-cli"
|
||||
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
|
||||
END
|
||||
END
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2013 The Bitcoin Core developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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
|
||||
|
||||
|
||||
@@ -16,14 +16,14 @@ BEGIN
|
||||
BEGIN
|
||||
BLOCK "040904E4" // U.S. English - multilingual (hex)
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Komodo"
|
||||
VALUE "FileDescription", "komodod (Komodo node with a JSON-RPC server)"
|
||||
VALUE "CompanyName", "Hush"
|
||||
VALUE "FileDescription", "hushd (Hush full node with a JSON-RPC server)"
|
||||
VALUE "FileVersion", VER_FILEVERSION_STR
|
||||
VALUE "InternalName", "komodod"
|
||||
VALUE "InternalName", "hushd"
|
||||
VALUE "LegalCopyright", COPYRIGHT_STR
|
||||
VALUE "LegalTrademarks1", "Distributed under the GPLv3 software license, see the accompanying file COPYING or https://www.opensource.org/licenses/mit-license.php"
|
||||
VALUE "OriginalFilename", "komodod.exe"
|
||||
VALUE "ProductName", "komodod"
|
||||
VALUE "LegalTrademarks1", "Distributed under the GPLv3 software license, see the accompanying file COPYING"
|
||||
VALUE "OriginalFilename", "hushd.exe"
|
||||
VALUE "ProductName", "hushd"
|
||||
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
|
||||
END
|
||||
END
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2013 The Bitcoin Core developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -18,7 +17,6 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "clientversion.h"
|
||||
#include "rpc/server.h"
|
||||
#include "init.h"
|
||||
@@ -60,11 +58,10 @@ static bool fDaemon;
|
||||
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
|
||||
extern int32_t ASSETCHAINS_BLOCKTIME;
|
||||
extern uint64_t ASSETCHAINS_CBOPRET;
|
||||
void komodo_passport_iteration();
|
||||
uint64_t komodo_interestsum();
|
||||
int32_t komodo_longestchain();
|
||||
void komodo_cbopretupdate(int32_t forceflag);
|
||||
CBlockIndex *komodo_chainactive(int32_t height);
|
||||
void hush_passport_iteration();
|
||||
int32_t hush_longestchain();
|
||||
void hush_cbopretupdate(int32_t forceflag);
|
||||
CBlockIndex *hush_chainactive(int32_t height);
|
||||
|
||||
void WaitForShutdown(boost::thread_group* threadGroup)
|
||||
{
|
||||
@@ -80,8 +77,8 @@ void WaitForShutdown(boost::thread_group* threadGroup)
|
||||
//fprintf(stderr,"call passport iteration\n");
|
||||
if ( SMART_CHAIN_SYMBOL[0] == 0 )
|
||||
{
|
||||
if ( KOMODO_NSPV_FULLNODE )
|
||||
komodo_passport_iteration();
|
||||
if ( HUSH_NSPV_FULLNODE )
|
||||
hush_passport_iteration();
|
||||
for (i=0; i<10; i++)
|
||||
{
|
||||
fShutdown = ShutdownRequested();
|
||||
@@ -90,10 +87,9 @@ void WaitForShutdown(boost::thread_group* threadGroup)
|
||||
MilliSleep(1000);
|
||||
}
|
||||
} else {
|
||||
//komodo_interestsum();
|
||||
//komodo_longestchain();
|
||||
//hush_longestchain();
|
||||
if ( ASSETCHAINS_CBOPRET != 0 )
|
||||
komodo_cbopretupdate(0);
|
||||
hush_cbopretupdate(0);
|
||||
for (i=0; i<=ASSETCHAINS_BLOCKTIME/5; i++)
|
||||
{
|
||||
fShutdown = ShutdownRequested();
|
||||
@@ -121,7 +117,7 @@ extern int32_t IS_HUSH_NOTARY,USE_EXTERNAL_PUBKEY;
|
||||
extern uint32_t ASSETCHAIN_INIT;
|
||||
extern std::string NOTARY_PUBKEY;
|
||||
int32_t komodo_is_issuer();
|
||||
void komodo_passport_iteration();
|
||||
void hush_passport_iteration();
|
||||
|
||||
bool AppInit(int argc, char* argv[])
|
||||
{
|
||||
@@ -131,11 +127,7 @@ bool AppInit(int argc, char* argv[])
|
||||
bool fRet = false;
|
||||
|
||||
|
||||
//fprintf(stderr, "%s start, argc=%d\n", __FUNCTION__, argc);
|
||||
//
|
||||
// Parameters
|
||||
//
|
||||
// If Qt is used, parameters/komodo.conf are parsed in qt/bitcoin.cpp's main()
|
||||
ParseParameters(argc, argv);
|
||||
|
||||
// Process help and version before taking care about datadir
|
||||
@@ -146,11 +138,9 @@ bool AppInit(int argc, char* argv[])
|
||||
if (mapArgs.count("-version"))
|
||||
{
|
||||
strUsage += LicenseInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
strUsage += "\n" + _("Usage:") + "\n" +
|
||||
" komodod [options] " + _("Start Hush-flavored Komodo Daemon") + "\n";
|
||||
" hushd [options] " + _("Start a Hush Daemon") + "\n";
|
||||
|
||||
strUsage += "\n" + HelpMessage(HMM_BITCOIND);
|
||||
}
|
||||
@@ -166,12 +156,12 @@ bool AppInit(int argc, char* argv[])
|
||||
fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n");
|
||||
return false;
|
||||
}
|
||||
void komodo_args(char *argv0);
|
||||
komodo_args(argv[0]);
|
||||
void hush_args(char *argv0);
|
||||
hush_args(argv[0]);
|
||||
void chainparams_commandline();
|
||||
chainparams_commandline();
|
||||
|
||||
fprintf(stderr,"call komodo_args.(%s) NOTARY_PUBKEY.(%s)\n",argv[0],NOTARY_PUBKEY.c_str());
|
||||
fprintf(stderr,"hush_args.(%s) NOTARY_PUBKEY.(%s) argc=%d\n",argv[0],NOTARY_PUBKEY.c_str(), argc);
|
||||
printf("initialized %s at %u\n",SMART_CHAIN_SYMBOL,(uint32_t)time(NULL));
|
||||
if (!boost::filesystem::is_directory(GetDataDir(false)))
|
||||
{
|
||||
@@ -199,7 +189,7 @@ bool AppInit(int argc, char* argv[])
|
||||
GetConfigFile().string().c_str(),
|
||||
"contrib/debian/examples/HUSH3.conf",
|
||||
"/usr/share/doc/hush/examples/HUSH3.conf",
|
||||
"https://github.com/MyHush/hush3/blob/master/contrib/debian/examples/HUSH3.conf");
|
||||
"https://git.hush.is/hush/hush3/src/branch/master/contrib/debian/examples/HUSH3.conf");
|
||||
return false;
|
||||
} catch (const std::exception& e) {
|
||||
fprintf(stderr,"Error reading configuration file: %s\n", e.what());
|
||||
@@ -209,15 +199,15 @@ bool AppInit(int argc, char* argv[])
|
||||
// Command-line RPC
|
||||
bool fCommandLine = false;
|
||||
for (int i = 1; i < argc; i++) {
|
||||
//TODO: should this be hush: or komodo: ??
|
||||
if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "komodo:")) {
|
||||
// detect accidental use of RPC in hushd
|
||||
if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "hush:")) {
|
||||
fCommandLine = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fCommandLine)
|
||||
{
|
||||
fprintf(stderr, "Error: There is no RPC client functionality in komodod. Use the komodo-cli utility instead.\n");
|
||||
fprintf(stderr, "Error: Ooops! There is no RPC client functionality in hushd. Use the hush-cli utility instead.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -225,7 +215,7 @@ bool AppInit(int argc, char* argv[])
|
||||
fDaemon = GetBoolArg("-daemon", false);
|
||||
if (fDaemon)
|
||||
{
|
||||
fprintf(stdout, "Komodo %s server starting\n",SMART_CHAIN_SYMBOL);
|
||||
fprintf(stdout, "Hush %s server starting\n",SMART_CHAIN_SYMBOL);
|
||||
|
||||
// Daemonize
|
||||
pid_t pid = fork();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Copyright (c) 2012-2014 The Bitcoin Core 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. *
|
||||
* *
|
||||
@@ -16,21 +16,16 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "bloom.h"
|
||||
|
||||
#include "primitives/transaction.h"
|
||||
#include "hash.h"
|
||||
#include "script/script.h"
|
||||
#include "script/standard.h"
|
||||
#include "random.h"
|
||||
#include "streams.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#define LN2SQUARED 0.4804530139182014246671025263266649717305529515945455
|
||||
#define LN2 0.6931471805599453094172321214581765680755001343602552
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BITCOIN_BLOOM_H
|
||||
#define BITCOIN_BLOOM_H
|
||||
#ifndef HUSH_BLOOM_H
|
||||
#define HUSH_BLOOM_H
|
||||
|
||||
#include "serialize.h"
|
||||
|
||||
@@ -150,4 +150,4 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#endif // BITCOIN_BLOOM_H
|
||||
#endif // HUSH_BLOOM_H
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -13,7 +16,6 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef CC_GATEWAYS_H
|
||||
#define CC_GATEWAYS_H
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -13,7 +16,6 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef CC_HEIR_H
|
||||
#define CC_HEIR_H
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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-2018 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -34,4 +37,4 @@ UniValue ImportGatewayExternalAddress(uint256 bindtxid,CPubKey pubkey);
|
||||
UniValue ImportGatewayDumpPrivKey(uint256 bindtxid,CKey key);
|
||||
UniValue ImportGatewayList();
|
||||
UniValue ImportGatewayInfo(uint256 bindtxid);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -17,8 +20,10 @@
|
||||
#ifndef CC_MARMARA_H
|
||||
#define CC_MARMARA_H
|
||||
|
||||
/*
|
||||
|
||||
#include "CCinclude.h"
|
||||
#include "../komodo_cJSON.h"
|
||||
#include "../hush_cJSON.h"
|
||||
|
||||
#define MARMARA_GROUPSIZE 60
|
||||
#define MARMARA_MINLOCK (1440 * 3 * 30)
|
||||
@@ -27,7 +32,7 @@
|
||||
#define EVAL_MARMARA 0xef
|
||||
|
||||
extern uint8_t ASSETCHAINS_MARMARA;
|
||||
uint64_t komodo_block_prg(uint32_t nHeight);
|
||||
uint64_t hush_block_prg(uint32_t nHeight);
|
||||
int32_t MarmaraGetcreatetxid(uint256 &createtxid,uint256 txid);
|
||||
int32_t MarmaraGetbatontxid(std::vector<uint256> &creditloop,uint256 &batontxid,uint256 txid);
|
||||
UniValue MarmaraCreditloop(uint256 txid);
|
||||
@@ -43,5 +48,6 @@ bool MarmaraValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &t
|
||||
|
||||
// CCcustom
|
||||
UniValue MarmaraInfo();
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -21,23 +24,23 @@
|
||||
#include "CCinclude.h"
|
||||
|
||||
int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks);
|
||||
extern void GetKomodoEarlytxidScriptPub();
|
||||
extern CScript KOMODO_EARLYTXID_SCRIPTPUB;
|
||||
extern void GetHushEarlytxidScriptPub();
|
||||
extern CScript HUSH_EARLYTXID_SCRIPTPUB;
|
||||
|
||||
// #define PRICES_DAYWINDOW ((3600*24/ASSETCHAINS_BLOCKTIME) + 1) // defined in hush_defs.h
|
||||
#define PRICES_TXFEE 10000
|
||||
#define PRICES_MAXLEVERAGE 777
|
||||
#define PRICES_SMOOTHWIDTH 1
|
||||
#define KOMODO_MAXPRICES 2048 // must be power of 2 and less than 8192
|
||||
#define KOMODO_PRICEMASK (~(KOMODO_MAXPRICES - 1)) // actually 1111 1000 0000 0000
|
||||
#define PRICES_WEIGHT (KOMODO_MAXPRICES * 1) // 0000 1000 0000 0000
|
||||
#define PRICES_MULT (KOMODO_MAXPRICES * 2) // 0001 0000 0000 0000
|
||||
#define PRICES_DIV (KOMODO_MAXPRICES * 3) // 0001 1000 0000 0000
|
||||
#define PRICES_INV (KOMODO_MAXPRICES * 4) // 0010 0000 0000 0000
|
||||
#define PRICES_MDD (KOMODO_MAXPRICES * 5) // 0010 1000 0000 0000
|
||||
#define PRICES_MMD (KOMODO_MAXPRICES * 6) // 0011 0000 0000 0000
|
||||
#define PRICES_MMM (KOMODO_MAXPRICES * 7) // 0011 1000 0000 0000
|
||||
#define PRICES_DDD (KOMODO_MAXPRICES * 8) // 0100 0000 0000 0000
|
||||
#define HUSH_MAXPRICES 2048 // must be power of 2 and less than 8192
|
||||
#define HUSH_PRICEMASK (~(HUSH_MAXPRICES - 1)) // actually 1111 1000 0000 0000
|
||||
#define PRICES_WEIGHT (HUSH_MAXPRICES * 1) // 0000 1000 0000 0000
|
||||
#define PRICES_MULT (HUSH_MAXPRICES * 2) // 0001 0000 0000 0000
|
||||
#define PRICES_DIV (HUSH_MAXPRICES * 3) // 0001 1000 0000 0000
|
||||
#define PRICES_INV (HUSH_MAXPRICES * 4) // 0010 0000 0000 0000
|
||||
#define PRICES_MDD (HUSH_MAXPRICES * 5) // 0010 1000 0000 0000
|
||||
#define PRICES_MMD (HUSH_MAXPRICES * 6) // 0011 0000 0000 0000
|
||||
#define PRICES_MMM (HUSH_MAXPRICES * 7) // 0011 1000 0000 0000
|
||||
#define PRICES_DDD (HUSH_MAXPRICES * 8) // 0100 0000 0000 0000
|
||||
|
||||
//#define PRICES_NORMFACTOR (int64_t)(SATOSHIDEN)
|
||||
//#define PRICES_POINTFACTOR (int64_t)10000
|
||||
|
||||
@@ -638,7 +638,7 @@ vout.n-1: opreturn with oracletxid, prevbatontxid and data in proper format
|
||||
|
||||
The oraclesdata transaction is the most complex as it needs to find and spend the baton utxo, use the correct datafee and spend funds from the locked subscription funds. With the above, the oracles CC is complete and allows the creations of massively parallel data streams from multiple vendors that uses free market feedback via payments, ie. poorly performing providers wont get renewals.
|
||||
|
||||
I expect that at first, the data providers will just be dapp developers deploying a working system including the required data, but its structure allows open market competition. Of course, specific dapps could restrict themselves to using only publishers from a whitelist of pubkeys. The potential usecases for oracles CC is quite varied and limited only by the imagination.
|
||||
I expect that at first, the data providers will just be dapp developers deploying a working system including the required data, but its structure allows open market competition. Of course, specific dapps could restrict themselves to using only publishers from a allowlist of pubkeys. The potential usecases for oracles CC is quite varied and limited only by the imagination.
|
||||
|
||||
Chapter 12 - limitless possibilities
|
||||
As can be seen, CC contracts can do a wide range of things and since they are Turing complete, we know that this is true. However, what is more important is the added security gained from using a utxo based system. While in some ways it is more complex to have to deal with utxo, as can be seen by the above examples, it is either solved and made invisible at the rpc level, or actually used as part of the solution.
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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-2018 The SuperNET Developers. *
|
||||
* *
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -157,7 +160,7 @@ UniValue AssetOrders(uint256 refassetid, CPubKey pk, uint8_t additionalEvalCode)
|
||||
// not used (use TokenCreate instead)
|
||||
/* std::string CreateAsset(int64_t txfee,int64_t assetsupply,std::string name,std::string description)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk; struct CCcontract_info *cp,C;
|
||||
if ( assetsupply < 0 )
|
||||
{
|
||||
@@ -185,7 +188,7 @@ UniValue AssetOrders(uint256 refassetid, CPubKey pk, uint8_t additionalEvalCode)
|
||||
// not used (use TokenTransfer instead)
|
||||
/* std::string AssetTransfer(int64_t txfee,uint256 assetid,std::vector<uint8_t> destpubkey,int64_t total)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk; uint64_t mask; int64_t CCchange=0,inputs=0; struct CCcontract_info *cp,C;
|
||||
if ( total < 0 )
|
||||
{
|
||||
@@ -227,7 +230,7 @@ UniValue AssetOrders(uint256 refassetid, CPubKey pk, uint8_t additionalEvalCode)
|
||||
// deprecated
|
||||
/* std::string AssetConvert(int64_t txfee,uint256 assetid,std::vector<uint8_t> destpubkey,int64_t total,int32_t evalcode)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk; int64_t CCchange=0,inputs=0; struct CCcontract_info *cp,C;
|
||||
if ( total < 0 )
|
||||
{
|
||||
@@ -255,7 +258,7 @@ UniValue AssetOrders(uint256 refassetid, CPubKey pk, uint8_t additionalEvalCode)
|
||||
// rpc tokenbid implementation, locks 'bidamount' coins for the 'pricetotal' of tokens
|
||||
std::string CreateBuyOffer(int64_t txfee, int64_t bidamount, uint256 assetid, int64_t pricetotal)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk;
|
||||
struct CCcontract_info *cpAssets, C;
|
||||
uint256 hashBlock;
|
||||
@@ -313,7 +316,7 @@ std::string CreateBuyOffer(int64_t txfee, int64_t bidamount, uint256 assetid, in
|
||||
// rpc tokenask implementation, locks 'askamount' tokens for the 'pricetotal'
|
||||
std::string CreateSell(int64_t txfee,int64_t askamount,uint256 assetid,int64_t pricetotal)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk;
|
||||
uint64_t mask;
|
||||
int64_t inputs, CCchange;
|
||||
@@ -383,7 +386,7 @@ std::string CreateSell(int64_t txfee,int64_t askamount,uint256 assetid,int64_t p
|
||||
////////////////////////// NOT IMPLEMENTED YET/////////////////////////////////
|
||||
std::string CreateSwap(int64_t txfee,int64_t askamount,uint256 assetid,uint256 assetid2,int64_t pricetotal)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk; uint64_t mask; int64_t inputs,CCchange; CScript opret; struct CCcontract_info *cp,C;
|
||||
|
||||
////////////////////////// NOT IMPLEMENTED YET/////////////////////////////////
|
||||
@@ -452,7 +455,7 @@ std::string CreateSwap(int64_t txfee,int64_t askamount,uint256 assetid,uint256 a
|
||||
// unlocks coins
|
||||
std::string CancelBuyOffer(int64_t txfee,uint256 assetid,uint256 bidtxid)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CTransaction vintx; uint64_t mask;
|
||||
uint256 hashBlock; int64_t bidamount;
|
||||
CPubKey mypk; struct CCcontract_info *cpAssets, C;
|
||||
@@ -498,7 +501,7 @@ std::string CancelBuyOffer(int64_t txfee,uint256 assetid,uint256 bidtxid)
|
||||
//unlocks tokens
|
||||
std::string CancelSell(int64_t txfee,uint256 assetid,uint256 asktxid)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CTransaction vintx; uint64_t mask;
|
||||
uint256 hashBlock; int64_t askamount;
|
||||
CPubKey mypk;
|
||||
@@ -566,7 +569,7 @@ std::string CancelSell(int64_t txfee,uint256 assetid,uint256 asktxid)
|
||||
//send tokens, receive coins:
|
||||
std::string FillBuyOffer(int64_t txfee,uint256 assetid,uint256 bidtxid,int64_t fillamount)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CTransaction vintx;
|
||||
uint256 hashBlock;
|
||||
CPubKey mypk;
|
||||
@@ -655,7 +658,7 @@ std::string FillBuyOffer(int64_t txfee,uint256 assetid,uint256 bidtxid,int64_t f
|
||||
// send coins, receive tokens
|
||||
std::string FillSell(int64_t txfee, uint256 assetid, uint256 assetid2, uint256 asktxid, int64_t fillunits)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CTransaction vintx,filltx;
|
||||
uint256 hashBlock;
|
||||
CPubKey mypk;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -12,13 +15,9 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef CC_FAUCET_H
|
||||
#define CC_FAUCET_H
|
||||
|
||||
#include "CCinclude.h"
|
||||
|
||||
#define EVAL_FAUCET 0xe4
|
||||
#define FAUCETSIZE (COIN / 10)
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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
|
||||
/******************************************************************************
|
||||
@@ -15,14 +15,14 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef CC_INCLUDE_H
|
||||
#define CC_INCLUDE_H
|
||||
|
||||
/*! \file CCinclude.h
|
||||
\brief A Documented file.
|
||||
\brief Cryptoconditions
|
||||
|
||||
CCs for teh lulz
|
||||
|
||||
Details.
|
||||
*/
|
||||
|
||||
/// \mainpage Brief introduction into cryptocondition contracts
|
||||
@@ -32,7 +32,7 @@ Details.
|
||||
/// this script's hash is what the p2sh address was.
|
||||
/// All of the above are the standard bitcoin vout types and there should be plenty of materials about it.
|
||||
///
|
||||
/// What I did with the cryptoconditions (CC) contracts (now rebranded as Antara modules) is created a fourth type of vout, the CC vout. This is using the cryptoconditions standard and it is even a different signature mechanism,
|
||||
/// Cryptoconditions (CC) contracts created a fourth type of vout, the CC vout. This is using the cryptoconditions standard and it is even a different signature mechanism,
|
||||
/// ed25519 instead of secp256k1. It is basically a big extension to the bitcoin script. There is a special opcode that is added that says it is a CC script.
|
||||
///
|
||||
/// But it gets more interesting. Each CC script has an evalcode.
|
||||
@@ -49,7 +49,7 @@ Details.
|
||||
/// However, it is a CC output, so in addition to the signature, whatever constraints a CC contract implements must also be satistifed.
|
||||
/// This allows funds to be locked and yet anybody is able to spend it, assuming they satisfy the CC's rules.
|
||||
///
|
||||
/// One other technical note is that komodod has the insight-explorer extensions built in
|
||||
/// One other technical note is that Hush has the insight-explorer extensions built in
|
||||
/// 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.
|
||||
///
|
||||
@@ -70,15 +70,15 @@ Details.
|
||||
#include "../utlist.h"
|
||||
#include "../uthash.h"
|
||||
#include "merkleblock.h"
|
||||
#include "../komodo_nSPV_defs.h"
|
||||
#include "../komodo_cJSON.h"
|
||||
#include "../hush_nSPV_defs.h"
|
||||
#include "../hush_cJSON.h"
|
||||
#include "../init.h"
|
||||
#include "rpc/server.h"
|
||||
|
||||
#define CC_BURNPUBKEY "02deaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead" //!< 'dead' pubkey in hex for burning tokens (if tokens are sent to it, they become 'burned')
|
||||
/// \cond INTERNAL
|
||||
#define CC_MAXVINS 1024
|
||||
#define CC_REQUIREMENTS_MSG (KOMODO_NSPV_SUPERLITE?"to use CC contracts you need to nspv_login first\n":"to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n")
|
||||
#define CC_REQUIREMENTS_MSG (HUSH_NSPV_SUPERLITE?"to use CC contracts you need to nspv_login first\n":"to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n")
|
||||
|
||||
#define SMALLVAL 0.000000000000001
|
||||
#define SATOSHIDEN ((uint64_t)100000000L)
|
||||
@@ -86,7 +86,7 @@ Details.
|
||||
#define CCDISABLEALL memset(ASSETCHAINS_CCDISABLES,1,sizeof(ASSETCHAINS_CCDISABLES))
|
||||
#define CCENABLE(x) ASSETCHAINS_CCDISABLES[((uint8_t)x)] = 0
|
||||
|
||||
/* moved to komodo_cJSON.h
|
||||
/* moved to hush_cJSON.h
|
||||
#ifndef _BITS256
|
||||
#define _BITS256
|
||||
union _bits256 { uint8_t bytes[32]; uint16_t ushorts[16]; uint32_t uints[8]; uint64_t ulongs[4]; uint64_t txid; };
|
||||
@@ -101,12 +101,12 @@ Details.
|
||||
enum opretid : uint8_t {
|
||||
// cc contracts data:
|
||||
OPRETID_NONFUNGIBLEDATA = 0x11, //!< NFT data id
|
||||
OPRETID_ASSETSDATA = 0x12, //!< assets contract data id
|
||||
OPRETID_GATEWAYSDATA = 0x13, //!< gateways contract data id
|
||||
OPRETID_CHANNELSDATA = 0x14, //!< channels contract data id
|
||||
OPRETID_HEIRDATA = 0x15, //!< heir contract data id
|
||||
OPRETID_ROGUEGAMEDATA = 0x16, //!< rogue contract data id
|
||||
OPRETID_PEGSDATA = 0x17, //!< pegs contract data id
|
||||
OPRETID_ASSETSDATA = 0x12, //!< assets contract data id
|
||||
OPRETID_GATEWAYSDATA = 0x13, //!< gateways contract data id
|
||||
OPRETID_CHANNELSDATA = 0x14, //!< channels contract data id
|
||||
OPRETID_HEIRDATA = 0x15, //!< heir contract data id
|
||||
OPRETID_ROGUEGAMEDATA = 0x16, //!< rogue contract data id
|
||||
OPRETID_PEGSDATA = 0x17, //!< pegs contract data id
|
||||
|
||||
/*! \cond INTERNAL */
|
||||
// non cc contract data:
|
||||
@@ -138,8 +138,6 @@ struct CC_utxo
|
||||
/// \endcond
|
||||
|
||||
/// \cond INTERNAL
|
||||
// these are the parameters stored after Verus crypto-condition vouts. new versions may change
|
||||
// the format
|
||||
struct CC_meta
|
||||
{
|
||||
std::vector<unsigned char> version;
|
||||
@@ -243,8 +241,6 @@ extern CWallet* pwalletMain; //!< global wallet object pointer to access wallet
|
||||
|
||||
/// @private seems old-style
|
||||
bool GetAddressUnspent(uint160 addressHash, int type,std::vector<std::pair<CAddressUnspentKey,CAddressUnspentValue> > &unspentOutputs);
|
||||
//CBlockIndex *komodo_getblockindex(uint256 hash); //moved to komodo_def.h
|
||||
//int32_t komodo_nextheight(); //moved to komodo_def.h
|
||||
|
||||
/// CCgetspenttxid finds the txid of the transaction which spends a transaction output. The function does this without loading transactions from the chain, by using spent index
|
||||
/// @param[out] spenttxid transaction id of the spending transaction
|
||||
@@ -260,11 +256,6 @@ void CCclearvars(struct CCcontract_info *cp);
|
||||
UniValue CClib(struct CCcontract_info *cp,char *method,char *jsonstr);
|
||||
UniValue CClib_info(struct CCcontract_info *cp);
|
||||
|
||||
//CBlockIndex *komodo_blockindex(uint256 hash); //moved to komodo_def.h
|
||||
//CBlockIndex *komodo_chainactive(int32_t height); //moved to komodo_def.h
|
||||
//int32_t komodo_blockheight(uint256 hash); //moved to komodo_def.h
|
||||
//void StartShutdown();
|
||||
|
||||
static const uint256 zeroid; //!< null uint256 constant
|
||||
|
||||
/// \cond INTERNAL
|
||||
@@ -383,11 +374,8 @@ int64_t IsTokensvout(bool goDeeper, bool checkPubkeys, struct CCcontract_info *c
|
||||
/// returns true if success
|
||||
bool DecodeHexTx(CTransaction& tx, const std::string& strHexTx);
|
||||
|
||||
//void komodo_sendmessage(int32_t minpeers,int32_t maxpeers,const char *message,std::vector<uint8_t> payload); // moved to hush_defs.h
|
||||
|
||||
/// @private
|
||||
int32_t payments_parsehexdata(std::vector<uint8_t> &hexdata,cJSON *item,int32_t len);
|
||||
// int32_t komodo_blockload(CBlock& block,CBlockIndex *pindex); // this def in hush_defs.h
|
||||
|
||||
/// Makes opreturn scriptPubKey for token creation transaction. Normally this function is called internally by the tokencreate rpc. You might need to call this function to create a customized token.
|
||||
/// The total opreturn length should not exceed 10001 byte
|
||||
@@ -704,7 +692,6 @@ uint64_t stringbits(char *str);
|
||||
uint256 revuint256(uint256 txid);
|
||||
char *uint256_str(char *dest,uint256 txid);
|
||||
char *pubkey33_str(char *dest,uint8_t *pubkey33);
|
||||
//uint256 Parseuint256(const char *hexstr); // located in komodo_defs
|
||||
/// \endcond
|
||||
|
||||
/// converts public key as array of uint8_t to normal address
|
||||
@@ -774,7 +761,7 @@ bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey);
|
||||
/// @returns true if success
|
||||
bool GetCustomscriptaddress(char *destaddr,const CScript &scriptPubKey,uint8_t taddr,uint8_t prefix,uint8_t prefix2);
|
||||
|
||||
/// Returns my pubkey, that is set by -pubkey komodod parameter
|
||||
/// Returns my pubkey, that is set by -pubkey hushd parameter
|
||||
/// @returns public key as byte array
|
||||
std::vector<uint8_t> Mypubkey();
|
||||
|
||||
@@ -798,8 +785,6 @@ int32_t CCCointxidExists(char const *logcategory,uint256 cointxid);
|
||||
/// @private
|
||||
uint256 BitcoinGetProofMerkleRoot(const std::vector<uint8_t> &proofData, std::vector<uint256> &txids);
|
||||
|
||||
// bool komodo_txnotarizedconfirmed(uint256 txid); //moved to hush_defs.h
|
||||
|
||||
/// @private
|
||||
CPubKey check_signing_pubkey(CScript scriptSig);
|
||||
|
||||
@@ -825,7 +810,7 @@ std::string FinalizeCCTx(uint64_t skipmask,struct CCcontract_info *cp,CMutableTr
|
||||
|
||||
/// FinalizeCCTx is a very useful function that will properly sign both CC and normal inputs, adds normal change and might add an opreturn output.
|
||||
/// This allows for Antara module transaction creation rpc functions to create an CMutableTransaction object, add the appropriate vins and vouts to it and use FinalizeCCTx to properly sign the transaction.
|
||||
/// By using -addressindex=1 of komodod daemon, it allows tracking of all the CC addresses.
|
||||
/// By using -addressindex=1 of hushd daemon, it allows tracking of all the CC addresses.
|
||||
///
|
||||
/// For signing the vins the function builds several default probe scriptPubKeys and checks them against the referred previous transactions (vintx) vouts.
|
||||
/// For cryptocondition vins the function creates a basic set of probe cryptconditions with mypk and module global pubkey, both for coins and tokens cases.
|
||||
@@ -893,7 +878,7 @@ int64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int3
|
||||
int64_t AddNormalinputsLocal(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int32_t maxinputs);
|
||||
|
||||
/// AddNormalinputs2 adds normal (not cc) inputs to the transaction object vin array for the specified total amount using utxos on my pubkey's TX_PUBKEY address (my pubkey is set by -pubkey command line parameter), to fund the transaction.
|
||||
/// 'My pubkey' is the -pubkey parameter of komodod.
|
||||
/// 'My pubkey' is the -pubkey parameter of hushd.
|
||||
/// @param mtx mutable transaction object
|
||||
/// @param total amount of inputs to add. If total equals to 0 the function does not add inputs but returns amount of all available normal inputs in the wallet
|
||||
/// @param maxinputs maximum number of inputs to add
|
||||
@@ -972,7 +957,7 @@ void CCLogPrintStream(const char *category, int level, const char *functionName,
|
||||
}
|
||||
/// Macro for logging messages using bitcoin LogAcceptCategory and LogPrintStr functions.
|
||||
/// Supports error, info and three levels of debug messages.
|
||||
/// Logging category is set by -debug=category komodod param.
|
||||
/// Logging category is set by -debug=category hushd param.
|
||||
/// To set debug level pass -debug=category-1, -debug=category-2 or -debug=category-3 param. If some level is enabled lower level messages also will be printed.
|
||||
/// To print info-level messages pass just -debug=category parameter, with no level.
|
||||
/// Error-level messages will always be printed, even if -debug parameter is not set
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -799,7 +802,7 @@ CPubKey GetTokenOriginatorPubKey(CScript scriptPubKey) {
|
||||
// returns token creation signed raw tx
|
||||
std::string CreateToken(int64_t txfee, int64_t tokensupply, std::string name, std::string description, vscript_t nonfungibleData)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk; struct CCcontract_info *cp, C;
|
||||
if (tokensupply < 0) {
|
||||
CCerror = "negative tokensupply";
|
||||
@@ -854,7 +857,7 @@ std::string CreateToken(int64_t txfee, int64_t tokensupply, std::string name, st
|
||||
// param additionalEvalCode allows transfer of dual-eval non-fungible tokens
|
||||
std::string TokenTransfer(int64_t txfee, uint256 tokenid, vscript_t destpubkey, int64_t total)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk; uint64_t mask; int64_t CCchange = 0, inputs = 0; struct CCcontract_info *cp, C;
|
||||
vscript_t vopretNonfungible, vopretEmpty;
|
||||
|
||||
@@ -918,7 +921,7 @@ std::string TokenTransfer(int64_t txfee, uint256 tokenid, vscript_t destpubkey,
|
||||
int64_t GetTokenBalance(CPubKey pk, uint256 tokenid)
|
||||
{
|
||||
uint256 hashBlock;
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CTransaction tokentx;
|
||||
|
||||
// CCerror = strprintf("obsolete, cannot return correct value without eval");
|
||||
@@ -956,7 +959,7 @@ UniValue TokenInfo(uint256 tokenid)
|
||||
result.push_back(Pair("error", "cant find tokenid"));
|
||||
return(result);
|
||||
}
|
||||
if ( KOMODO_NSPV_FULLNODE && hashBlock.IsNull()) {
|
||||
if ( HUSH_NSPV_FULLNODE && hashBlock.IsNull()) {
|
||||
result.push_back(Pair("result", "error"));
|
||||
result.push_back(Pair("error", "the transaction is still in mempool"));
|
||||
return(result);
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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-2018 The SuperNET Developers. *
|
||||
* *
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -182,7 +185,7 @@ UniValue FinalizeCCTxExt(bool remote, uint64_t CCmask, struct CCcontract_info *c
|
||||
utxovout = mtx.vin[i].prevout.n;
|
||||
if ( vintx.vout[utxovout].scriptPubKey.IsPayToCryptoCondition() == 0 )
|
||||
{
|
||||
if ( KOMODO_NSPV_FULLNODE )
|
||||
if ( HUSH_NSPV_FULLNODE )
|
||||
{
|
||||
if (!remote)
|
||||
{
|
||||
@@ -397,7 +400,7 @@ void NSPV_CCtxids(std::vector<uint256> &txids,char *coinaddr,bool ccflag, uint8_
|
||||
void SetCCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &unspentOutputs,char *coinaddr,bool ccflag)
|
||||
{
|
||||
int32_t type=0,i,n; char *ptr; std::string addrstr; uint160 hashBytes; std::vector<std::pair<uint160, int> > addresses;
|
||||
if ( KOMODO_NSPV_SUPERLITE )
|
||||
if ( HUSH_NSPV_SUPERLITE )
|
||||
{
|
||||
NSPV_CCunspents(unspentOutputs,coinaddr,ccflag);
|
||||
return;
|
||||
@@ -421,7 +424,7 @@ void SetCCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValu
|
||||
void SetCCtxids(std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex,char *coinaddr,bool ccflag)
|
||||
{
|
||||
int32_t type=0,i,n; char *ptr; std::string addrstr; uint160 hashBytes; std::vector<std::pair<uint160, int> > addresses;
|
||||
if ( KOMODO_NSPV_SUPERLITE )
|
||||
if ( HUSH_NSPV_SUPERLITE )
|
||||
{
|
||||
NSPV_CCtxids(addressIndex,coinaddr,ccflag);
|
||||
return;
|
||||
@@ -446,7 +449,7 @@ void SetCCtxids(std::vector<uint256> &txids,char *coinaddr,bool ccflag, uint8_t
|
||||
{
|
||||
int32_t type=0,i,n; char *ptr; std::string addrstr; uint160 hashBytes; std::vector<std::pair<uint160, int> > addresses;
|
||||
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
|
||||
if ( KOMODO_NSPV_SUPERLITE )
|
||||
if ( HUSH_NSPV_SUPERLITE )
|
||||
{
|
||||
NSPV_CCtxids(txids,coinaddr,ccflag,evalcode,filtertxid,func);
|
||||
return;
|
||||
@@ -637,7 +640,7 @@ int32_t CC_vinselect(int32_t *aboveip,int64_t *abovep,int32_t *belowip,int64_t *
|
||||
int64_t AddNormalinputsLocal(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int32_t maxinputs)
|
||||
{
|
||||
int32_t abovei,belowi,ind,vout,i,n = 0; int64_t sum,threshold,above,below; int64_t remains,nValue,totalinputs = 0; uint256 txid,hashBlock; std::vector<COutput> vecOutputs; CTransaction tx; struct CC_utxo *utxos,*up;
|
||||
if ( KOMODO_NSPV_SUPERLITE )
|
||||
if ( HUSH_NSPV_SUPERLITE )
|
||||
return(NSPV_AddNormalinputs(mtx,mypk,total,maxinputs,&NSPV_U));
|
||||
|
||||
// if (mypk != pubkey2pk(Mypubkey())) //remote superlite mypk, do not use wallet since it is not locked for non-equal pks (see rpcs with nspv support)!
|
||||
@@ -746,7 +749,7 @@ int64_t AddNormalinputsRemote(CMutableTransaction &mtx, CPubKey mypk, int64_t to
|
||||
{
|
||||
int32_t abovei,belowi,ind,vout,i,n = 0; int64_t sum,threshold,above,below; int64_t remains,nValue,totalinputs = 0; char coinaddr[64]; uint256 txid,hashBlock; CTransaction tx; struct CC_utxo *utxos,*up;
|
||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||
if ( KOMODO_NSPV_SUPERLITE )
|
||||
if ( HUSH_NSPV_SUPERLITE )
|
||||
return(NSPV_AddNormalinputs(mtx,mypk,total,maxinputs,&NSPV_U));
|
||||
utxos = (struct CC_utxo *)calloc(CC_MAXVINS,sizeof(*utxos));
|
||||
if ( maxinputs > CC_MAXVINS )
|
||||
@@ -850,4 +853,4 @@ void AddSigData2UniValue(UniValue &sigdata, int32_t vini, UniValue& ccjson, std:
|
||||
elem.push_back(Pair("scriptPubKey", sscriptpubkey));
|
||||
elem.push_back(Pair("amount", amount));
|
||||
sigdata.push_back(elem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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 <20> 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -18,7 +21,7 @@
|
||||
*/
|
||||
|
||||
#include "CCinclude.h"
|
||||
#include "komodo_structs.h"
|
||||
#include "hush_structs.h"
|
||||
|
||||
int32_t unstringbits(char *buf,uint64_t bits)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -13,12 +16,9 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
/*
|
||||
CCutils has low level functions that are universally useful for all contracts.
|
||||
*/
|
||||
|
||||
// CCutils has low level functions that are universally useful for all contracts.
|
||||
#include "CCinclude.h"
|
||||
#include "komodo_structs.h"
|
||||
#include "hush_structs.h"
|
||||
#include "key_io.h"
|
||||
|
||||
#ifdef TESTMODE
|
||||
@@ -27,8 +27,8 @@
|
||||
#define MIN_NON_NOTARIZED_CONFIRMS 101
|
||||
#endif // TESTMODE
|
||||
int32_t hush_dpowconfs(int32_t height,int32_t numconfs);
|
||||
struct komodo_state *komodo_stateptr(char *symbol,char *dest);
|
||||
extern uint32_t KOMODO_DPOWCONFS;
|
||||
struct hush_state *hush_stateptr(char *symbol,char *dest);
|
||||
extern uint32_t HUSH_DPOWCONFS;
|
||||
|
||||
void endiancpy(uint8_t *dest,uint8_t *src,int32_t len)
|
||||
{
|
||||
@@ -172,8 +172,8 @@ bool CheckTxFee(const CTransaction &tx, uint64_t txfee, uint32_t height, uint64_
|
||||
|
||||
uint32_t GetLatestTimestamp(int32_t height)
|
||||
{
|
||||
if ( KOMODO_NSPV_SUPERLITE ) return ((uint32_t)NSPV_blocktime(height));
|
||||
return(komodo_heightstamp(height));
|
||||
if ( HUSH_NSPV_SUPERLITE ) return ((uint32_t)NSPV_blocktime(height));
|
||||
return(hush_heightstamp(height));
|
||||
} // :P
|
||||
|
||||
void CCaddr2set(struct CCcontract_info *cp,uint8_t evalcode,CPubKey pk,uint8_t *priv,char *coinaddr)
|
||||
@@ -451,7 +451,7 @@ extern uint32_t NSPV_logintime;
|
||||
bool Myprivkey(uint8_t myprivkey[])
|
||||
{
|
||||
char coinaddr[64],checkaddr[64]; std::string strAddress; char *dest; int32_t i,n; CBitcoinAddress address; CKeyID keyID; CKey vchSecret; uint8_t buf33[33];
|
||||
if ( KOMODO_NSPV_SUPERLITE )
|
||||
if ( HUSH_NSPV_SUPERLITE )
|
||||
{
|
||||
if ( NSPV_logintime == 0 || time(NULL) > NSPV_logintime+NSPV_AUTOLOGOUT )
|
||||
{
|
||||
@@ -529,7 +529,7 @@ int64_t CCduration(int32_t &numblocks,uint256 txid)
|
||||
//fprintf(stderr,"CCduration no hashBlock for txid %s\n",uint256_str(str,txid));
|
||||
return(0);
|
||||
}
|
||||
else if ( (pindex= komodo_getblockindex(hashBlock)) == 0 || (txtime= pindex->nTime) == 0 || (txheight= pindex->GetHeight()) <= 0 )
|
||||
else if ( (pindex= hush_getblockindex(hashBlock)) == 0 || (txtime= pindex->nTime) == 0 || (txheight= pindex->GetHeight()) <= 0 )
|
||||
{
|
||||
fprintf(stderr,"CCduration no txtime %u or txheight.%d %p for txid %s\n",txtime,txheight,pindex,uint256_str(str,txid));
|
||||
return(0);
|
||||
@@ -591,7 +591,7 @@ int32_t NSPV_coinaddr_inmempool(char const *logcategory,char *coinaddr,uint8_t C
|
||||
int32_t myIs_coinaddr_inmempoolvout(char const *logcategory,char *coinaddr)
|
||||
{
|
||||
int32_t i,n; char destaddr[64];
|
||||
if ( KOMODO_NSPV_SUPERLITE )
|
||||
if ( HUSH_NSPV_SUPERLITE )
|
||||
return(NSPV_coinaddr_inmempool(logcategory,coinaddr,1));
|
||||
BOOST_FOREACH(const CTxMemPoolEntry &e,mempool.mapTx)
|
||||
{
|
||||
@@ -620,7 +620,7 @@ int32_t myGet_mempool_txs(std::vector<CTransaction> &txs,uint8_t evalcode,uint8_
|
||||
{
|
||||
int i=0;
|
||||
|
||||
if ( KOMODO_NSPV_SUPERLITE )
|
||||
if ( HUSH_NSPV_SUPERLITE )
|
||||
{
|
||||
CTransaction tx; uint256 hashBlock;
|
||||
|
||||
@@ -666,9 +666,9 @@ uint256 BitcoinGetProofMerkleRoot(const std::vector<uint8_t> &proofData, std::ve
|
||||
}
|
||||
|
||||
extern struct NSPV_inforesp NSPV_inforesult;
|
||||
int32_t komodo_get_current_height()
|
||||
int32_t hush_get_current_height()
|
||||
{
|
||||
if ( KOMODO_NSPV_SUPERLITE )
|
||||
if ( HUSH_NSPV_SUPERLITE )
|
||||
{
|
||||
return (NSPV_inforesult.height);
|
||||
}
|
||||
@@ -682,9 +682,9 @@ bool komodo_txnotarizedconfirmed(uint256 txid)
|
||||
CTransaction tx;
|
||||
uint256 hashBlock;
|
||||
CBlockIndex *pindex;
|
||||
char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct komodo_state *sp;
|
||||
char symbol[HUSH_SMART_CHAIN_MAXLEN],dest[HUSH_SMART_CHAIN_MAXLEN]; struct hush_state *sp;
|
||||
|
||||
if ( KOMODO_NSPV_SUPERLITE )
|
||||
if ( HUSH_NSPV_SUPERLITE )
|
||||
{
|
||||
if ( NSPV_myGetTransaction(txid,tx,hashBlock,txheight,currentheight) == 0 )
|
||||
{
|
||||
@@ -715,7 +715,7 @@ bool komodo_txnotarizedconfirmed(uint256 txid)
|
||||
fprintf(stderr,"komodo_txnotarizedconfirmed no hashBlock for txid %s\n",txid.ToString().c_str());
|
||||
return(0);
|
||||
}
|
||||
else if ( (pindex= komodo_blockindex(hashBlock)) == 0 || (txheight= pindex->GetHeight()) <= 0 )
|
||||
else if ( (pindex= hush_blockindex(hashBlock)) == 0 || (txheight= pindex->GetHeight()) <= 0 )
|
||||
{
|
||||
fprintf(stderr,"komodo_txnotarizedconfirmed no txheight.%d %p for txid %s\n",txheight,pindex,txid.ToString().c_str());
|
||||
return(0);
|
||||
@@ -728,7 +728,7 @@ bool komodo_txnotarizedconfirmed(uint256 txid)
|
||||
confirms=1 + pindex->GetHeight() - txheight;
|
||||
}
|
||||
|
||||
if ((sp= komodo_stateptr(symbol,dest)) != 0 && (notarized=sp->NOTARIZED_HEIGHT) > 0 && txheight > sp->NOTARIZED_HEIGHT) notarized=0;
|
||||
if ((sp= hush_stateptr(symbol,dest)) != 0 && (notarized=sp->NOTARIZED_HEIGHT) > 0 && txheight > sp->NOTARIZED_HEIGHT) notarized=0;
|
||||
#ifdef TESTMODE
|
||||
notarized=0;
|
||||
#endif //TESTMODE
|
||||
@@ -823,12 +823,12 @@ int64_t TotalPubkeyCCInputs(const CTransaction &tx, const CPubKey &pubkey)
|
||||
bool ProcessCC(struct CCcontract_info *cp,Eval* eval, std::vector<uint8_t> paramsNull,const CTransaction &ctx, unsigned int nIn)
|
||||
{
|
||||
CTransaction createTx; uint256 assetid,assetid2,hashBlock; uint8_t funcid; int32_t height,i,n,from_mempool = 0; int64_t amount; std::vector<uint8_t> origpubkey;
|
||||
height = KOMODO_CONNECTING;
|
||||
if ( KOMODO_CONNECTING < 0 ) // always comes back with > 0 for final confirmation
|
||||
height = HUSH_CONNECTING;
|
||||
if ( HUSH_CONNECTING < 0 ) // always comes back with > 0 for final confirmation
|
||||
return(true);
|
||||
if ( ASSETCHAINS_CC == 0 || (height & ~(1<<30)) < KOMODO_CCACTIVATE )
|
||||
if ( ASSETCHAINS_CC == 0 || (height & ~(1<<30)) < HUSH_CCACTIVATE )
|
||||
return eval->Invalid("CC are disabled or not active yet");
|
||||
if ( (KOMODO_CONNECTING & (1<<30)) != 0 )
|
||||
if ( (HUSH_CONNECTING & (1<<30)) != 0 )
|
||||
{
|
||||
from_mempool = 1;
|
||||
height &= ((1<<30) - 1);
|
||||
@@ -836,7 +836,7 @@ bool ProcessCC(struct CCcontract_info *cp,Eval* eval, std::vector<uint8_t> param
|
||||
if (cp->validate == NULL)
|
||||
return eval->Invalid("validation not supported for eval code");
|
||||
|
||||
//fprintf(stderr,"KOMODO_CONNECTING.%d mempool.%d vs CCactive.%d\n",height,from_mempool,KOMODO_CCACTIVATE);
|
||||
//fprintf(stderr,"HUSH_CONNECTING.%d mempool.%d vs CCactive.%d\n",height,from_mempool,HUSH_CCACTIVATE);
|
||||
// there is a chance CC tx is valid in mempool, but invalid when in block, so we cant filter duplicate requests. if any of the vins are spent, for example
|
||||
//txid = ctx.GetHash();
|
||||
//if ( txid == cp->prevtxid )
|
||||
@@ -869,12 +869,12 @@ bool CClib_Dispatch(const CC *cond,Eval *eval,std::vector<uint8_t> paramsNull,co
|
||||
fprintf(stderr,"-ac_cclib=%s vs myname %s\n",ASSETCHAINS_CCLIB.c_str(),MYCCLIBNAME.c_str());
|
||||
return eval->Invalid("-ac_cclib name mismatches myname");
|
||||
}
|
||||
height = KOMODO_CONNECTING;
|
||||
if ( KOMODO_CONNECTING < 0 ) // always comes back with > 0 for final confirmation
|
||||
height = HUSH_CONNECTING;
|
||||
if ( HUSH_CONNECTING < 0 ) // always comes back with > 0 for final confirmation
|
||||
return(true);
|
||||
if ( ASSETCHAINS_CC == 0 || (height & ~(1<<30)) < KOMODO_CCACTIVATE )
|
||||
if ( ASSETCHAINS_CC == 0 || (height & ~(1<<30)) < HUSH_CCACTIVATE )
|
||||
return eval->Invalid("CC are disabled or not active yet");
|
||||
if ( (KOMODO_CONNECTING & (1<<30)) != 0 )
|
||||
if ( (HUSH_CONNECTING & (1<<30)) != 0 )
|
||||
{
|
||||
from_mempool = 1;
|
||||
height &= ((1<<30) - 1);
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
/*Descriptson and examples of COptCCParams class found in:
|
||||
script/standard.h/cpp
|
||||
class COptCCParams
|
||||
|
||||
structure of data in vData payload attached to end of CCvout:
|
||||
param
|
||||
OP_1
|
||||
param
|
||||
OP_2 ... etc until OP_16
|
||||
OP_PUSHDATA4 is the last OP code to tell things its at the end.
|
||||
|
||||
taken from standard.cpp line 22: COptCCParams::COptCCParams(std::vector<unsigned char> &vch)
|
||||
|
||||
EXAMPLE taken from Verus how to create scriptPubKey from COptCCParams class:
|
||||
EXAMPLE taken from Verus how to decode scriptPubKey from COptCCParams class:
|
||||
*/
|
||||
|
||||
bool MakeGuardedOutput(CAmount value, CPubKey &dest, CTransaction &stakeTx, CTxOut &vout)
|
||||
{
|
||||
CCcontract_info *cp, C;
|
||||
cp = CCinit(&C,EVAL_STAKEGUARD);
|
||||
|
||||
CPubKey ccAddress = CPubKey(ParseHex(cp->CChexstr));
|
||||
|
||||
// return an output that is bound to the stake transaction and can be spent by presenting either a signed condition by the original
|
||||
// destination address or a properly signed stake transaction of the same utxo on a fork
|
||||
vout = MakeCC1of2vout(EVAL_STAKEGUARD, value, dest, ccAddress);
|
||||
|
||||
std::vector<CPubKey> vPubKeys = std::vector<CPubKey>();
|
||||
vPubKeys.push_back(dest);
|
||||
vPubKeys.push_back(ccAddress);
|
||||
|
||||
std::vector<std::vector<unsigned char>> vData = std::vector<std::vector<unsigned char>>();
|
||||
|
||||
CVerusHashWriter hw = CVerusHashWriter(SER_GETHASH, PROTOCOL_VERSION);
|
||||
|
||||
hw << stakeTx.vin[0].prevout.hash;
|
||||
hw << stakeTx.vin[0].prevout.n;
|
||||
|
||||
uint256 utxo = hw.GetHash();
|
||||
vData.push_back(std::vector<unsigned char>(utxo.begin(), utxo.end())); // Can we use any data here to construct vector?
|
||||
|
||||
CStakeParams p;
|
||||
if (GetStakeParams(stakeTx, p))
|
||||
{
|
||||
// prev block hash and height is here to make validation easy
|
||||
vData.push_back(std::vector<unsigned char>(p.prevHash.begin(), p.prevHash.end()));
|
||||
std::vector<unsigned char> height = std::vector<unsigned char>(4);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
height[i] = (p.blkHeight >> (8 * i)) & 0xff;
|
||||
}
|
||||
vData.push_back(height);
|
||||
|
||||
COptCCParams ccp = COptCCParams(COptCCParams::VERSION, EVAL_STAKEGUARD, 1, 2, vPubKeys, vData);
|
||||
|
||||
vout.scriptPubKey << ccp.AsVector() << OP_DROP;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ValidateMatchingStake(const CTransaction &ccTx, uint32_t voutNum, const CTransaction &stakeTx, bool &cheating)
|
||||
{
|
||||
// an invalid or non-matching stake transaction cannot cheat
|
||||
cheating = false;
|
||||
|
||||
//printf("ValidateMatchingStake: ccTx.vin[0].prevout.hash: %s, ccTx.vin[0].prevout.n: %d\n", ccTx.vin[0].prevout.hash.GetHex().c_str(), ccTx.vin[0].prevout.n);
|
||||
|
||||
if (ccTx.IsCoinBase())
|
||||
{
|
||||
CStakeParams p;
|
||||
if (ValidateStakeTransaction(stakeTx, p))
|
||||
{
|
||||
std::vector<std::vector<unsigned char>> vParams = std::vector<std::vector<unsigned char>>();
|
||||
CScript dummy;
|
||||
|
||||
if (ccTx.vout[voutNum].scriptPubKey.IsPayToCryptoCondition(&dummy, vParams) && vParams.size() > 0)
|
||||
{
|
||||
COptCCParams ccp = COptCCParams(vParams[0]);
|
||||
if (ccp.IsValid() & ccp.vData.size() >= 3 && ccp.vData[2].size() <= 4)
|
||||
{
|
||||
CVerusHashWriter hw = CVerusHashWriter(SER_GETHASH, PROTOCOL_VERSION);
|
||||
|
||||
hw << stakeTx.vin[0].prevout.hash;
|
||||
hw << stakeTx.vin[0].prevout.n;
|
||||
uint256 utxo = hw.GetHash();
|
||||
|
||||
uint32_t height = 0;
|
||||
int i, dataLen = ccp.vData[2].size();
|
||||
for (i = dataLen - 1; i >= 0; i--)
|
||||
{
|
||||
height = (height << 8) + ccp.vData[2][i];
|
||||
}
|
||||
// for debugging strange issue
|
||||
// printf("iterator: %d, height: %d, datalen: %d\n", i, height, dataLen);
|
||||
|
||||
if (utxo == uint256(ccp.vData[0]))
|
||||
{
|
||||
if (p.prevHash != uint256(ccp.vData[1]) && p.blkHeight >= height)
|
||||
{
|
||||
cheating = true;
|
||||
return true;
|
||||
}
|
||||
// if block height is equal and we are at the else, prevHash must have been equal
|
||||
else if (p.blkHeight == height)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
## CCLIB
|
||||
Please follow the below instructions to build the cryptoconditions library into the Komodo source directory `komodo/src` - supported operating systems are Linux, OSX and Windows (mingw crossbuild):
|
||||
|
||||
Please follow the below instructions to build the cryptoconditions library
|
||||
|
||||
```
|
||||
make clean
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -150,7 +153,7 @@ int64_t AddAuctionInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPu
|
||||
|
||||
std::string AuctionBid(uint64_t txfee,uint256 itemhash,int64_t amount)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk,Auctionpk; CScript opret; int64_t inputs,CCchange=0,nValue=COIN; struct CCcontract_info *cp,C;
|
||||
cp = CCinit(&C,EVAL_AUCTION);
|
||||
if ( txfee == 0 )
|
||||
@@ -171,7 +174,7 @@ std::string AuctionBid(uint64_t txfee,uint256 itemhash,int64_t amount)
|
||||
|
||||
std::string AuctionDeliver(uint64_t txfee,uint256 itemhash,uint256 bidtxid)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk,Auctionpk; CScript opret; int64_t inputs,CCchange=0,nValue=COIN; struct CCcontract_info *cp,C;
|
||||
cp = CCinit(&C,EVAL_AUCTION);
|
||||
if ( txfee == 0 )
|
||||
@@ -192,7 +195,7 @@ std::string AuctionDeliver(uint64_t txfee,uint256 itemhash,uint256 bidtxid)
|
||||
|
||||
std::string AuctionPost(uint64_t txfee,uint256 itemhash,int64_t minbid,char *title,char *description)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk,Auctionpk; int64_t funds = 0; CScript opret; struct CCcontract_info *cp,C;
|
||||
cp = CCinit(&C,EVAL_AUCTION);
|
||||
if ( txfee == 0 )
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -25,7 +28,7 @@
|
||||
#include "cc/utils.h"
|
||||
#include "primitives/transaction.h"
|
||||
|
||||
int32_t komodo_nextheight();
|
||||
int32_t hush_nextheight();
|
||||
|
||||
std::vector<CC*> BetProtocol::PlayerConditions()
|
||||
{
|
||||
@@ -54,7 +57,7 @@ CC* BetProtocol::MakeDisputeCond()
|
||||
*/
|
||||
CMutableTransaction BetProtocol::MakeSessionTx(CAmount spendFee)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
|
||||
CC *disputeCond = MakeDisputeCond();
|
||||
mtx.vout.push_back(CTxOut(spendFee, CCPubKey(disputeCond)));
|
||||
@@ -71,7 +74,7 @@ CMutableTransaction BetProtocol::MakeSessionTx(CAmount spendFee)
|
||||
|
||||
CMutableTransaction BetProtocol::MakeDisputeTx(uint256 signedSessionTxHash, uint256 vmResultHash)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
|
||||
CC *disputeCond = MakeDisputeCond();
|
||||
mtx.vin.push_back(CTxIn(signedSessionTxHash, 0, CScript()));
|
||||
@@ -85,7 +88,7 @@ CMutableTransaction BetProtocol::MakeDisputeTx(uint256 signedSessionTxHash, uint
|
||||
CMutableTransaction BetProtocol::MakePostEvidenceTx(uint256 signedSessionTxHash,
|
||||
int playerIdx, std::vector<unsigned char> state)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
|
||||
mtx.vin.push_back(CTxIn(signedSessionTxHash, playerIdx+1, CScript()));
|
||||
mtx.vout.push_back(CTxOut(0, CScript() << OP_RETURN << state));
|
||||
@@ -116,7 +119,7 @@ CC* BetProtocol::MakePayoutCond(uint256 signedSessionTxHash)
|
||||
|
||||
CMutableTransaction BetProtocol::MakeStakeTx(CAmount totalPayout, uint256 signedSessionTxHash)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
|
||||
CC *payoutCond = MakePayoutCond(signedSessionTxHash);
|
||||
mtx.vout.push_back(CTxOut(totalPayout, CCPubKey(payoutCond)));
|
||||
@@ -129,7 +132,7 @@ CMutableTransaction BetProtocol::MakeStakeTx(CAmount totalPayout, uint256 signed
|
||||
CMutableTransaction BetProtocol::MakeAgreePayoutTx(std::vector<CTxOut> payouts,
|
||||
uint256 signedStakeTxHash)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
mtx.vin.push_back(CTxIn(signedStakeTxHash, 0, CScript()));
|
||||
mtx.vout = payouts;
|
||||
return mtx;
|
||||
@@ -139,7 +142,7 @@ CMutableTransaction BetProtocol::MakeAgreePayoutTx(std::vector<CTxOut> payouts,
|
||||
CMutableTransaction BetProtocol::MakeImportPayoutTx(std::vector<CTxOut> payouts,
|
||||
CTransaction signedDisputeTx, uint256 signedStakeTxHash, MoMProof momProof)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
mtx.vin.push_back(CTxIn(signedStakeTxHash, 0, CScript()));
|
||||
mtx.vout = payouts;
|
||||
CScript proofData;
|
||||
@@ -215,8 +218,8 @@ bool Eval::ImportPayout(const std::vector<uint8_t> params, const CTransaction &i
|
||||
|
||||
// Check disputeTx solves momproof from vout[0]
|
||||
{
|
||||
NotarisationData data(0);
|
||||
if (!GetNotarisationData(proof.notarisationHash, data))
|
||||
NotarizationData data(0);
|
||||
if (!GetNotarizationData(proof.notarisationHash, data))
|
||||
return Invalid("coudnt-load-mom");
|
||||
|
||||
if (data.MoM != proof.branch.Exec(disputeTx.GetHash()))
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright © 2019-2020 The Hush Developers
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -13,10 +15,8 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include <assert.h>
|
||||
#include <cryptoconditions.h>
|
||||
|
||||
#include "primitives/block.h"
|
||||
#include "primitives/transaction.h"
|
||||
#include "script/cc.h"
|
||||
@@ -27,15 +27,12 @@
|
||||
#include "chain.h"
|
||||
#include "core_io.h"
|
||||
#include "crosschain.h"
|
||||
|
||||
#define FAUCET2SIZE COIN
|
||||
#define EVAL_FAUCET2 EVAL_FIRSTUSER
|
||||
|
||||
#ifdef BUILD_ROGUE
|
||||
#define EVAL_ROGUE 17
|
||||
std::string MYCCLIBNAME = (char *)"rogue";
|
||||
|
||||
|
||||
#elif BUILD_CUSTOMCC
|
||||
#include "customcc.h"
|
||||
|
||||
@@ -446,13 +443,12 @@ bool CClib_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const C
|
||||
else return eval->Invalid("invalid evalcode");
|
||||
#endif
|
||||
}
|
||||
numvins = tx.vin.size();
|
||||
numvouts = tx.vout.size();
|
||||
numvins = tx.vin.size();
|
||||
numvouts = tx.vout.size();
|
||||
preventCCvins = preventCCvouts = -1;
|
||||
if ( numvouts < 1 )
|
||||
if ( numvouts < 1 ) {
|
||||
return eval->Invalid("no vouts");
|
||||
else
|
||||
{
|
||||
} else {
|
||||
for (i=0; i<numvins; i++)
|
||||
{
|
||||
if ( IsCCInput(tx.vin[0].scriptSig) == 0 )
|
||||
@@ -462,13 +458,10 @@ bool CClib_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const C
|
||||
}
|
||||
}
|
||||
//fprintf(stderr,"check amounts\n");
|
||||
if ( CClibExactAmounts(cp,eval,tx,1,10000) == false )
|
||||
{
|
||||
if ( CClibExactAmounts(cp,eval,tx,1,10000) == false ) {
|
||||
fprintf(stderr,"faucetget invalid amount\n");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
preventCCvouts = 1;
|
||||
if ( IsCClibvout(cp,tx,0,cp->unspendableCCaddr) != 0 )
|
||||
{
|
||||
@@ -565,7 +558,7 @@ int64_t AddCClibtxfee(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKe
|
||||
|
||||
std::string Faucet2Fund(struct CCcontract_info *cp,uint64_t txfee,int64_t funds)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk,cclibpk; CScript opret;
|
||||
if ( txfee == 0 )
|
||||
txfee = 10000;
|
||||
@@ -581,7 +574,7 @@ std::string Faucet2Fund(struct CCcontract_info *cp,uint64_t txfee,int64_t funds)
|
||||
|
||||
std::string CClib_rawtxgen(struct CCcontract_info *cp,uint8_t funcid,cJSON *params)
|
||||
{
|
||||
CMutableTransaction tmpmtx,mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction tmpmtx,mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk,cclibpk; int64_t funds,txfee=0,inputs,CCchange=0,nValue=FAUCET2SIZE; std::string rawhex; uint32_t j; int32_t i,len; uint8_t buf[32768]; bits256 hash;
|
||||
if ( txfee == 0 )
|
||||
txfee = 10000;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -463,7 +466,7 @@ int64_t AddChannelsInputs(struct CCcontract_info *cp,CMutableTransaction &mtx, C
|
||||
|
||||
UniValue ChannelOpen(const CPubKey& pk, uint64_t txfee,CPubKey destpub,int32_t numpayments,int64_t payment, uint256 tokenid)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
uint8_t hash[32],hashdest[32]; uint64_t amount,tokens=0,funds; int32_t i; uint256 hashchain,entropy,hentropy;
|
||||
CPubKey mypk; struct CCcontract_info *cp,*cpTokens,C,CTokens;
|
||||
|
||||
@@ -509,7 +512,7 @@ UniValue ChannelOpen(const CPubKey& pk, uint64_t txfee,CPubKey destpub,int32_t n
|
||||
|
||||
UniValue ChannelPayment(const CPubKey& pk, uint64_t txfee,uint256 opentxid,int64_t amount, uint256 secret)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk,srcpub,destpub; uint256 txid,hashchain,gensecret,hashblock,entropy,hentropy,prevtxid,param3,tokenid;
|
||||
struct CCcontract_info *cp,C; int32_t i,funcid,prevdepth,numvouts,numpayments,totalnumpayments;
|
||||
int64_t payment,change,funds,param2;
|
||||
@@ -593,7 +596,7 @@ UniValue ChannelPayment(const CPubKey& pk, uint64_t txfee,uint256 opentxid,int64
|
||||
|
||||
UniValue ChannelClose(const CPubKey& pk, uint64_t txfee,uint256 opentxid)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk,srcpub,destpub; struct CCcontract_info *cp,C;
|
||||
CTransaction channelOpenTx;
|
||||
uint256 hashblock,tmp_txid,prevtxid,hashchain,tokenid;
|
||||
@@ -631,7 +634,7 @@ UniValue ChannelClose(const CPubKey& pk, uint64_t txfee,uint256 opentxid)
|
||||
|
||||
UniValue ChannelRefund(const CPubKey& pk, uint64_t txfee,uint256 opentxid,uint256 closetxid)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk; struct CCcontract_info *cp,C; int64_t funds,payment,param2;
|
||||
int32_t i,numpayments,numvouts,param1;
|
||||
uint256 hashchain,hashblock,txid,prevtxid,param3,tokenid;
|
||||
|
||||
1
src/cc/crypto777/OS_portable.h
Executable file → Normal file
1
src/cc/crypto777/OS_portable.h
Executable file → Normal file
@@ -1,3 +1,4 @@
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
// Copyright (c) 2016-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
|
||||
/*
|
||||
simple stub custom cc
|
||||
|
||||
Just update the functions in this file, then from ~/komodo/src/cc
|
||||
Just update the functions in this file, then from ~/hush3/src/cc
|
||||
|
||||
../komodo-cli -ac_name=CUSTOM stop
|
||||
../hush-cli -ac_name=CUSTOM stop
|
||||
./makecustom
|
||||
../komodod -ac_name=CUSTOM -ac_cclib=custom -ac_cc=2 ...
|
||||
../hush-smart-chain -ac_name=CUSTOM -ac_cclib=custom -ac_cc=2 ...
|
||||
|
||||
The above will rebuild komodod and get it running again
|
||||
*/
|
||||
@@ -57,7 +60,7 @@ UniValue custom_func0(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
|
||||
UniValue custom_func1(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()); std::string rawtx;
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight()); std::string rawtx;
|
||||
UniValue result(UniValue::VOBJ); CPubKey mypk; int64_t amount = COIN; int32_t broadcastflag=0;
|
||||
if ( txfee == 0 )
|
||||
txfee = CUSTOM_TXFEE;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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
|
||||
/*
|
||||
to create a custom libcc.so:
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Copyright 2020 The Hush Developers
|
||||
# Just type make to compile all dat dapp code, fellow cypherpunk
|
||||
# Copyright 2016-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
|
||||
# Just type make to compile all dat dapp code, fellow cypherpunkz
|
||||
|
||||
# we no longer build zmigrate by default, nobody uses that fucking code
|
||||
all: hushdex
|
||||
@@ -9,6 +11,7 @@ hushdex:
|
||||
|
||||
# Just for historical knowledge, to study how fucking stupid
|
||||
# ZEC+KMD were to still support sprout, to this day!!!!!!!!
|
||||
# Hush leads the entire world into the future, sans Sprout turdz
|
||||
zmigrate:
|
||||
$(CC) zmigrate.c -o zmigrate -lm
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
|
||||
// Copyright (c) 2016-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 (c) 2009 Dave Gamble
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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-2020 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -12,7 +15,6 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@@ -330,20 +332,17 @@ int md_unlink(char *file)
|
||||
|
||||
char *REFCOIN_CLI,DPOW_pubkeystr[67],DPOW_secpkeystr[67],DPOW_handle[67],DPOW_recvaddr[64],DPOW_recvZaddr[128];
|
||||
|
||||
cJSON *get_komodocli(char *refcoin,char **retstrp,char *acname,char *method,char *arg0,char *arg1,char *arg2,char *arg3,char *arg4,char *arg5,char *arg6)
|
||||
cJSON *get_hushcli(char *refcoin,char **retstrp,char *acname,char *method,char *arg0,char *arg1,char *arg2,char *arg3,char *arg4,char *arg5,char *arg6)
|
||||
{
|
||||
long fsize; cJSON *retjson = 0; char cmdstr[32768],*jsonstr,fname[32768];
|
||||
sprintf(fname,"/tmp/notarizer_%s_%d",method,(rand() >> 17) % 10000);
|
||||
//if ( (acname == 0 || acname[0] == 0) && strcmp(refcoin,"KMD") != 0 )
|
||||
// acname = refcoin;
|
||||
if ( acname[0] != 0 )
|
||||
{
|
||||
if ( refcoin[0] != 0 && strcmp(refcoin,"KMD") != 0 && strcmp(refcoin,acname) != 0 )
|
||||
if ( acname[0] != 0 ) {
|
||||
if ( refcoin[0] != 0 && strcmp(refcoin,"HUSH3") != 0 && strcmp(refcoin,acname) != 0 )
|
||||
printf("unexpected: refcoin.(%s) acname.(%s)\n",refcoin,acname);
|
||||
sprintf(cmdstr,"komodo-cli -ac_name=%s %s %s %s %s %s %s %s %s > %s\n",acname,method,arg0,arg1,arg2,arg3,arg4,arg5,arg6,fname);
|
||||
sprintf(cmdstr,"hush-smart-chain -ac_name=%s %s %s %s %s %s %s %s %s > %s\n",acname,method,arg0,arg1,arg2,arg3,arg4,arg5,arg6,fname);
|
||||
}
|
||||
else if ( strcmp(refcoin,"KMD") == 0 )
|
||||
sprintf(cmdstr,"komodo-cli %s %s %s %s %s %s %s %s > %s\n",method,arg0,arg1,arg2,arg3,arg4,arg5,arg6,fname);
|
||||
else if ( strcmp(refcoin,"HUSH3") == 0 )
|
||||
sprintf(cmdstr,"hush-cli %s %s %s %s %s %s %s %s > %s\n",method,arg0,arg1,arg2,arg3,arg4,arg5,arg6,fname);
|
||||
else if ( REFCOIN_CLI != 0 && REFCOIN_CLI[0] != 0 )
|
||||
{
|
||||
sprintf(cmdstr,"%s %s %s %s %s %s %s %s %s > %s\n",REFCOIN_CLI,method,arg0,arg1,arg2,arg3,arg4,arg5,arg6,fname);
|
||||
@@ -391,7 +390,7 @@ bits256 komodobroadcast(char *refcoin,char *acname,cJSON *hexjson)
|
||||
memset(txid.bytes,0,sizeof(txid));
|
||||
if ( (hexstr= jstr(hexjson,"hex")) != 0 )
|
||||
{
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"sendrawtransaction",hexstr,"","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"sendrawtransaction",hexstr,"","","","","","")) != 0 )
|
||||
{
|
||||
//fprintf(stderr,"broadcast.(%s)\n",jprint(retjson,0));
|
||||
free_json(retjson);
|
||||
@@ -415,7 +414,7 @@ bits256 sendtoaddress(char *refcoin,char *acname,char *destaddr,int64_t satoshis
|
||||
char numstr[32],*retstr,str[65]; cJSON *retjson; bits256 txid;
|
||||
memset(txid.bytes,0,sizeof(txid));
|
||||
sprintf(numstr,"%.8f",(double)satoshis/SATOSHIDEN);
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"sendtoaddress",destaddr,numstr,"false","","",oprethexstr,"")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"sendtoaddress",destaddr,numstr,"false","","",oprethexstr,"")) != 0 )
|
||||
{
|
||||
fprintf(stderr,"unexpected sendrawtransaction json.(%s)\n",jprint(retjson,0));
|
||||
free_json(retjson);
|
||||
@@ -438,7 +437,7 @@ bits256 tokentransfer(char *refcoin,char *acname,char *tokenid,char *destpub,int
|
||||
char numstr[32],*retstr,str[65]; cJSON *retjson; bits256 txid;
|
||||
memset(txid.bytes,0,sizeof(txid));
|
||||
sprintf(numstr,"%llu",(long long)units);
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"tokentransfer",tokenid,destpub,numstr,"","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"tokentransfer",tokenid,destpub,numstr,"","","","")) != 0 )
|
||||
{
|
||||
txid = komodobroadcast(refcoin,acname,retjson);
|
||||
fprintf(stderr,"tokentransfer returned (%s)\n",jprint(retjson,0));
|
||||
@@ -456,7 +455,7 @@ char *get_tokenaddress(char *refcoin,char *acname,char *tokenaddr)
|
||||
{
|
||||
char *retstr,*str; cJSON *retjson;
|
||||
tokenaddr[0] = 0;
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"tokenaddress","","","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"tokenaddress","","","","","","","")) != 0 )
|
||||
{
|
||||
if ( (str= jstr(retjson,"myCCAddress(Tokens)")) != 0 )
|
||||
{
|
||||
@@ -478,7 +477,7 @@ char *get_tokenaddress(char *refcoin,char *acname,char *tokenaddr)
|
||||
int64_t get_tokenbalance(char *refcoin,char *acname,char *tokenid)
|
||||
{
|
||||
cJSON *retjson; char *retstr,cmpstr[64]; int64_t amount=0;
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"tokenbalance",tokenid,"","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"tokenbalance",tokenid,"","","","","","")) != 0 )
|
||||
{
|
||||
amount = j64bits(retjson,"balance");
|
||||
fprintf(stderr,"tokenbalance %llu\n",(long long)amount);
|
||||
@@ -495,7 +494,7 @@ int64_t get_tokenbalance(char *refcoin,char *acname,char *tokenid)
|
||||
cJSON *get_decodescript(char *refcoin,char *acname,char *script)
|
||||
{
|
||||
cJSON *retjson; char *retstr;
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"decodescript",script,"","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"decodescript",script,"","","","","","")) != 0 )
|
||||
{
|
||||
return(retjson);
|
||||
}
|
||||
@@ -514,7 +513,7 @@ char *get_createmultisig2(char *refcoin,char *acname,char *msigaddr,char *redeem
|
||||
msigaddr[0] = 0;
|
||||
redeemscript[0] = 0;
|
||||
sprintf(params,"'[\"%s\", \"%s\"]'",pubkeyA,pubkeyB);
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"createmultisig","2",params,"","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"createmultisig","2",params,"","","","","")) != 0 )
|
||||
{
|
||||
if ( (str= jstr(retjson,"address")) != 0 )
|
||||
strcpy(msigaddr,str);
|
||||
@@ -536,7 +535,7 @@ char *get_createmultisig2(char *refcoin,char *acname,char *msigaddr,char *redeem
|
||||
int32_t get_coinheight(char *refcoin,char *acname,bits256 *blockhashp)
|
||||
{
|
||||
cJSON *retjson; char *retstr; int32_t height=0;
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"getblockchaininfo","","","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"getblockchaininfo","","","","","","","")) != 0 )
|
||||
{
|
||||
height = jint(retjson,"blocks");
|
||||
*blockhashp = jbits256(retjson,"bestblockhash");
|
||||
@@ -555,7 +554,7 @@ bits256 get_coinblockhash(char *refcoin,char *acname,int32_t height)
|
||||
cJSON *retjson; char *retstr,heightstr[32]; bits256 hash;
|
||||
memset(hash.bytes,0,sizeof(hash));
|
||||
sprintf(heightstr,"%d",height);
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"getblockhash",heightstr,"","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"getblockhash",heightstr,"","","","","","")) != 0 )
|
||||
{
|
||||
fprintf(stderr,"unexpected blockhash json.(%s)\n",jprint(retjson,0));
|
||||
free_json(retjson);
|
||||
@@ -577,7 +576,7 @@ bits256 get_coinmerkleroot(char *refcoin,char *acname,bits256 blockhash,uint32_t
|
||||
cJSON *retjson; char *retstr,str[65]; bits256 merkleroot;
|
||||
memset(merkleroot.bytes,0,sizeof(merkleroot));
|
||||
*blocktimep = 0;
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"getblockheader",bits256_str(str,blockhash),"","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"getblockheader",bits256_str(str,blockhash),"","","","","","")) != 0 )
|
||||
{
|
||||
merkleroot = jbits256(retjson,"merkleroot");
|
||||
*blocktimep = juint(retjson,"time");
|
||||
@@ -624,7 +623,7 @@ int32_t get_coinheader(char *refcoin,char *acname,bits256 *blockhashp,bits256 *m
|
||||
cJSON *get_rawmempool(char *refcoin,char *acname)
|
||||
{
|
||||
cJSON *retjson; char *retstr;
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"getrawmempool","","","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"getrawmempool","","","","","","","")) != 0 )
|
||||
{
|
||||
//printf("mempool.(%s)\n",jprint(retjson,0));
|
||||
return(retjson);
|
||||
@@ -643,7 +642,7 @@ cJSON *get_addressutxos(char *refcoin,char *acname,char *coinaddr)
|
||||
if ( refcoin[0] != 0 && strcmp(refcoin,"KMD") != 0 )
|
||||
printf("warning: assumes %s has addressindex enabled\n",refcoin);
|
||||
sprintf(jsonbuf,"{\\\"addresses\\\":[\\\"%s\\\"]}",coinaddr);
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"getaddressutxos",jsonbuf,"","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"getaddressutxos",jsonbuf,"","","","","","")) != 0 )
|
||||
{
|
||||
//printf("addressutxos.(%s)\n",jprint(retjson,0));
|
||||
return(retjson);
|
||||
@@ -659,7 +658,7 @@ cJSON *get_addressutxos(char *refcoin,char *acname,char *coinaddr)
|
||||
cJSON *get_rawtransaction(char *refcoin,char *acname,bits256 txid)
|
||||
{
|
||||
cJSON *retjson; char *retstr,str[65];
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"getrawtransaction",bits256_str(str,txid),"1","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"getrawtransaction",bits256_str(str,txid),"1","","","","","")) != 0 )
|
||||
{
|
||||
return(retjson);
|
||||
}
|
||||
@@ -674,7 +673,7 @@ cJSON *get_rawtransaction(char *refcoin,char *acname,bits256 txid)
|
||||
cJSON *get_z_viewtransaction(char *refcoin,char *acname,bits256 txid)
|
||||
{
|
||||
cJSON *retjson; char *retstr,str[65];
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"z_viewtransaction",bits256_str(str,txid),"","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"z_viewtransaction",bits256_str(str,txid),"","","","","","")) != 0 )
|
||||
{
|
||||
return(retjson);
|
||||
}
|
||||
@@ -689,7 +688,7 @@ cJSON *get_z_viewtransaction(char *refcoin,char *acname,bits256 txid)
|
||||
cJSON *get_listunspent(char *refcoin,char *acname)
|
||||
{
|
||||
cJSON *retjson; char *retstr,str[65];
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"listunspent","","","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"listunspent","","","","","","","")) != 0 )
|
||||
{
|
||||
return(retjson);
|
||||
}
|
||||
@@ -704,7 +703,7 @@ cJSON *get_listunspent(char *refcoin,char *acname)
|
||||
cJSON *get_getinfo(char *refcoin,char *acname)
|
||||
{
|
||||
cJSON *retjson; char *retstr,str[65];
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"getinfo","","","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"getinfo","","","","","","","")) != 0 )
|
||||
{
|
||||
return(retjson);
|
||||
}
|
||||
@@ -719,7 +718,7 @@ cJSON *get_getinfo(char *refcoin,char *acname)
|
||||
cJSON *z_listunspent(char *refcoin,char *acname)
|
||||
{
|
||||
cJSON *retjson; char *retstr,str[65];
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"z_listunspent","","","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"z_listunspent","","","","","","","")) != 0 )
|
||||
{
|
||||
return(retjson);
|
||||
}
|
||||
@@ -734,7 +733,7 @@ cJSON *z_listunspent(char *refcoin,char *acname)
|
||||
cJSON *z_listoperationids(char *refcoin,char *acname)
|
||||
{
|
||||
cJSON *retjson; char *retstr,str[65];
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"z_listoperationids","","","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"z_listoperationids","","","","","","","")) != 0 )
|
||||
{
|
||||
return(retjson);
|
||||
}
|
||||
@@ -750,7 +749,7 @@ cJSON *z_getoperationstatus(char *refcoin,char *acname,char *opid)
|
||||
{
|
||||
cJSON *retjson; char *retstr,str[65],params[512];
|
||||
sprintf(params,"'[\"%s\"]'",opid);
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"z_getoperationstatus",params,"","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"z_getoperationstatus",params,"","","","","","")) != 0 )
|
||||
{
|
||||
//printf("got status (%s)\n",jprint(retjson,0));
|
||||
return(retjson);
|
||||
@@ -767,7 +766,7 @@ cJSON *z_getoperationresult(char *refcoin,char *acname,char *opid)
|
||||
{
|
||||
cJSON *retjson; char *retstr,str[65],params[512];
|
||||
sprintf(params,"'[\"%s\"]'",opid);
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"z_getoperationresult",params,"","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"z_getoperationresult",params,"","","","","","")) != 0 )
|
||||
{
|
||||
return(retjson);
|
||||
}
|
||||
@@ -782,7 +781,7 @@ cJSON *z_getoperationresult(char *refcoin,char *acname,char *opid)
|
||||
int32_t validateaddress(char *refcoin,char *acname,char *depositaddr, char* compare)
|
||||
{
|
||||
cJSON *retjson; char *retstr; int32_t res=0;
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"validateaddress",depositaddr,"","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"validateaddress",depositaddr,"","","","","","")) != 0 )
|
||||
{
|
||||
if (is_cJSON_True(jobj(retjson,compare)) != 0 ) res=1;
|
||||
free_json(retjson);
|
||||
@@ -798,7 +797,7 @@ int32_t validateaddress(char *refcoin,char *acname,char *depositaddr, char* comp
|
||||
int32_t z_validateaddress(char *refcoin,char *acname,char *depositaddr, char *compare)
|
||||
{
|
||||
cJSON *retjson; char *retstr; int32_t res=0;
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"z_validateaddress",depositaddr,"","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"z_validateaddress",depositaddr,"","","","","","")) != 0 )
|
||||
{
|
||||
if (is_cJSON_True(jobj(retjson,compare)) != 0 )
|
||||
res=1;
|
||||
@@ -815,7 +814,7 @@ int32_t z_validateaddress(char *refcoin,char *acname,char *depositaddr, char *co
|
||||
int64_t get_getbalance(char *refcoin,char *acname)
|
||||
{
|
||||
cJSON *retjson; char *retstr,cmpstr[64]; int64_t amount=0;
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"getbalance","","","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"getbalance","","","","","","","")) != 0 )
|
||||
{
|
||||
fprintf(stderr,"get_getbalance.(%s) %s returned json!\n",refcoin,acname);
|
||||
free_json(retjson);
|
||||
@@ -835,7 +834,7 @@ int64_t get_getbalance(char *refcoin,char *acname)
|
||||
int64_t z_getbalance(char *refcoin,char *acname,char *coinaddr)
|
||||
{
|
||||
cJSON *retjson; char *retstr,cmpstr[64]; int64_t amount=0;
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"z_getbalance",coinaddr,"","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"z_getbalance",coinaddr,"","","","","","")) != 0 )
|
||||
{
|
||||
fprintf(stderr,"z_getbalance.(%s) %s returned json!\n",refcoin,acname);
|
||||
free_json(retjson);
|
||||
@@ -856,7 +855,7 @@ int32_t z_exportkey(char *privkey,char *refcoin,char *acname,char *zaddr)
|
||||
{
|
||||
cJSON *retjson; char *retstr,cmpstr[64]; int64_t amount=0;
|
||||
privkey[0] = 0;
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"z_exportkey",zaddr,"","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"z_exportkey",zaddr,"","","","","","")) != 0 )
|
||||
{
|
||||
fprintf(stderr,"z_exportkey.(%s) %s returned json!\n",refcoin,acname);
|
||||
free_json(retjson);
|
||||
@@ -875,7 +874,7 @@ int32_t z_exportkey(char *privkey,char *refcoin,char *acname,char *zaddr)
|
||||
int32_t getnewaddress(char *coinaddr,char *refcoin,char *acname)
|
||||
{
|
||||
cJSON *retjson; char *retstr; int64_t amount=0; int32_t retval = -1;
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"getnewaddress","","","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"getnewaddress","","","","","","","")) != 0 )
|
||||
{
|
||||
fprintf(stderr,"getnewaddress.(%s) %s returned json!\n",refcoin,acname);
|
||||
free_json(retjson);
|
||||
@@ -892,7 +891,7 @@ int32_t getnewaddress(char *coinaddr,char *refcoin,char *acname)
|
||||
int32_t z_getnewaddress(char *coinaddr,char *refcoin,char *acname,char *typestr)
|
||||
{
|
||||
cJSON *retjson; char *retstr; int64_t amount=0; int32_t retval = -1;
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"z_getnewaddress",typestr,"","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"z_getnewaddress",typestr,"","","","","","")) != 0 )
|
||||
{
|
||||
fprintf(stderr,"z_getnewaddress.(%s) %s returned json!\n",refcoin,acname);
|
||||
free_json(retjson);
|
||||
@@ -964,7 +963,7 @@ int64_t find_sprout_amount(char *coinstr,char *zcaddr)
|
||||
void importaddress(char *refcoin,char *acname,char *depositaddr)
|
||||
{
|
||||
cJSON *retjson; char *retstr;
|
||||
if ( (retjson= get_komodocli(refcoin,&retstr,acname,"importaddress",depositaddr,"","true","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(refcoin,&retstr,acname,"importaddress",depositaddr,"","true","","","","")) != 0 )
|
||||
{
|
||||
printf("importaddress.(%s)\n",jprint(retjson,0));
|
||||
free_json(retjson);
|
||||
@@ -982,7 +981,7 @@ int32_t z_sendmany(char *opidstr,char *coinstr,char *acname,char *srcaddr,char *
|
||||
sprintf(params,"'[{\"address\":\"%s\",\"amount\":%.8f,\"memo\":\"%s\"}]'",destaddr,dstr(amount),memostr);
|
||||
sprintf(addr,"\"%s\"",srcaddr);
|
||||
printf("z_sendmany.(%s %s) from.(%s) -> %s\n",coinstr,acname,srcaddr,params);
|
||||
if ( (retjson= get_komodocli(coinstr,&retstr,acname,"z_sendmany",addr,params,"","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(coinstr,&retstr,acname,"z_sendmany",addr,params,"","","","","")) != 0 )
|
||||
{
|
||||
printf("unexpected json z_sendmany.(%s)\n",jprint(retjson,0));
|
||||
free_json(retjson);
|
||||
@@ -1001,7 +1000,7 @@ int32_t z_mergetoaddress(char *opidstr,char *coinstr,char *acname,char *destaddr
|
||||
{
|
||||
cJSON *retjson; char *retstr,addr[128],*opstr; int32_t retval = -1;
|
||||
sprintf(addr,"[\\\"ANY_SPROUT\\\"]");
|
||||
if ( (retjson= get_komodocli(coinstr,&retstr,acname,"z_mergetoaddress",addr,destaddr,"","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli(coinstr,&retstr,acname,"z_mergetoaddress",addr,destaddr,"","","","","")) != 0 )
|
||||
{
|
||||
if ( (opstr= jstr(retjson,"opid")) != 0 )
|
||||
strcpy(opidstr,opstr);
|
||||
@@ -1207,7 +1206,7 @@ int32_t txid_in_vins(char *refcoin,bits256 txid,bits256 cmptxid)
|
||||
int32_t dpow_pubkey()
|
||||
{
|
||||
char *pstr,*retstr,*str; cJSON *retjson; int32_t retval = -1;
|
||||
if ( (retjson= get_komodocli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_stats","","","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_stats","","","","","","","")) != 0 )
|
||||
{
|
||||
if ( (pstr= jstr(retjson,"publishable_pubkey")) != 0 && strlen(pstr) == 66 )
|
||||
{
|
||||
@@ -1235,7 +1234,7 @@ cJSON *dpow_get(uint32_t shorthash)
|
||||
{
|
||||
cJSON *retjson; char *retstr,numstr[32];
|
||||
sprintf(numstr,"%u",shorthash);
|
||||
if ( (retjson= get_komodocli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_get",numstr,"","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_get",numstr,"","","","","","")) != 0 )
|
||||
{
|
||||
//printf("DEX_get.(%s)\n",jprint(retjson,0));
|
||||
if ( juint(retjson,"cancelled") != 0 )
|
||||
@@ -1257,7 +1256,7 @@ cJSON *dpow_cancel(uint32_t shorthash)
|
||||
{
|
||||
cJSON *retjson; char *retstr,numstr[32];
|
||||
sprintf(numstr,"%u",shorthash);
|
||||
if ( (retjson= get_komodocli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_cancel",numstr,"","","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_cancel",numstr,"","","","","","")) != 0 )
|
||||
{
|
||||
//printf("DEX_cancel.(%s)\n",jprint(retjson,0));
|
||||
return(retjson);
|
||||
@@ -1274,7 +1273,7 @@ cJSON *dpow_notarize(char *coin,int32_t height)
|
||||
{
|
||||
cJSON *retjson; char *retstr,numstr[32];
|
||||
sprintf(numstr,"%u",height);
|
||||
if ( (retjson= get_komodocli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_notarize",coin,numstr,"","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_notarize",coin,numstr,"","","","","")) != 0 )
|
||||
{
|
||||
//printf("DEX_notarize.(%s)\n",jprint(retjson,0));
|
||||
return(retjson);
|
||||
@@ -1292,7 +1291,7 @@ cJSON *dpow_broadcast(int32_t priority,char *hexstr,char *tagA,char *tagB,char *
|
||||
cJSON *retjson; char *retstr,numstr[32];
|
||||
sprintf(numstr,"%u",priority);
|
||||
//fprintf(stderr,"broadcast (%s) (%s) (%s) (%s) (%s) [%s %s]\n",hexstr,numstr,tagA,tagB,pubkey,volA,volB);
|
||||
if ( (retjson= get_komodocli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_broadcast",hexstr,numstr,tagA,tagB,pubkey,volA,volB)) != 0 )
|
||||
if ( (retjson= get_hushcli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_broadcast",hexstr,numstr,tagA,tagB,pubkey,volA,volB)) != 0 )
|
||||
{
|
||||
//fprintf(stderr,"DEX_broadcast.(%s)\n",jprint(retjson,0));
|
||||
return(retjson);
|
||||
@@ -1310,7 +1309,7 @@ cJSON *dpow_publish(int32_t priority,char *filename)
|
||||
cJSON *retjson; char *retstr,numstr[32];
|
||||
sprintf(numstr,"%u",priority);
|
||||
//fprintf(stderr,"broadcast (%s) (%s) (%s) (%s) (%s) [%s %s]\n",hexstr,numstr,tagA,tagB,pubkey,volA,volB);
|
||||
if ( (retjson= get_komodocli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_publish",filename,numstr,"0","","","","")) != 0 )
|
||||
if ( (retjson= get_hushcli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_publish",filename,numstr,"0","","","","")) != 0 )
|
||||
{
|
||||
//fprintf(stderr,"DEX_broadcast.(%s)\n",jprint(retjson,0));
|
||||
return(retjson);
|
||||
@@ -1328,7 +1327,7 @@ cJSON *dpow_subscribe(int32_t priority,char *filename,char *publisher)
|
||||
cJSON *retjson; char *retstr,numstr[32];
|
||||
sprintf(numstr,"%u",priority);
|
||||
//fprintf(stderr,"broadcast (%s) (%s) (%s) (%s) (%s) [%s %s]\n",hexstr,numstr,tagA,tagB,pubkey,volA,volB);
|
||||
if ( (retjson= get_komodocli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_subscribe",filename,numstr,"0",publisher,"","","")) != 0 )
|
||||
if ( (retjson= get_hushcli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_subscribe",filename,numstr,"0",publisher,"","","")) != 0 )
|
||||
{
|
||||
//fprintf(stderr,"DEX_broadcast.(%s)\n",jprint(retjson,0));
|
||||
return(retjson);
|
||||
@@ -1355,7 +1354,7 @@ bits256 dpow_ntzhash(char *coin,int32_t *prevntzheightp,uint32_t *prevntztimep)
|
||||
memset(&ntzhash,0,sizeof(ntzhash));
|
||||
*prevntzheightp = 0;
|
||||
*prevntztimep = 0;
|
||||
if ( (retjson= get_komodocli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_list","0","0",coin,"notarizations",DPOW_pubkeystr,"","")) != 0 )
|
||||
if ( (retjson= get_hushcli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_list","0","0",coin,"notarizations",DPOW_pubkeystr,"","")) != 0 )
|
||||
{
|
||||
if ( (array= jarray(&n,retjson,"matches")) != 0 )
|
||||
{
|
||||
@@ -1378,7 +1377,7 @@ bits256 dpow_ntzhash(char *coin,int32_t *prevntzheightp,uint32_t *prevntztimep)
|
||||
int32_t dpow_getmessage(char *payload,int32_t maxsize,char *tagA,char *tagB,char *pubkeystr)
|
||||
{
|
||||
cJSON *retjson,*item,*array; char *retstr,*pstr; int32_t i,n,retval = 0;
|
||||
if ( (retjson= get_komodocli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_list","0","0",tagA,tagB,pubkeystr,"","")) != 0 )
|
||||
if ( (retjson= get_hushcli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_list","0","0",tagA,tagB,pubkeystr,"","")) != 0 )
|
||||
{
|
||||
if ( (array= jarray(&n,retjson,"matches")) != 0 )
|
||||
{
|
||||
@@ -1402,7 +1401,7 @@ int32_t dpow_getmessage(char *payload,int32_t maxsize,char *tagA,char *tagB,char
|
||||
int32_t dpow_hasmessage(char *payload,char *tagA,char *tagB,char *pubkeystr)
|
||||
{
|
||||
cJSON *retjson,*item,*array; char *retstr,*pstr; int32_t i,n,retval = 0;
|
||||
if ( (retjson= get_komodocli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_list","0","0",tagA,tagB,pubkeystr,"","")) != 0 )
|
||||
if ( (retjson= get_hushcli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_list","0","0",tagA,tagB,pubkeystr,"","")) != 0 )
|
||||
{
|
||||
if ( (array= jarray(&n,retjson,"matches")) != 0 )
|
||||
{
|
||||
@@ -1425,7 +1424,7 @@ int32_t dpow_hasmessage(char *payload,char *tagA,char *tagB,char *pubkeystr)
|
||||
int32_t dpow_pubkeyregister(int32_t priority)
|
||||
{
|
||||
cJSON *retjson,*array,*item; char *retstr,*pstr=0; int32_t i,n=0,len;
|
||||
if ( (retjson= get_komodocli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_list","0","0",(char *)"handles",DPOW_handle,DPOW_pubkeystr,"","")) != 0 )
|
||||
if ( (retjson= get_hushcli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_list","0","0",(char *)"handles",DPOW_handle,DPOW_pubkeystr,"","")) != 0 )
|
||||
{
|
||||
if ( (array= jarray(&n,retjson,"matches")) != 0 )
|
||||
{
|
||||
@@ -1449,7 +1448,7 @@ int32_t dpow_tokenregister(char *existing,int32_t priority,char *token_name,char
|
||||
{
|
||||
cJSON *retjson,*array,*item; char *retstr,*pstr=0; int32_t i,n=0,len;
|
||||
existing[0] = 0;
|
||||
if ( (retjson= get_komodocli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_list","0","0",(char *)"tokens",token_name,DPOW_pubkeystr,"","")) != 0 )
|
||||
if ( (retjson= get_hushcli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_list","0","0",(char *)"tokens",token_name,DPOW_pubkeystr,"","")) != 0 )
|
||||
{
|
||||
if ( (array= jarray(&n,retjson,"matches")) != 0 )
|
||||
{
|
||||
@@ -1475,7 +1474,7 @@ int32_t dpow_tokenregister(char *existing,int32_t priority,char *token_name,char
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*bits256 komodo_DEX_filehash(FILE *fp,uint64_t offset0,uint64_t rlen,char *fname)
|
||||
/*bits256 hush_DEX_filehash(FILE *fp,uint64_t offset0,uint64_t rlen,char *fname)
|
||||
{
|
||||
bits256 filehash; uint8_t *data = (uint8_t *)calloc(1,rlen);
|
||||
fseek(fp,offset0,SEEK_SET);
|
||||
@@ -1501,7 +1500,7 @@ int32_t dpow_fileregister(char *existing,int32_t priority,char *fname,char *coin
|
||||
fclose(fp);
|
||||
} else return(-1);
|
||||
sprintf(tagA,"'#%s'",fname);
|
||||
if ( (retjson= get_komodocli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_list","0","0",tagA,coin,DPOW_pubkeystr,"","")) != 0 )
|
||||
if ( (retjson= get_hushcli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_list","0","0",tagA,coin,DPOW_pubkeystr,"","")) != 0 )
|
||||
{
|
||||
if ( (array= jarray(&n,retjson,"matches")) != 0 )
|
||||
{
|
||||
@@ -1536,7 +1535,7 @@ bits256 dpow_blockhash(char *coin,int32_t height)
|
||||
cJSON *retjson,*array,*item; char *retstr,*pstr=0,numstr[32]; int32_t i,n=0,len; bits256 hash;
|
||||
memset(hash.bytes,0,sizeof(hash));
|
||||
sprintf(numstr,"%d",height);
|
||||
if ( (retjson= get_komodocli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_list","0","0",coin,numstr,DPOW_pubkeystr,"","")) != 0 )
|
||||
if ( (retjson= get_hushcli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_list","0","0",coin,numstr,DPOW_pubkeystr,"","")) != 0 )
|
||||
{
|
||||
if ( (array= jarray(&n,retjson,"matches")) != 0 )
|
||||
{
|
||||
@@ -1564,7 +1563,7 @@ struct inboxinfo **dpow_inboxcheck(int32_t *nump,uint32_t *stopatp,char *tagB)
|
||||
cJSON *retjson,*array,*item; struct inboxinfo **ptrs=0; char *senderpub,*retstr,*ptr,*pstr=0,stopstr[32]; int32_t i,j,n,m=0,len;
|
||||
sprintf(stopstr,"%u",*stopatp);
|
||||
*nump = 0;
|
||||
if ( (retjson= get_komodocli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_list",stopstr,"0",(char *)"inbox",tagB,DPOW_pubkeystr,"","")) != 0 )
|
||||
if ( (retjson= get_hushcli((char *)"",&retstr,DEXP2P_CHAIN,"DEX_list",stopstr,"0",(char *)"inbox",tagB,DPOW_pubkeystr,"","")) != 0 )
|
||||
{
|
||||
if ( (array= jarray(&n,retjson,"matches")) != 0 && n > 0 )
|
||||
{
|
||||
@@ -1596,5 +1595,3 @@ struct inboxinfo **dpow_inboxcheck(int32_t *nump,uint32_t *stopatp,char *tagB)
|
||||
}
|
||||
return(ptrs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -609,7 +612,7 @@ char *curl_post(CURL **cHandlep,char *url,char *userpass,char *postfields,char *
|
||||
return(chunk.memory);
|
||||
}
|
||||
|
||||
uint16_t _komodo_userpass(char *username, char *password, FILE *fp)
|
||||
uint16_t _hush_userpass(char *username, char *password, FILE *fp)
|
||||
{
|
||||
char *rpcuser,*rpcpassword,*str,*ipaddress,line[8192]; uint16_t port = 0;
|
||||
rpcuser = rpcpassword = 0;
|
||||
@@ -647,23 +650,15 @@ uint16_t _komodo_userpass(char *username, char *password, FILE *fp)
|
||||
return(port);
|
||||
}
|
||||
|
||||
uint16_t komodo_userpass(char *userpass,char *symbol)
|
||||
uint16_t hush_userpass(char *userpass,char *symbol)
|
||||
{
|
||||
FILE *fp; uint16_t port = 0; char fname[512],username[512],password[512],confname[HUSH_SMART_CHAIN_MAXLEN];
|
||||
userpass[0] = 0;
|
||||
if ( strcmp("KMD",symbol) == 0 )
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
sprintf(confname,"Komodo.conf");
|
||||
#else
|
||||
sprintf(confname,"komodo.conf");
|
||||
#endif
|
||||
}
|
||||
else sprintf(confname,"%s.conf",symbol);
|
||||
//komodo_statefname(fname,symbol,confname);
|
||||
sprintf(confname,"%s.conf",symbol);
|
||||
//hush_statefname(fname,symbol,confname);
|
||||
if ( (fp= fopen(confname,"rb")) != 0 )
|
||||
{
|
||||
port = _komodo_userpass(username,password,fp);
|
||||
port = _hush_userpass(username,password,fp);
|
||||
sprintf(userpass,"%s:%s",username,password);
|
||||
if ( strcmp(symbol,ASSETCHAINS_SYMBOL) == 0 )
|
||||
strcpy(USERPASS,userpass);
|
||||
@@ -1082,7 +1077,7 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
strcpy(ASSETCHAINS_SYMBOL,CHAINNAME);
|
||||
|
||||
GAMES_PORT = komodo_userpass(userpass,ASSETCHAINS_SYMBOL);
|
||||
GAMES_PORT = hush_userpass(userpass,ASSETCHAINS_SYMBOL);
|
||||
if ( IPADDRESS[0] == 0 )
|
||||
strcpy(IPADDRESS,"127.0.0.1");
|
||||
printf("ASSETCHAINS_SYMBOL.(%s) port.%u (%s) IPADDRESS.%s \n",ASSETCHAINS_SYMBOL,GAMES_PORT,USERPASS,IPADDRESS); sleep(1);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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-2020 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -17,7 +19,7 @@
|
||||
// build hushdex and put in path: git pull; gcc cc/dapps/hushdex.c -lm -o hushdex; cp hushdex /usr/bin
|
||||
// alice sends relcoin and gets basecoin
|
||||
|
||||
#define DEXP2P_CHAIN ((char *)"ZEX")
|
||||
#define DEXP2P_CHAIN ((char *)"HUSHDEX")
|
||||
#define DEXP2P_PUBKEYS ((char *)"hushdex")
|
||||
#include "dappinc.h"
|
||||
|
||||
@@ -152,9 +154,13 @@ char *hushdex_checkname(char *tmpstr,struct msginfo *mp,int32_t baserel,char *co
|
||||
|
||||
int32_t hushdex_zonly(struct coininfo *coin)
|
||||
{
|
||||
if ( strcmp(coin->coin,"PIRATE") == 0 )
|
||||
if ( strcmp(coin->coin,"HUSH3") == 0 )
|
||||
return(1);
|
||||
else return(coin->iszaddr);
|
||||
|
||||
if ( strcmp(coin->coin,"HUSHFILE") == 0 )
|
||||
return(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// //////////////////////////////// the four key functions needed to support a new item for hushdexs
|
||||
@@ -229,24 +235,8 @@ int64_t hushdex_getbalance(struct coininfo *coin)
|
||||
retval = SATOSHIDEN;
|
||||
}
|
||||
return(retval);
|
||||
}
|
||||
else if ( hushdex_zonly(coin) != 0 )
|
||||
} else if ( hushdex_zonly(coin) != 0 ) {
|
||||
return(z_getbalance(coinstr,acname,DPOW_recvZaddr));
|
||||
else
|
||||
{
|
||||
if ( coin->istoken != 0 )
|
||||
{
|
||||
if ( get_getbalance(coinstr,acname) < SUBATOMIC_TXFEE )
|
||||
{
|
||||
fprintf(stderr,"not enough balance to send token\n");
|
||||
return(0);
|
||||
}
|
||||
//fprintf(stderr,"token balance %s\n",coin->tokenid);
|
||||
return(get_tokenbalance(coinstr,acname,coin->tokenid) * SATOSHIDEN);
|
||||
}
|
||||
else if ( coin->isexternal == 0 )
|
||||
return(get_getbalance(coinstr,acname));
|
||||
else return(_hushdex_getbalance(coin));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -936,7 +939,7 @@ bool DiceValidate(struct CCcontract_info *cp,Eval *eval,const CTransaction &tx,
|
||||
if ( (iswin= DiceIsWinner(entropy,entropyvout,txid,tx,vinTx,hash,sbits,minbet,maxbet,maxodds,timeoutblocks,fundingtxid)) != 0 )
|
||||
{
|
||||
// will only happen for fundingPubKey
|
||||
if ( HUSH_INSYNC != 0 && KOMODO_DEALERNODE != 0 )
|
||||
if ( HUSH_INSYNC != 0 && HUSH_DEALERNODE != 0 )
|
||||
DiceQueue(iswin,sbits,fundingtxid,txid,tx,entropyvout);
|
||||
}
|
||||
else
|
||||
@@ -1338,7 +1341,7 @@ UniValue DiceList()
|
||||
|
||||
std::string DiceCreateFunding(uint64_t txfee,char *planstr,int64_t funds,int64_t minbet,int64_t maxbet,int64_t maxodds,int64_t timeoutblocks)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
uint256 zero; CScript fundingPubKey; CPubKey mypk,dicepk; int64_t a,b,c,d; uint64_t sbits; struct CCcontract_info *cp,C;
|
||||
if ( funds < 0 || minbet < 0 || maxbet < 0 || maxodds < 1 || maxodds > 9999 || timeoutblocks < 0 || timeoutblocks > 1440 )
|
||||
{
|
||||
@@ -1373,7 +1376,7 @@ std::string DiceCreateFunding(uint64_t txfee,char *planstr,int64_t funds,int64_t
|
||||
|
||||
std::string DiceAddfunding(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t amount)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CScript fundingPubKey,scriptPubKey; uint256 entropy,hentropy; CPubKey mypk,dicepk; uint64_t sbits; struct CCcontract_info *cp,C; int64_t minbet,maxbet,maxodds,timeoutblocks;
|
||||
if ( amount < 0 )
|
||||
{
|
||||
@@ -1417,7 +1420,7 @@ std::string DiceAddfunding(uint64_t txfee,char *planstr,uint256 fundingtxid,int6
|
||||
|
||||
std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet,int32_t odds)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CScript fundingPubKey; CPubKey mypk,dicepk; uint64_t sbits,entropyval,entropyval2; int64_t funding,minbet,maxbet,maxodds,timeoutblocks; uint256 entropytxid,entropytxid2,entropy,hentropy; struct CCcontract_info *cp,C;
|
||||
if ( bet < 0 )
|
||||
{
|
||||
@@ -1476,7 +1479,7 @@ std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet
|
||||
|
||||
std::string DiceBetFinish(uint8_t &funcid,uint256 &entropyused,int32_t &entropyvout,int32_t *resultp,uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettxid,int32_t winlosetimeout,uint256 vin0txid,int32_t vin0vout)
|
||||
{
|
||||
CMutableTransaction savemtx,mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction savemtx,mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CScript scriptPubKey,fundingPubKey; CTransaction oldbetTx,betTx,entropyTx; uint256 hentropyproof,entropytxid,hashBlock,bettorentropy,entropy,hentropy,oldbettxid; CPubKey mypk,dicepk,fundingpk; struct CCcontract_info *cp,C; int64_t inputs=0,CCchange=0,odds,fundsneeded,minbet,maxbet,maxodds,timeoutblocks; int32_t oldentropyvout,retval=0,iswin=0; uint64_t entropyval,sbits;
|
||||
entropyused = zeroid;
|
||||
*resultp = 0;
|
||||
@@ -1788,8 +1791,8 @@ double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettx
|
||||
{
|
||||
if ( myGetTransaction(betTx.vin[0].prevout.hash,entropyTx,hashBlock) != 0 )
|
||||
{
|
||||
flag = KOMODO_DEALERNODE != 0;
|
||||
if ( KOMODO_DEALERNODE != 0 && scriptPubKey == fundingPubKey )
|
||||
flag = HUSH_DEALERNODE != 0;
|
||||
if ( HUSH_DEALERNODE != 0 && scriptPubKey == fundingPubKey )
|
||||
{
|
||||
bettorentropy = DiceGetEntropy(betTx,'B');
|
||||
if ( (iswin= DiceIsWinner(hentropyproof,entropyvout,txid,betTx,entropyTx,bettorentropy,sbits,minbet,maxbet,maxodds,timeoutblocks,fundingtxid)) != 0 )
|
||||
@@ -1818,7 +1821,7 @@ double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettx
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( didinit == 0 && KOMODO_DEALERNODE == 0 && scriptPubKey == fundingPubKey )
|
||||
if ( didinit == 0 && HUSH_DEALERNODE == 0 && scriptPubKey == fundingPubKey )
|
||||
{
|
||||
strcpy(_planstr,planstr);
|
||||
dealer0_fundingtxid = fundingtxid;
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
// Copyright (c) 2016-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
|
||||
|
||||
/* Based on the public domain implementation in
|
||||
* crypto_hash/keccakc512/simple/ from http://bench.cr.yp.to/supercop.html
|
||||
* by Ronny Van Keer
|
||||
@@ -11,8 +15,6 @@
|
||||
#define DBENCH_STOP(arg)
|
||||
|
||||
#include "dilithium.h"
|
||||
|
||||
|
||||
#define NROUNDS 24
|
||||
#define ROL(a, offset) ((a << offset) ^ (a >> (64-offset)))
|
||||
|
||||
@@ -3162,7 +3164,7 @@ CPubKey Faucet_pubkeyget()
|
||||
|
||||
UniValue dilithium_register(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
UniValue result(UniValue::VOBJ); std::string rawtx; CPubKey faucetpk,mypk,dilithiumpk; uint8_t seed[SEEDBYTES],pk[CRYPTO_PUBLICKEYBYTES],sk[CRYPTO_SECRETKEYBYTES]; char coinaddr[64],str[CRYPTO_SECRETKEYBYTES*2+1]; int64_t CCchange,inputs; std::vector<uint8_t> bigpub; int32_t i,n,warningflag = 0;
|
||||
if ( txfee == 0 )
|
||||
txfee = DILITHIUM_TXFEE;
|
||||
@@ -3290,7 +3292,7 @@ UniValue dilithium_verify(uint64_t txfee,struct CCcontract_info *cp,cJSON *param
|
||||
|
||||
UniValue dilithium_send(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
UniValue result(UniValue::VOBJ); std::string rawtx,checkhandle; CPubKey destpub33,mypk,dilithiumpk; int32_t i,n; int64_t amount; uint256 destpubtxid; uint8_t pk[CRYPTO_PUBLICKEYBYTES];
|
||||
if ( txfee == 0 )
|
||||
txfee = DILITHIUM_TXFEE;
|
||||
@@ -3318,7 +3320,7 @@ UniValue dilithium_send(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
|
||||
UniValue dilithium_spend(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
UniValue result(UniValue::VOBJ); std::string rawtx; CPubKey mypk,destpub33; CTransaction vintx; uint256 prevhash,hashBlock,destpubtxid; int32_t i,smlen,n,numvouts; char str[129],*scriptstr,*retstr=""; CTxOut vout; std::string handle; uint8_t pk[CRYPTO_PUBLICKEYBYTES],pk2[CRYPTO_PUBLICKEYBYTES],sk[CRYPTO_SECRETKEYBYTES],msg[32],seed[32]; std::vector<uint8_t> sig;
|
||||
if ( txfee == 0 )
|
||||
txfee = DILITHIUM_TXFEE;
|
||||
@@ -3414,7 +3416,7 @@ int64_t dilithium_inputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPu
|
||||
|
||||
UniValue dilithium_Qsend(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
UniValue result(UniValue::VOBJ); std::string rawtx; CPubKey mypk,destpub33; CTransaction tx,vintx; uint256 prevhash,mypubtxid,hashBlock,destpubtxid; int64_t amount,inputsum,outputsum,change; int32_t i,smlen,n,numvouts; char str[129],myCCaddr[64],*scriptstr,*retstr=""; CTxOut vout; std::string handle; uint8_t pk[CRYPTO_PUBLICKEYBYTES],pk2[CRYPTO_PUBLICKEYBYTES],sk[CRYPTO_SECRETKEYBYTES],msg[32],seed[32]; std::vector<uint8_t> sig; std::vector<uint256> voutpubtxids;
|
||||
if ( txfee == 0 )
|
||||
txfee = DILITHIUM_TXFEE;
|
||||
|
||||
@@ -1,143 +1,20 @@
|
||||
// Copyright (c) 2016-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 <stdint.h>
|
||||
|
||||
/*
|
||||
#ifndef CPUCYCLES_H
|
||||
#define CPUCYCLES_H
|
||||
|
||||
#ifdef DBENCH
|
||||
#define DBENCH_START() uint64_t time = cpucycles_start()
|
||||
#define DBENCH_STOP(t) t += cpucycles_stop() - time - timing_overhead
|
||||
#else
|
||||
#define DBENCH_START()
|
||||
#define DBENCH_STOP(t)
|
||||
#endif
|
||||
|
||||
#ifdef USE_RDPMC // Needs echo 2 > /sys/devices/cpu/rdpmc
|
||||
#ifdef SERIALIZE_RDC
|
||||
|
||||
static inline uint64_t cpucycles_start(void) {
|
||||
const uint32_t ecx = (1U << 30) + 1;
|
||||
uint64_t result;
|
||||
|
||||
asm volatile("cpuid; movl %1,%%ecx; rdpmc; shlq $32,%%rdx; orq %%rdx,%%rax"
|
||||
: "=&a" (result) : "r" (ecx) : "rbx", "rcx", "rdx");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline uint64_t cpucycles_stop(void) {
|
||||
const uint32_t ecx = (1U << 30) + 1;
|
||||
uint64_t result, dummy;
|
||||
|
||||
asm volatile("rdpmc; shlq $32,%%rdx; orq %%rdx,%%rax; movq %%rax,%0; cpuid"
|
||||
: "=&r" (result), "=c" (dummy) : "c" (ecx) : "rax", "rbx", "rdx");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline uint64_t cpucycles_start(void) {
|
||||
const uint32_t ecx = (1U << 30) + 1;
|
||||
uint64_t result;
|
||||
|
||||
asm volatile("rdpmc; shlq $32,%%rdx; orq %%rdx,%%rax"
|
||||
: "=a" (result) : "c" (ecx) : "rdx");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline uint64_t cpucycles_stop(void) {
|
||||
const uint32_t ecx = (1U << 30) + 1;
|
||||
uint64_t result;
|
||||
|
||||
asm volatile("rdpmc; shlq $32,%%rdx; orq %%rdx,%%rax"
|
||||
: "=a" (result) : "c" (ecx) : "rdx");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
#else
|
||||
#ifdef SERIALIZE_RDC
|
||||
|
||||
static inline uint64_t cpucycles_start(void) {
|
||||
uint64_t result;
|
||||
|
||||
asm volatile("cpuid; rdtsc; shlq $32,%%rdx; orq %%rdx,%%rax"
|
||||
: "=a" (result) : : "%rbx", "%rcx", "%rdx");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline uint64_t cpucycles_stop(void) {
|
||||
uint64_t result;
|
||||
|
||||
asm volatile("rdtscp; shlq $32,%%rdx; orq %%rdx,%%rax; mov %%rax,%0; cpuid"
|
||||
: "=r" (result) : : "%rax", "%rbx", "%rcx", "%rdx");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline uint64_t cpucycles_start(void) {
|
||||
uint64_t result;
|
||||
|
||||
asm volatile("rdtsc; shlq $32,%%rdx; orq %%rdx,%%rax"
|
||||
: "=a" (result) : : "%rdx");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline uint64_t cpucycles_stop(void) {
|
||||
uint64_t result;
|
||||
|
||||
asm volatile("rdtsc; shlq $32,%%rdx; orq %%rdx,%%rax"
|
||||
: "=a" (result) : : "%rdx");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int64_t cpucycles_overhead(void);
|
||||
|
||||
#endif*/
|
||||
|
||||
#ifndef FIPS202_H
|
||||
#define FIPS202_H
|
||||
|
||||
#ifndef HUSH_DILITHIUM_H
|
||||
#define HUSH_DILITHIUM_H
|
||||
|
||||
#define SHAKE128_RATE 168
|
||||
#define SHAKE256_RATE 136
|
||||
|
||||
void shake128_absorb(uint64_t *s,
|
||||
const uint8_t *input,
|
||||
int32_t inlen);
|
||||
|
||||
void shake128_squeezeblocks(uint8_t *output,
|
||||
int32_t nblocks,
|
||||
uint64_t *s);
|
||||
|
||||
void shake256_absorb(uint64_t *s,
|
||||
const uint8_t *input,
|
||||
int32_t inlen);
|
||||
|
||||
void shake256_squeezeblocks(uint8_t *output,
|
||||
int32_t nblocks,
|
||||
uint64_t *s);
|
||||
|
||||
void shake128(uint8_t *output,
|
||||
int32_t outlen,
|
||||
const uint8_t *input,
|
||||
int32_t inlen);
|
||||
|
||||
void shake256(uint8_t *output,
|
||||
int32_t outlen,
|
||||
const uint8_t *input,
|
||||
int32_t inlen);
|
||||
void shake128_absorb(uint64_t *s, const uint8_t *input, int32_t inlen);
|
||||
void shake128_squeezeblocks(uint8_t *output, int32_t nblocks, uint64_t *s);
|
||||
void shake256_absorb(uint64_t *s, const uint8_t *input, int32_t inlen);
|
||||
void shake256_squeezeblocks(uint8_t *output, int32_t nblocks, uint64_t *s);
|
||||
void shake128(uint8_t *output, int32_t outlen, const uint8_t *input, int32_t inlen);
|
||||
void shake256(uint8_t *output, int32_t outlen, const uint8_t *input, int32_t inlen);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -463,13 +340,7 @@ CRYPTO_BYTES size error
|
||||
#define CRYPTO_ALGNAME "Dilithium"
|
||||
|
||||
int crypto_sign_keypair(uint8_t *pk, uint8_t *sk);
|
||||
|
||||
int crypto_sign(uint8_t *sm, int32_t *smlen,
|
||||
const uint8_t *msg, int32_t len,
|
||||
const uint8_t *sk);
|
||||
|
||||
int crypto_sign_open(uint8_t *m, int32_t *mlen,
|
||||
const uint8_t *sm, int32_t smlen,
|
||||
const uint8_t *pk);
|
||||
int crypto_sign(uint8_t *sm, int32_t *smlen, const uint8_t *msg, int32_t len, const uint8_t *sk);
|
||||
int crypto_sign_open(uint8_t *m, int32_t *mlen, const uint8_t *sm, int32_t smlen, const uint8_t *pk);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -12,10 +15,8 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include <assert.h>
|
||||
#include <cryptoconditions.h>
|
||||
|
||||
#include "primitives/block.h"
|
||||
#include "primitives/transaction.h"
|
||||
#include "script/cc.h"
|
||||
@@ -32,14 +33,14 @@ char *CClib_name();
|
||||
|
||||
Eval* EVAL_TEST = 0;
|
||||
struct CCcontract_info CCinfos[0x100];
|
||||
extern pthread_mutex_t KOMODO_CC_mutex;
|
||||
extern pthread_mutex_t HUSH_CC_mutex;
|
||||
|
||||
bool RunCCEval(const CC *cond, const CTransaction &tx, unsigned int nIn)
|
||||
{
|
||||
EvalRef eval;
|
||||
pthread_mutex_lock(&KOMODO_CC_mutex);
|
||||
pthread_mutex_lock(&HUSH_CC_mutex);
|
||||
bool out = eval->Dispatch(cond, tx, nIn);
|
||||
pthread_mutex_unlock(&KOMODO_CC_mutex);
|
||||
pthread_mutex_unlock(&HUSH_CC_mutex);
|
||||
if ( eval->state.IsValid() != out)
|
||||
fprintf(stderr,"out %d vs %d isValid\n",(int32_t)out,(int32_t)eval->state.IsValid());
|
||||
//assert(eval->state.IsValid() == out);
|
||||
@@ -160,12 +161,12 @@ bool Eval::GetBlock(uint256 hash, CBlockIndex& blockIdx) const
|
||||
return false;
|
||||
}
|
||||
|
||||
extern int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
|
||||
extern int32_t hush_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
|
||||
|
||||
|
||||
int32_t Eval::GetNotaries(uint8_t pubkeys[64][33], int32_t height, uint32_t timestamp) const
|
||||
{
|
||||
return komodo_notaries(pubkeys, height, timestamp);
|
||||
return hush_notaries(pubkeys, height, timestamp);
|
||||
}
|
||||
|
||||
bool Eval::CheckNotaryInputs(const CTransaction &tx, uint32_t height, uint32_t timestamp) const
|
||||
@@ -179,16 +180,14 @@ bool Eval::CheckNotaryInputs(const CTransaction &tx, uint32_t height, uint32_t t
|
||||
return CheckTxAuthority(tx, auth);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get MoM from a notarisation tx hash (on KMD)
|
||||
*/
|
||||
bool Eval::GetNotarisationData(const uint256 notaryHash, NotarisationData &data) const
|
||||
// Get MoM from a notarisation tx hash (on HUSH)
|
||||
bool Eval::GetNotarizationData(const uint256 notaryHash, NotarizationData &data) const
|
||||
{
|
||||
CTransaction notarisationTx;
|
||||
CBlockIndex block;
|
||||
if (!GetTxConfirmed(notaryHash, notarisationTx, block)) return false;
|
||||
if (!CheckNotaryInputs(notarisationTx, block.GetHeight(), block.nTime)) return false;
|
||||
if (!ParseNotarisationOpReturn(notarisationTx, data)) return false;
|
||||
if (!ParseNotarizationOpReturn(notarisationTx, data)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -206,9 +205,9 @@ std::string Eval::GetAssetchainsSymbol() const
|
||||
|
||||
|
||||
/*
|
||||
* Notarisation data, ie, OP_RETURN payload in notarisation transactions
|
||||
* Notarization data, ie, OP_RETURN payload in notarisation transactions
|
||||
*/
|
||||
bool ParseNotarisationOpReturn(const CTransaction &tx, NotarisationData &data)
|
||||
bool ParseNotarizationOpReturn(const CTransaction &tx, NotarizationData &data)
|
||||
{
|
||||
if (tx.vout.size() < 2) return false;
|
||||
std::vector<unsigned char> vdata;
|
||||
@@ -217,10 +216,7 @@ bool ParseNotarisationOpReturn(const CTransaction &tx, NotarisationData &data)
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Misc
|
||||
*/
|
||||
// Misc
|
||||
std::string EvalToStr(EvalCode c)
|
||||
{
|
||||
FOREACH_EVAL(EVAL_GENERATE_STRING);
|
||||
@@ -230,7 +226,6 @@ std::string EvalToStr(EvalCode c)
|
||||
|
||||
}
|
||||
|
||||
|
||||
uint256 SafeCheckMerkleBranch(uint256 hash, const std::vector<uint256>& vMerkleBranch, int nIndex)
|
||||
{
|
||||
if (nIndex == -1)
|
||||
@@ -251,7 +246,6 @@ uint256 SafeCheckMerkleBranch(uint256 hash, const std::vector<uint256>& vMerkleB
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
uint256 GetMerkleRoot(const std::vector<uint256>& vLeaves)
|
||||
{
|
||||
bool fMutated;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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
|
||||
/******************************************************************************
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "consensus/validation.h"
|
||||
#include "primitives/transaction.h"
|
||||
|
||||
#define KOMODO_FIRSTFUNGIBLEID 100
|
||||
#define HUSH_FIRSTFUNGIBLEID 100
|
||||
|
||||
/*
|
||||
* Eval codes
|
||||
@@ -36,8 +36,8 @@
|
||||
*
|
||||
* If at some point a new interpretation model is introduced,
|
||||
* there should be a code identifying it. For example,
|
||||
* a possible code is EVAL_BITCOIN_SCRIPT, where the entire binary
|
||||
* after the code is interpreted as a bitcoin script.
|
||||
* a possible code is EVAL_HUSH_SCRIPT, where the entire binary
|
||||
* after the code is interpreted as a Hush (Bitcoin) Protocol Script.
|
||||
*/
|
||||
#define FOREACH_EVAL(EVAL) \
|
||||
EVAL(EVAL_IMPORTPAYOUT, 0xe1) \
|
||||
@@ -69,7 +69,7 @@ typedef uint8_t EvalCode;
|
||||
|
||||
|
||||
class AppVM;
|
||||
class NotarisationData;
|
||||
class NotarizationData;
|
||||
|
||||
|
||||
class Eval
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
virtual bool GetSpendsConfirmed(uint256 hash, std::vector<CTransaction> &spends) const;
|
||||
virtual bool GetBlock(uint256 hash, CBlockIndex& blockIdx) const;
|
||||
virtual int32_t GetNotaries(uint8_t pubkeys[64][33], int32_t height, uint32_t timestamp) const;
|
||||
virtual bool GetNotarisationData(uint256 notarisationHash, NotarisationData &data) const;
|
||||
virtual bool GetNotarizationData(uint256 notarisationHash, NotarizationData &data) const;
|
||||
virtual bool CheckNotaryInputs(const CTransaction &tx, uint32_t height, uint32_t timestamp) const;
|
||||
virtual uint32_t GetAssetchainsCC() const;
|
||||
virtual std::string GetAssetchainsSymbol() const;
|
||||
@@ -160,10 +160,10 @@ extern char SMART_CHAIN_SYMBOL[65];
|
||||
/*
|
||||
* Data from notarisation OP_RETURN from chain being notarised
|
||||
*/
|
||||
class NotarisationData
|
||||
class NotarizationData
|
||||
{
|
||||
public:
|
||||
int IsBackNotarisation = 0;
|
||||
int IsBackNotarization = 0;
|
||||
uint256 blockHash = uint256();
|
||||
uint32_t height = 0;
|
||||
uint256 txHash = uint256();
|
||||
@@ -174,7 +174,7 @@ public:
|
||||
uint256 MoMoM = uint256();
|
||||
uint32_t MoMoMDepth = 0;
|
||||
|
||||
NotarisationData(int IsBack=2) : IsBackNotarisation(IsBack) {
|
||||
NotarizationData(int IsBack=2) : IsBackNotarization(IsBack) {
|
||||
symbol[0] = '\0';
|
||||
}
|
||||
|
||||
@@ -183,8 +183,8 @@ public:
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action) {
|
||||
|
||||
bool IsBack = IsBackNotarisation;
|
||||
if (2 == IsBackNotarisation) IsBack = DetectBackNotarisation(s, ser_action);
|
||||
bool IsBack = IsBackNotarization;
|
||||
if (2 == IsBackNotarization) IsBack = DetectBackNotarization(s, ser_action);
|
||||
|
||||
READWRITE(blockHash);
|
||||
READWRITE(height);
|
||||
@@ -219,7 +219,7 @@ public:
|
||||
}
|
||||
|
||||
template <typename Stream>
|
||||
bool DetectBackNotarisation(Stream& s, CSerActionUnserialize act)
|
||||
bool DetectBackNotarization(Stream& s, CSerActionUnserialize act)
|
||||
{
|
||||
if (SMART_CHAIN_SYMBOL[0]) return 1;
|
||||
if (s.size() >= 72) {
|
||||
@@ -230,14 +230,14 @@ public:
|
||||
}
|
||||
|
||||
template <typename Stream>
|
||||
bool DetectBackNotarisation(Stream& s, CSerActionSerialize act)
|
||||
bool DetectBackNotarization(Stream& s, CSerActionSerialize act)
|
||||
{
|
||||
return !txHash.IsNull();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
bool ParseNotarisationOpReturn(const CTransaction &tx, NotarisationData &data);
|
||||
bool ParseNotarizationOpReturn(const CTransaction &tx, NotarizationData &data);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -179,7 +182,7 @@ int64_t AddFaucetInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPub
|
||||
|
||||
UniValue FaucetGet(const CPubKey& pk, uint64_t txfee)
|
||||
{
|
||||
CMutableTransaction tmpmtx,mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction tmpmtx,mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey faucetpk; int64_t inputs,CCchange=0,nValue=FAUCETSIZE; struct CCcontract_info *cp,C; std::string rawhex; uint32_t j; int32_t i,len; uint8_t buf[32768]; bits256 hash;
|
||||
cp = CCinit(&C,EVAL_FAUCET);
|
||||
if ( txfee == 0 )
|
||||
@@ -218,7 +221,7 @@ UniValue FaucetGet(const CPubKey& pk, uint64_t txfee)
|
||||
|
||||
UniValue FaucetFund(const CPubKey& pk, uint64_t txfee,int64_t funds)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey faucetpk; CScript opret; struct CCcontract_info *cp,C;
|
||||
|
||||
cp = CCinit(&C,EVAL_FAUCET);
|
||||
@@ -237,7 +240,7 @@ UniValue FaucetFund(const CPubKey& pk, uint64_t txfee,int64_t funds)
|
||||
UniValue FaucetInfo()
|
||||
{
|
||||
UniValue result(UniValue::VOBJ); char numstr[64];
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey faucetpk; struct CCcontract_info *cp,C; int64_t funding;
|
||||
result.push_back(Pair("result","success"));
|
||||
result.push_back(Pair("name","Faucet"));
|
||||
@@ -248,4 +251,3 @@ UniValue FaucetInfo()
|
||||
result.push_back(Pair("funding",numstr));
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -157,7 +160,7 @@ std::string FSMList()
|
||||
|
||||
std::string FSMCreate(uint64_t txfee,std::string name,std::string states)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk,fsmpk; CScript opret; int64_t inputs,CCchange=0,nValue=COIN; struct CCcontract_info *cp,C;
|
||||
cp = CCinit(&C,EVAL_FSM);
|
||||
if ( txfee == 0 )
|
||||
@@ -178,7 +181,7 @@ std::string FSMCreate(uint64_t txfee,std::string name,std::string states)
|
||||
|
||||
std::string FSMInfo(uint256 fsmtxid)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk,fsmpk; int64_t funds = 0; CScript opret; struct CCcontract_info *cp,C;
|
||||
cp = CCinit(&C,EVAL_FSM);
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
|
||||
// Copyright (c) 2016-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 "prices.h"
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -67,9 +69,9 @@ void prices_bardisp(struct prices_bar *bar)
|
||||
int64_t prices_blockinfo(int32_t height,char *acaddr)
|
||||
{
|
||||
std::vector<uint8_t> vopret; CBlockIndex *pindex; CBlock block; CTransaction tx,vintx; uint64_t pricebits; char destaddr[64]; uint32_t aveprice=0,timestamp,uprice; uint256 hashBlock; int64_t dist,mindist=(1LL<<60),prizefund = 0; int32_t mini=-1,i,n,vini,numvouts,iter; struct prices_bar refbar;
|
||||
if ( (pindex= komodo_chainactive(height)) != 0 )
|
||||
if ( (pindex= hush_chainactive(height)) != 0 )
|
||||
{
|
||||
if ( komodo_blockload(block,pindex) == 0 )
|
||||
if ( hush_blockload(block,pindex) == 0 )
|
||||
{
|
||||
n = block.vtx.size();
|
||||
vini = 0;
|
||||
@@ -127,7 +129,7 @@ int64_t prices_blockinfo(int32_t height,char *acaddr)
|
||||
|
||||
UniValue games_settle(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ); char acaddr[64]; CPubKey acpk,mypk,gamespk; int64_t prizefund = 0; int32_t height,nextheight = komodo_nextheight();
|
||||
UniValue result(UniValue::VOBJ); char acaddr[64]; CPubKey acpk,mypk,gamespk; int64_t prizefund = 0; int32_t height,nextheight = hush_nextheight();
|
||||
if ( ASSETCHAINS_OVERRIDE_PUBKEY33[0] == 0 )
|
||||
{
|
||||
result.push_back(Pair("result","error"));
|
||||
@@ -169,7 +171,7 @@ UniValue games_settle(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
|
||||
UniValue games_bet(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
UniValue result(UniValue::VOBJ); std::string rawtx; int64_t amount,inputsum; uint64_t price; CPubKey gamespk,mypk,acpk;
|
||||
if ( ASSETCHAINS_OVERRIDE_PUBKEY33[0] == 0 )
|
||||
{
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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
|
||||
|
||||
#ifndef H_PRICES_H
|
||||
#define H_PRICES_H
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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 "tetris.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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
|
||||
|
||||
#ifndef H_TETRIS_H
|
||||
#define H_TETRIS_H
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -598,7 +601,7 @@ int32_t games_isvalidgame(struct CCcontract_info *cp,int32_t &gameheight,CTransa
|
||||
if ( (txid == zeroid || myGetTransaction(txid,tx,hashBlock) != 0) && (numvouts= tx.vout.size()) > 1 )
|
||||
{
|
||||
if ( txid != zeroid )
|
||||
gameheight = komodo_blockheight(hashBlock);
|
||||
gameheight = hush_blockheight(hashBlock);
|
||||
else
|
||||
{
|
||||
txid = tx.GetHash();
|
||||
@@ -634,7 +637,7 @@ int32_t games_playersalive(int32_t &openslots,int32_t &numplayers,uint256 gametx
|
||||
{
|
||||
int32_t i,n,vout,spentvini,registration_open = 0,alive = 0; CTransaction tx; uint256 txid,spenttxid,hashBlock; CBlockIndex *pindex; uint64_t txfee = 10000;
|
||||
numplayers = openslots = 0;
|
||||
if ( komodo_nextheight() <= gameht+GAMES_MAXKEYSTROKESGAP )
|
||||
if ( hush_nextheight() <= gameht+GAMES_MAXKEYSTROKESGAP )
|
||||
registration_open = 1;
|
||||
for (i=0; i<maxplayers; i++)
|
||||
{
|
||||
@@ -671,7 +674,7 @@ int32_t games_playersalive(int32_t &openslots,int32_t &numplayers,uint256 gametx
|
||||
{
|
||||
if ( myGetTransaction(txid,tx,hashBlock) != 0 )
|
||||
{
|
||||
if ( (pindex= komodo_blockindex(hashBlock)) != 0 )
|
||||
if ( (pindex= hush_blockindex(hashBlock)) != 0 )
|
||||
{
|
||||
if ( pindex->GetHeight() <= gameht+GAMES_MAXKEYSTROKESGAP )
|
||||
alive++;
|
||||
@@ -854,15 +857,15 @@ int64_t games_buyins(uint256 gametxid,int32_t maxplayers)
|
||||
uint64_t games_gamefields(UniValue &obj,int64_t maxplayers,int64_t buyin,uint256 gametxid,char *mygamesaddr)
|
||||
{
|
||||
CBlockIndex *pindex; int32_t ht,openslots,delay,numplayers; uint256 hashBlock; uint64_t seed=0; char cmd[512]; CTransaction tx;
|
||||
if ( myGetTransaction(gametxid,tx,hashBlock) != 0 && (pindex= komodo_blockindex(hashBlock)) != 0 )
|
||||
if ( myGetTransaction(gametxid,tx,hashBlock) != 0 && (pindex= hush_blockindex(hashBlock)) != 0 )
|
||||
{
|
||||
ht = pindex->GetHeight();
|
||||
delay = GAMES_REGISTRATION * (maxplayers > 1);
|
||||
obj.push_back(Pair("height",ht));
|
||||
obj.push_back(Pair("start",ht+delay));
|
||||
if ( komodo_nextheight() > ht+delay )
|
||||
if ( hush_nextheight() > ht+delay )
|
||||
{
|
||||
if ( (pindex= komodo_chainactive(ht+delay)) != 0 )
|
||||
if ( (pindex= hush_chainactive(ht+delay)) != 0 )
|
||||
{
|
||||
hashBlock = pindex->GetBlockHash();
|
||||
obj.push_back(Pair("starthash",hashBlock.ToString()));
|
||||
@@ -1062,8 +1065,8 @@ int32_t games_findbaton(struct CCcontract_info *cp,uint256 &playertxid,gameseven
|
||||
if ( myGetTransaction(batontxid,batontx,hashBlock) != 0 && batontx.vout.size() > 0 )
|
||||
{
|
||||
if ( hashBlock == zeroid )
|
||||
batonht = komodo_nextheight();
|
||||
else if ( (pindex= komodo_blockindex(hashBlock)) == 0 )
|
||||
batonht = hush_nextheight();
|
||||
else if ( (pindex= hush_blockindex(hashBlock)) == 0 )
|
||||
return(-4);
|
||||
else batonht = pindex->GetHeight();
|
||||
batonvalue = batontx.vout[0].nValue;
|
||||
@@ -1112,7 +1115,7 @@ void games_gameplayerinfo(struct CCcontract_info *cp,UniValue &obj,uint256 gamet
|
||||
|
||||
UniValue games_newgame(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
UniValue result(UniValue::VOBJ); std::string rawtx; CPubKey gamespk,mypk; char *jsonstr; uint64_t inputsum,change,required,buyin=0; int32_t i,n,maxplayers = 1;
|
||||
if ( txfee == 0 )
|
||||
txfee = 10000;
|
||||
@@ -1154,7 +1157,7 @@ UniValue games_pending(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
gamespk = GetUnspendable(cp,0);
|
||||
GetCCaddress(cp,coinaddr,gamespk);
|
||||
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||
nextheight = komodo_nextheight();
|
||||
nextheight = hush_nextheight();
|
||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||
{
|
||||
txid = it->first.txhash;
|
||||
@@ -1224,7 +1227,7 @@ UniValue games_register(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
// vin2 -> original creation TCBOO playerdata used
|
||||
// vin3+ -> buyin
|
||||
// vout0 -> keystrokes/completion baton
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
UniValue result(UniValue::VOBJ); char destaddr[64],coinaddr[64]; uint256 tokenid,gametxid,origplayergame,playertxid,hashBlock; int32_t err,maxplayers,gameheight,n,numvouts,vout=1; int64_t inputsum,buyin,CCchange=0; CPubKey pk,mypk,gamespk,burnpk; CTransaction tx,playertx; std::vector<uint8_t> playerdata; std::string rawtx,symbol,pname; bits256 t;
|
||||
|
||||
if ( txfee == 0 )
|
||||
@@ -1249,7 +1252,7 @@ UniValue games_register(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
if ( tokenid != zeroid ) // if it is tokentransfer this will be 0
|
||||
vout = 1;
|
||||
}
|
||||
if ( komodo_nextheight() > gameheight + GAMES_MAXKEYSTROKESGAP )
|
||||
if ( hush_nextheight() > gameheight + GAMES_MAXKEYSTROKESGAP )
|
||||
return(cclib_error(result,"didnt register in time, GAMES_MAXKEYSTROKESGAP"));
|
||||
games_univalue(result,0,maxplayers,buyin);
|
||||
GetCCaddress1of2(cp,coinaddr,gamespk,mypk);
|
||||
@@ -1311,7 +1314,7 @@ UniValue games_keystrokes(uint64_t txfee,struct CCcontract_info *cp,cJSON *param
|
||||
// opret -> user input chars
|
||||
// being killed should auto broadcast (possible to be suppressed?)
|
||||
// respawn to be prevented by including timestamps
|
||||
int32_t nextheight = komodo_nextheight();
|
||||
int32_t nextheight = hush_nextheight();
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(),nextheight);
|
||||
UniValue result(UniValue::VOBJ); CPubKey gamespk,mypk; uint256 gametxid,playertxid,batontxid; int64_t batonvalue,buyin; std::vector<uint8_t> keystrokes,playerdata; int32_t numplayers,regslot,numkeys,batonht,batonvout,n,elapsed,gameheight,maxplayers; CTransaction tx; CTxOut txout; char *keystrokestr,destaddr[64]; std::string rawtx,symbol,pname; bits256 t; uint8_t mypriv[32];
|
||||
// if ( txfee == 0 )
|
||||
@@ -1508,7 +1511,7 @@ UniValue games_finish(uint64_t txfee,struct CCcontract_info *cp,cJSON *params,ch
|
||||
// vout0 -> playerdata marker
|
||||
// vout0 -> 1% ingame gold
|
||||
// get any playerdata, get all keystrokes, replay game and compare final state
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
UniValue result(UniValue::VOBJ); std::string rawtx,symbol,pname; CTransaction gametx; uint64_t seed; int64_t buyin,batonvalue,inputsum,cashout=0,CCchange=0; int32_t i,err,gameheight,tmp,numplayers,regslot,n,num,numkeys,maxplayers,batonht,batonvout; char mygamesaddr[64],str[512]; gamesevent *keystrokes = 0; std::vector<uint8_t> playerdata,newdata,nodata; uint256 batontxid,playertxid,gametxid; CPubKey mypk,gamespk; uint8_t player[10000],mypriv[32],funcid;
|
||||
struct CCcontract_info *cpTokens, tokensC;
|
||||
|
||||
@@ -1717,7 +1720,7 @@ UniValue games_setname(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
|
||||
UniValue games_fund(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
UniValue result(UniValue::VOBJ); std::string rawtx; int64_t amount,inputsum; CPubKey gamespk,mypk; CScript opret;
|
||||
if ( params != 0 && cJSON_GetArraySize(params) == 1 )
|
||||
{
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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
|
||||
#ifndef H_GAMESCC_H
|
||||
#define H_GAMESCC_H
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -864,7 +867,7 @@ int64_t AddGatewaysInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CP
|
||||
|
||||
UniValue GatewaysBind(const CPubKey& pk, uint64_t txfee,std::string coin,uint256 tokenid,int64_t totalsupply,uint256 oracletxid,uint8_t M,uint8_t N,std::vector<CPubKey> pubkeys,uint8_t p1,uint8_t p2,uint8_t p3,uint8_t p4)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CTransaction oracletx; uint8_t taddr,prefix,prefix2,wiftype; CPubKey mypk,gatewayspk; CScript opret; uint256 hashBlock;
|
||||
struct CCcontract_info *cp,*cpTokens,C,CTokens; std::string name,description,format; int32_t i,numvouts; int64_t fullsupply;
|
||||
char destaddr[64],coinaddr[64],myTokenCCaddr[64],*fstr;
|
||||
@@ -929,7 +932,7 @@ UniValue GatewaysBind(const CPubKey& pk, uint64_t txfee,std::string coin,uint256
|
||||
|
||||
UniValue GatewaysDeposit(const CPubKey& pk, uint64_t txfee,uint256 bindtxid,int32_t height,std::string refcoin,uint256 cointxid,int32_t claimvout,std::string deposithex,std::vector<uint8_t>proof,CPubKey destpub,int64_t amount)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CTransaction tx; CPubKey mypk; uint256 oracletxid,merkleroot,mhash,hashBlock,tokenid,txid;
|
||||
int64_t totalsupply; int32_t i,m,n,numvouts; uint8_t M,N,taddr,prefix,prefix2,wiftype; std::string coin; struct CCcontract_info *cp,C;
|
||||
std::vector<CPubKey> pubkeys,publishers; std::vector<uint256>txids; char str[65],depositaddr[64],txidaddr[64];
|
||||
@@ -979,7 +982,7 @@ UniValue GatewaysDeposit(const CPubKey& pk, uint64_t txfee,uint256 bindtxid,int3
|
||||
|
||||
UniValue GatewaysClaim(const CPubKey& pk, uint64_t txfee,uint256 bindtxid,std::string refcoin,uint256 deposittxid,CPubKey destpub,int64_t amount)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CTransaction tx; CPubKey mypk,gatewayspk,tmpdestpub; struct CCcontract_info *cp,C; uint8_t M,N,taddr,prefix,prefix2,wiftype;
|
||||
std::string coin, deposithex; std::vector<CPubKey> pubkeys,publishers; int64_t totalsupply,depositamount,tmpamount,inputs,CCchange=0;
|
||||
int32_t numvouts,claimvout,height; std::vector<uint8_t> proof;
|
||||
@@ -1019,7 +1022,7 @@ UniValue GatewaysClaim(const CPubKey& pk, uint64_t txfee,uint256 bindtxid,std::s
|
||||
|
||||
UniValue GatewaysWithdraw(const CPubKey& pk, uint64_t txfee,uint256 bindtxid,std::string refcoin,CPubKey withdrawpub,int64_t amount)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CTransaction tx; CPubKey mypk,gatewayspk,signerpk; uint256 txid,tokenid,hashBlock,oracletxid,tmptokenid,tmpbindtxid,withdrawtxid; int32_t vout,numvouts;
|
||||
int64_t nValue,totalsupply,inputs,CCchange=0,tmpamount; uint8_t funcid,K,M,N,taddr,prefix,prefix2,wiftype; std::string coin,hex;
|
||||
std::vector<CPubKey> pubkeys; char depositaddr[64],coinaddr[64]; struct CCcontract_info *cp,C,*cpTokens,CTokens;
|
||||
@@ -1075,7 +1078,7 @@ UniValue GatewaysWithdraw(const CPubKey& pk, uint64_t txfee,uint256 bindtxid,std
|
||||
|
||||
UniValue GatewaysPartialSign(const CPubKey& pk, uint64_t txfee,uint256 lasttxid,std::string refcoin, std::string hex)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk,withdrawpub,signerpk,gatewayspk; struct CCcontract_info *cp,C; CTransaction tx,tmptx;
|
||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs; char funcid,depositaddr[64];
|
||||
int32_t numvouts; uint256 withdrawtxid,hashBlock,bindtxid,tokenid,oracletxid,tmptokenid; std::string coin,tmphex; int64_t amount,totalsupply;
|
||||
@@ -1130,7 +1133,7 @@ UniValue GatewaysPartialSign(const CPubKey& pk, uint64_t txfee,uint256 lasttxid,
|
||||
|
||||
UniValue GatewaysCompleteSigning(const CPubKey& pk, uint64_t txfee,uint256 lasttxid,std::string refcoin,std::string hex)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk,gatewayspk,signerpk,withdrawpub; struct CCcontract_info *cp,C; char funcid,depositaddr[64]; int64_t amount,totalsupply;
|
||||
std::string coin,tmphex; CTransaction tx,tmptx; uint256 withdrawtxid,hashBlock,tokenid,tmptokenid,bindtxid,oracletxid; int32_t numvouts;
|
||||
uint8_t K=0,M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> pubkeys;
|
||||
@@ -1184,7 +1187,7 @@ UniValue GatewaysCompleteSigning(const CPubKey& pk, uint64_t txfee,uint256 lastt
|
||||
|
||||
UniValue GatewaysMarkDone(const CPubKey& pk, uint64_t txfee,uint256 completetxid,std::string refcoin)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk; struct CCcontract_info *cp,C; char depositaddr[64]; CTransaction tx; int32_t numvouts;
|
||||
uint256 withdrawtxid,bindtxid,oracletxid,tokenid,tmptokenid,hashBlock; std::string coin,hex;
|
||||
uint8_t K,M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> pubkeys; int64_t amount,totalsupply; CPubKey withdrawpub;
|
||||
@@ -1496,7 +1499,7 @@ UniValue GatewaysDumpPrivKey(uint256 bindtxid,CKey key)
|
||||
|
||||
UniValue GatewaysInfo(uint256 bindtxid)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
UniValue result(UniValue::VOBJ),a(UniValue::VARR); std::string coin; char str[67],numstr[65],depositaddr[64],gatewaystokens[64];
|
||||
uint8_t M,N; std::vector<CPubKey> pubkeys; uint8_t taddr,prefix,prefix2,wiftype; uint256 tokenid,oracletxid,hashBlock; CTransaction tx;
|
||||
CPubKey Gatewayspk; struct CCcontract_info *cp,C; int32_t i; int64_t numvouts,totalsupply,remaining; std::vector<CPubKey> msigpubkeys;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -615,7 +618,7 @@ template <class Helper> int64_t LifetimeHeirContractFunds(struct CCcontract_info
|
||||
template <typename Helper> UniValue _HeirFund(int64_t txfee, int64_t amount, std::string heirName, CPubKey heirPubkey, int64_t inactivityTimeSec, std::string memo, uint256 tokenid)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ);
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
struct CCcontract_info *cp, C;
|
||||
|
||||
cp = CCinit(&C, Helper::getMyEval());
|
||||
@@ -722,7 +725,7 @@ UniValue HeirFundTokenCaller(int64_t txfee, int64_t satoshis, std::string heirNa
|
||||
template <class Helper> UniValue _HeirAdd(uint256 fundingtxid, int64_t txfee, int64_t amount, uint256 latesttxid, uint8_t funcId, uint256 tokenid, CPubKey ownerPubkey, CPubKey heirPubkey, int64_t inactivityTimeSec, uint8_t hasHeirSpendingBegun)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ);
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
struct CCcontract_info *cp, C;
|
||||
std::string rawhex;
|
||||
|
||||
@@ -887,7 +890,7 @@ UniValue HeirAddCaller(uint256 fundingtxid, int64_t txfee, std::string strAmount
|
||||
template <typename Helper>UniValue _HeirClaim(uint256 fundingtxid, int64_t txfee, int64_t amount, uint256 latesttxid, uint8_t funcId, uint256 tokenid, CPubKey ownerPubkey, CPubKey heirPubkey, int64_t inactivityTimeSec, uint8_t hasHeirSpendingBegun)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ);
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey myPubkey;
|
||||
int64_t inputs, change = 0;
|
||||
struct CCcontract_info *cp, C;
|
||||
@@ -1063,7 +1066,7 @@ UniValue HeirInfo(uint256 fundingtxid)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ);
|
||||
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CTransaction fundingtx;
|
||||
uint256 hashBlock;
|
||||
const bool allowSlow = false;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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
|
||||
#ifndef HEIR_VALIDATE_H
|
||||
#define HEIR_VALIDATE_H
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-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
|
||||
/******************************************************************************
|
||||
@@ -39,7 +39,7 @@
|
||||
extern std::string ASSETCHAINS_SELFIMPORT;
|
||||
extern uint16_t ASSETCHAINS_CODAPORT,ASSETCHAINS_BEAMPORT;
|
||||
extern uint8_t ASSETCHAINS_OVERRIDE_PUBKEY33[33];
|
||||
extern uint256 KOMODO_EARLYTXID;
|
||||
extern uint256 HUSH_EARLYTXID;
|
||||
|
||||
// utilities from gateways.cpp
|
||||
uint256 BitcoinGetProofMerkleRoot(const std::vector<uint8_t> &proofData, std::vector<uint256> &txids);
|
||||
@@ -82,7 +82,7 @@ CMutableTransaction MakeSelfImportSourceTx(CTxDestination &dest, int64_t amount)
|
||||
|
||||
cpDummy = CCinit(&C, EVAL_TOKENS); // this is just for FinalizeCCTx to work
|
||||
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
|
||||
if (AddNormalinputs(mtx, myPubKey, 2 * txfee, 4) == 0) {
|
||||
LOGSTREAM("importcoin", CCLOG_INFO, stream << "MakeSelfImportSourceTx() warning: cannot find normal inputs for txfee" << std::endl);
|
||||
@@ -129,7 +129,7 @@ int32_t GetSelfimportProof(const CMutableTransaction sourceMtx, CMutableTransact
|
||||
CMutableTransaction tmpmtx;
|
||||
//CTransaction sourcetx;
|
||||
|
||||
tmpmtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
tmpmtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
|
||||
/*
|
||||
if (!E_UNMARSHAL(ParseHex(rawsourcetx), ss >> sourcetx)) {
|
||||
@@ -203,7 +203,7 @@ int32_t GetSelfimportProof(const CMutableTransaction sourceMtx, CMutableTransact
|
||||
// make import tx with burntx and dual daemon
|
||||
std::string MakeCodaImportTx(uint64_t txfee, std::string receipt, std::string srcaddr, std::vector<CTxOut> vouts)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()),burntx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight()),burntx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk; uint256 codaburntxid; std::vector<unsigned char> dummyproof;
|
||||
int32_t i,numvouts,n,m; std::string coin,error; struct CCcontract_info *cp, C;
|
||||
cJSON *result,*tmp,*tmp1; unsigned char hash[SHA256_DIGEST_LENGTH+1];
|
||||
@@ -364,9 +364,9 @@ int32_t CheckGATEWAYimport(CTransaction importTx,CTransaction burnTx,std::string
|
||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||
|
||||
// ASSETCHAINS_SELFIMPORT is coin
|
||||
if (KOMODO_EARLYTXID!=zeroid && bindtxid!=KOMODO_EARLYTXID)
|
||||
if (HUSH_EARLYTXID!=zeroid && bindtxid!=HUSH_EARLYTXID)
|
||||
{
|
||||
LOGSTREAM("importgateway", CCLOG_INFO, stream << "CheckGATEWAYimport invalid import gateway. On this chain only valid import gateway is " << KOMODO_EARLYTXID.GetHex() << std::endl);
|
||||
LOGSTREAM("importgateway", CCLOG_INFO, stream << "CheckGATEWAYimport invalid import gateway. On this chain only valid import gateway is " << HUSH_EARLYTXID.GetHex() << std::endl);
|
||||
return(-1);
|
||||
}
|
||||
// check for valid burn from external coin blockchain and if valid return(0);
|
||||
@@ -705,7 +705,7 @@ bool Eval::ImportCoin(const std::vector<uint8_t> params, const CTransaction &imp
|
||||
// Check burntx shows correct outputs hash
|
||||
if (payoutsHash != SerializeHash(payouts))
|
||||
return Invalid("wrong-payouts");
|
||||
if (targetCcid < KOMODO_FIRSTFUNGIBLEID)
|
||||
if (targetCcid < HUSH_FIRSTFUNGIBLEID)
|
||||
return Invalid("chain-not-fungible");
|
||||
|
||||
if ( targetCcid != 0xffffffff )
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -25,7 +28,7 @@
|
||||
#define KMD_TADDR 0
|
||||
#define CC_MARKER_VALUE 10000
|
||||
|
||||
extern uint256 KOMODO_EARLYTXID;
|
||||
extern uint256 HUSH_EARLYTXID;
|
||||
|
||||
CScript EncodeImportGatewayBindOpRet(uint8_t funcid,std::string coin,uint256 oracletxid,uint8_t M,uint8_t N,std::vector<CPubKey> importgatewaypubkeys,uint8_t taddr,uint8_t prefix,uint8_t prefix2,uint8_t wiftype)
|
||||
{
|
||||
@@ -471,7 +474,7 @@ bool ImportGatewayValidate(struct CCcontract_info *cp,Eval *eval,const CTransact
|
||||
|
||||
std::string ImportGatewayBind(uint64_t txfee,std::string coin,uint256 oracletxid,uint8_t M,uint8_t N,std::vector<CPubKey> pubkeys,uint8_t p1,uint8_t p2,uint8_t p3,uint8_t p4)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CTransaction oracletx; uint8_t taddr,prefix,prefix2,wiftype; CPubKey mypk,importgatewaypk; CScript opret; uint256 hashBlock;
|
||||
struct CCcontract_info *cp,*cpTokens,C,CTokens; std::string name,description,format; int32_t i,numvouts;
|
||||
char destaddr[64],coinaddr[64],myTokenCCaddr[64],str[65],*fstr;
|
||||
@@ -562,14 +565,14 @@ std::string ImportGatewayBind(uint64_t txfee,std::string coin,uint256 oracletxid
|
||||
|
||||
std::string ImportGatewayDeposit(uint64_t txfee,uint256 bindtxid,int32_t height,std::string refcoin,uint256 burntxid,int32_t claimvout,std::string rawburntx,std::vector<uint8_t>proof,CPubKey destpub,int64_t amount)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()), burntx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight()), burntx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CTransaction bindtx; CPubKey mypk; uint256 oracletxid,merkleroot,mhash,hashBlock,txid; std::vector<CTxOut> vouts;
|
||||
int32_t i,m,n,numvouts; uint8_t M,N,taddr,prefix,prefix2,wiftype; std::string coin; struct CCcontract_info *cp,C;
|
||||
std::vector<CPubKey> pubkeys,publishers; std::vector<uint256> txids; char str[128],burnaddr[64];
|
||||
|
||||
if (KOMODO_EARLYTXID!=zeroid && bindtxid!=KOMODO_EARLYTXID)
|
||||
if (HUSH_EARLYTXID!=zeroid && bindtxid!=HUSH_EARLYTXID)
|
||||
{
|
||||
CCerror = strprintf("invalid import gateway. On this chain only valid import gateway is %s",KOMODO_EARLYTXID.GetHex());
|
||||
CCerror = strprintf("invalid import gateway. On this chain only valid import gateway is %s",HUSH_EARLYTXID.GetHex());
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
@@ -640,15 +643,15 @@ std::string ImportGatewayDeposit(uint64_t txfee,uint256 bindtxid,int32_t height,
|
||||
|
||||
std::string ImportGatewayWithdraw(uint64_t txfee,uint256 bindtxid,std::string refcoin,CPubKey withdrawpub,int64_t amount)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CTransaction tx; CPubKey mypk,importgatewaypk,signerpk; uint256 txid,hashBlock,oracletxid,tmptokenid,tmpbindtxid,withdrawtxid; int32_t vout,numvouts;
|
||||
int64_t nValue,inputs,CCchange=0,tmpamount; uint8_t funcid,K,M,N,taddr,prefix,prefix2,wiftype; std::string coin,hex;
|
||||
std::vector<CPubKey> msigpubkeys; char burnaddr[64],str[65],coinaddr[64]; struct CCcontract_info *cp,C;
|
||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||
|
||||
if (KOMODO_EARLYTXID!=zeroid && bindtxid!=KOMODO_EARLYTXID)
|
||||
if (HUSH_EARLYTXID!=zeroid && bindtxid!=HUSH_EARLYTXID)
|
||||
{
|
||||
CCerror = strprintf("invalid import gateway. On this chain only valid import gateway is %s",KOMODO_EARLYTXID.GetHex());
|
||||
CCerror = strprintf("invalid import gateway. On this chain only valid import gateway is %s",HUSH_EARLYTXID.GetHex());
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
@@ -718,7 +721,7 @@ std::string ImportGatewayWithdraw(uint64_t txfee,uint256 bindtxid,std::string re
|
||||
|
||||
std::string ImportGatewayPartialSign(uint64_t txfee,uint256 lasttxid,std::string refcoin, std::string hex)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk,withdrawpub,signerpk,importgatewaypk; struct CCcontract_info *cp,C; CTransaction tx,tmptx;
|
||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs; char funcid,str[65],burnaddr[64];
|
||||
int32_t numvouts; uint256 withdrawtxid,hashBlock,bindtxid,tokenid,oracletxid; std::string coin,tmphex; int64_t amount;
|
||||
@@ -745,9 +748,9 @@ std::string ImportGatewayPartialSign(uint64_t txfee,uint256 lasttxid,std::string
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (KOMODO_EARLYTXID!=zeroid && bindtxid!=KOMODO_EARLYTXID)
|
||||
else if (HUSH_EARLYTXID!=zeroid && bindtxid!=HUSH_EARLYTXID)
|
||||
{
|
||||
CCerror = strprintf("invalid import gateway. On this chain only valid import gateway is %s",KOMODO_EARLYTXID.GetHex());
|
||||
CCerror = strprintf("invalid import gateway. On this chain only valid import gateway is %s",HUSH_EARLYTXID.GetHex());
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
@@ -792,9 +795,9 @@ std::string ImportGatewayPartialSign(uint64_t txfee,uint256 lasttxid,std::string
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (KOMODO_EARLYTXID!=zeroid && bindtxid!=KOMODO_EARLYTXID)
|
||||
else if (HUSH_EARLYTXID!=zeroid && bindtxid!=HUSH_EARLYTXID)
|
||||
{
|
||||
CCerror = strprintf("invalid import gateway. On this chain only valid import gateway is %s",KOMODO_EARLYTXID.GetHex());
|
||||
CCerror = strprintf("invalid import gateway. On this chain only valid import gateway is %s",HUSH_EARLYTXID.GetHex());
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
@@ -831,7 +834,7 @@ std::string ImportGatewayPartialSign(uint64_t txfee,uint256 lasttxid,std::string
|
||||
|
||||
std::string ImportGatewayCompleteSigning(uint64_t txfee,uint256 lasttxid,std::string refcoin,std::string hex)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk,importgatewaypk,signerpk,withdrawpub; struct CCcontract_info *cp,C; char funcid,str[65],burnaddr[64]; int64_t amount;
|
||||
std::string coin,tmphex; CTransaction tx,tmptx; uint256 withdrawtxid,hashBlock,tokenid,bindtxid,oracletxid; int32_t numvouts;
|
||||
uint8_t K=0,M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> pubkeys;
|
||||
@@ -863,9 +866,9 @@ std::string ImportGatewayCompleteSigning(uint64_t txfee,uint256 lasttxid,std::st
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (KOMODO_EARLYTXID!=zeroid && bindtxid!=KOMODO_EARLYTXID)
|
||||
else if (HUSH_EARLYTXID!=zeroid && bindtxid!=HUSH_EARLYTXID)
|
||||
{
|
||||
CCerror = strprintf("invalid import gateway. On this chain only valid import gateway is %s",KOMODO_EARLYTXID.GetHex());
|
||||
CCerror = strprintf("invalid import gateway. On this chain only valid import gateway is %s",HUSH_EARLYTXID.GetHex());
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
@@ -909,9 +912,9 @@ std::string ImportGatewayCompleteSigning(uint64_t txfee,uint256 lasttxid,std::st
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (KOMODO_EARLYTXID!=zeroid && bindtxid!=KOMODO_EARLYTXID)
|
||||
else if (HUSH_EARLYTXID!=zeroid && bindtxid!=HUSH_EARLYTXID)
|
||||
{
|
||||
CCerror = strprintf("invalid import gateway. On this chain only valid import gateway is %s",KOMODO_EARLYTXID.GetHex());
|
||||
CCerror = strprintf("invalid import gateway. On this chain only valid import gateway is %s",HUSH_EARLYTXID.GetHex());
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
@@ -948,7 +951,7 @@ std::string ImportGatewayCompleteSigning(uint64_t txfee,uint256 lasttxid,std::st
|
||||
|
||||
std::string ImportGatewayMarkDone(uint64_t txfee,uint256 completetxid,std::string refcoin)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk; struct CCcontract_info *cp,C; char str[65],burnaddr[64]; CTransaction tx; int32_t numvouts;
|
||||
uint256 withdrawtxid,bindtxid,oracletxid,tokenid,hashBlock; std::string coin,hex;
|
||||
uint8_t K,M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> pubkeys; int64_t amount; CPubKey withdrawpub;
|
||||
@@ -987,9 +990,9 @@ std::string ImportGatewayMarkDone(uint64_t txfee,uint256 completetxid,std::strin
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (KOMODO_EARLYTXID!=zeroid && bindtxid!=KOMODO_EARLYTXID)
|
||||
else if (HUSH_EARLYTXID!=zeroid && bindtxid!=HUSH_EARLYTXID)
|
||||
{
|
||||
CCerror = strprintf("invalid import gateway. On this chain only valid import gateway is %s",KOMODO_EARLYTXID.GetHex());
|
||||
CCerror = strprintf("invalid import gateway. On this chain only valid import gateway is %s",HUSH_EARLYTXID.GetHex());
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
@@ -1242,7 +1245,7 @@ UniValue ImportGatewayDumpPrivKey(uint256 bindtxid,CKey key)
|
||||
|
||||
UniValue ImportGatewayInfo(uint256 bindtxid)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
UniValue result(UniValue::VOBJ),a(UniValue::VARR); std::string coin; char str[67],numstr[65],burnaddr[64],gatewaystokens[64];
|
||||
uint8_t M,N; std::vector<CPubKey> pubkeys; uint8_t taddr,prefix,prefix2,wiftype; uint256 oracletxid,hashBlock; CTransaction tx;
|
||||
CPubKey ImportGatewaypk; struct CCcontract_info *cp,C; int32_t i; int64_t numvouts,remaining; std::vector<CPubKey> msigpubkeys;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -79,8 +82,8 @@ bool Eval::ImportPayout(const std::vector<uint8_t> params, const CTransaction &i
|
||||
|
||||
// Check disputeTx solves momproof from vout[0]
|
||||
{
|
||||
NotarisationData data;
|
||||
if (!GetNotarisationData(proof.notarisationHash, data))
|
||||
NotarizationData data;
|
||||
if (!GetNotarizationData(proof.notarisationHash, data))
|
||||
return Invalid("coudnt-load-mom");
|
||||
|
||||
if (data.MoM != proof.Exec(disputeTx.GetHash()))
|
||||
|
||||
3
src/cc/includes/cJSON.h
Executable file → Normal file
3
src/cc/includes/cJSON.h
Executable file → Normal file
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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 (c) 2009 Dave Gamble
|
||||
|
||||
|
||||
3
src/cc/includes/curve25519.h
Executable file → Normal file
3
src/cc/includes/curve25519.h
Executable file → Normal file
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
|
||||
3
src/cc/includes/libgfshare.h
Executable file → Normal file
3
src/cc/includes/libgfshare.h
Executable file → Normal file
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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
|
||||
/*
|
||||
* This file is Copyright Daniel Silverstone <dsilvers@digital-scurf.org> 2006
|
||||
*
|
||||
|
||||
3
src/cc/includes/tweetnacl.h
Executable file → Normal file
3
src/cc/includes/tweetnacl.h
Executable file → Normal file
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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
|
||||
#ifndef TWEETNACL_H
|
||||
#define TWEETNACL_H
|
||||
#define crypto_auth_PRIMITIVE "hmacsha512256"
|
||||
|
||||
3
src/cc/includes/uthash.h
Executable file → Normal file
3
src/cc/includes/uthash.h
Executable file → Normal file
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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 (c) 2003-2014, Troy D. Hanson http://troydhanson.github.com/uthash/
|
||||
|
||||
3
src/cc/includes/utlist.h
Executable file → Normal file
3
src/cc/includes/utlist.h
Executable file → Normal file
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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 (c) 2007-2014, Troy D. Hanson http://troydhanson.github.com/uthash/
|
||||
All rights reserved.
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2016-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. *
|
||||
* *
|
||||
@@ -283,7 +286,7 @@ UniValue LottoList()
|
||||
|
||||
std::string LottoCreate(uint64_t txfee,char *planstr,int64_t funding,int32_t ticketsize,int32_t odds,int32_t firstheight,int32_t period)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
uint256 entropy,hentropy; CPubKey mypk,lottopk; uint64_t sbits; int64_t inputs,CCchange=0,nValue=COIN; struct CCcontract_info *cp,C;
|
||||
cp = CCinit(&C,EVAL_LOTTO);
|
||||
if ( txfee == 0 )
|
||||
@@ -302,7 +305,7 @@ std::string LottoCreate(uint64_t txfee,char *planstr,int64_t funding,int32_t tic
|
||||
|
||||
std::string LottoTicket(uint64_t txfee,uint256 lottoid,int64_t numtickets)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk,lottopk; CScript opret; int64_t inputs,CCchange=0,nValue=COIN; struct CCcontract_info *cp,C;
|
||||
cp = CCinit(&C,EVAL_LOTTO);
|
||||
if ( txfee == 0 )
|
||||
@@ -323,7 +326,7 @@ std::string LottoTicket(uint64_t txfee,uint256 lottoid,int64_t numtickets)
|
||||
|
||||
std::string LottoWinner(uint64_t txfee)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), hush_nextheight());
|
||||
CPubKey mypk,lottopk; int64_t winnings = 0; CScript opret; struct CCcontract_info *cp,C;
|
||||
cp = CCinit(&C,EVAL_LOTTO);
|
||||
if ( txfee == 0 )
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user