Remove Komodo interest code and various other improvements
This commit is contained in:
@@ -3,7 +3,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. *
|
||||
* *
|
||||
@@ -18,7 +17,6 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "clientversion.h"
|
||||
#include "rpc/server.h"
|
||||
#include "init.h"
|
||||
@@ -61,7 +59,6 @@ extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
|
||||
extern int32_t ASSETCHAINS_BLOCKTIME;
|
||||
extern uint64_t ASSETCHAINS_CBOPRET;
|
||||
void hush_passport_iteration();
|
||||
uint64_t komodo_interestsum();
|
||||
int32_t hush_longestchain();
|
||||
void komodo_cbopretupdate(int32_t forceflag);
|
||||
CBlockIndex *komodo_chainactive(int32_t height);
|
||||
@@ -90,7 +87,6 @@ void WaitForShutdown(boost::thread_group* threadGroup)
|
||||
MilliSleep(1000);
|
||||
}
|
||||
} else {
|
||||
//komodo_interestsum();
|
||||
//hush_longestchain();
|
||||
if ( ASSETCHAINS_CBOPRET != 0 )
|
||||
komodo_cbopretupdate(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-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. *
|
||||
* *
|
||||
|
||||
@@ -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. *
|
||||
* *
|
||||
|
||||
@@ -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. *
|
||||
* *
|
||||
|
||||
@@ -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. *
|
||||
* *
|
||||
|
||||
@@ -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-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. *
|
||||
* *
|
||||
|
||||
+4
-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
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -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 � 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
|
||||
/*Descriptson and examples of COptCCParams class found in:
|
||||
script/standard.h/cpp
|
||||
class COptCCParams
|
||||
|
||||
@@ -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. *
|
||||
* *
|
||||
|
||||
@@ -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
|
||||
/*
|
||||
simple stub custom cc
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
+55
-58
@@ -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. *
|
||||
* *
|
||||
|
||||
@@ -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-2020 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. *
|
||||
* *
|
||||
|
||||
+4
-2
@@ -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)))
|
||||
|
||||
|
||||
+13
-142
@@ -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. *
|
||||
* *
|
||||
|
||||
@@ -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,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. *
|
||||
* *
|
||||
|
||||
@@ -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. *
|
||||
* *
|
||||
|
||||
@@ -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. *
|
||||
* *
|
||||
|
||||
@@ -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. *
|
||||
|
||||
+7
-4
@@ -1,4 +1,7 @@
|
||||
// start https://github.com/attractivechaos/plb/blob/master/sudoku/incoming/sudoku_solver.c
|
||||
// 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
|
||||
// From https://github.com/attractivechaos/plb/blob/master/sudoku/incoming/sudoku_solver.c
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Author: Bill DuPree */
|
||||
@@ -192,10 +195,10 @@
|
||||
/* */
|
||||
/* CHANGE LOG: */
|
||||
/* */
|
||||
/* Rev. Date Init. Description */
|
||||
/* Rev. Date Init. Description */
|
||||
/* -------------------------------------------------------------------------------- */
|
||||
/* 1.00 2006-02-25 WD Initial version. */
|
||||
/* 1.01 2006-03-13 WD Fixed return code calc. Added signon message. */
|
||||
/* 1.00 2006-02-25 WD Initial version. */
|
||||
/* 1.01 2006-03-13 WD Fixed return code calc. Added signon message. */
|
||||
/* 1.10 2006-03-20 WD Added explain option, add'l speed optimizations */
|
||||
/* 1.11 2006-03-23 WD More simple speed optimizations, cleanup, bug fixes */
|
||||
/* */
|
||||
|
||||
+4
-4
@@ -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. *
|
||||
* *
|
||||
@@ -19,10 +22,7 @@
|
||||
#include "streams.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
/*
|
||||
* Serialisation boilerplate
|
||||
*/
|
||||
// Serialization boilerplate
|
||||
|
||||
template <class T>
|
||||
std::vector<uint8_t> SerializeF(const T f)
|
||||
|
||||
@@ -2,7 +2,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,7 +16,6 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "coins.h"
|
||||
#include "memusage.h"
|
||||
#include "random.h"
|
||||
@@ -26,7 +24,6 @@
|
||||
#include "hush_defs.h"
|
||||
#include "importcoin.h"
|
||||
#include <assert.h>
|
||||
|
||||
/**
|
||||
* calculate number of bytes for the bitmask, and its number of non-zero bytes
|
||||
* each bit in the bitmask represents the availability of one output, but the
|
||||
@@ -536,8 +533,6 @@ const CTxOut &CCoinsViewCache::GetOutputFor(const CTxIn& input) const
|
||||
return coins->vout[input.prevout.n];
|
||||
}
|
||||
|
||||
//uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime);
|
||||
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight);
|
||||
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
|
||||
|
||||
const CScript &CCoinsViewCache::GetSpendFor(const CCoins *coins, const CTxIn& input)
|
||||
@@ -570,20 +565,6 @@ CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTr
|
||||
}
|
||||
value = GetOutputFor(tx.vin[i]).nValue;
|
||||
nResult += value;
|
||||
#ifdef KOMODO_ENABLE_INTEREST
|
||||
if ( SMART_CHAIN_SYMBOL[0] == 0 && nHeight >= 60000 )
|
||||
{
|
||||
if ( value >= 10*COIN )
|
||||
{
|
||||
int64_t interest; int32_t txheight; uint32_t locktime;
|
||||
interest = komodo_accrued_interest(&txheight,&locktime,tx.vin[i].prevout.hash,tx.vin[i].prevout.n,0,value,(int32_t)nHeight);
|
||||
//printf("nResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nResult/COIN,(double)value/COIN,(double)interest/COIN,txheight,locktime,tiptime);
|
||||
//fprintf(stderr,"nResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nResult/COIN,(double)value/COIN,(double)interest/COIN,txheight,locktime,tiptime);
|
||||
nResult += interest;
|
||||
(*interestp) += interest;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
nResult += tx.GetShieldedValueIn();
|
||||
|
||||
|
||||
@@ -3,7 +3,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. *
|
||||
* *
|
||||
@@ -18,12 +17,8 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef HUSH_COINS_H
|
||||
#define HUSH_COINS_H
|
||||
|
||||
#define KOMODO_ENABLE_INTEREST //enabling this is a hardfork, activate with new RR method
|
||||
|
||||
#include "compressor.h"
|
||||
#include "core_memusage.h"
|
||||
#include "memusage.h"
|
||||
@@ -31,12 +26,10 @@
|
||||
#include "uint256.h"
|
||||
#include "base58.h"
|
||||
#include "pubkey.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include "zcash/IncrementalMerkleTree.hpp"
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
./komodod -ac_name=CTEST -ac_supply=1000000 -ac_perc=100000 -ac_pubkey=02ebc786cb83de8dc3922ab83c21f3f8a2f3216940c3bf9da43ce39e2a3a882c92 -ac_reward=300000000 -addnode=136.243.58.134 &
|
||||
+1
-2
@@ -47,7 +47,6 @@ bool check_pprevnotarizedht();
|
||||
#include "komodo_curve25519.h"
|
||||
#include "komodo_cJSON.c"
|
||||
#include "hush_bitcoind.h"
|
||||
#include "komodo_interest.h"
|
||||
#include "komodo_pax.h"
|
||||
#include "hush_notary.h"
|
||||
|
||||
@@ -805,7 +804,7 @@ int32_t komodo_notarycmp(uint8_t *scriptPubKey,int32_t scriptlen,uint8_t pubkeys
|
||||
return(-1);
|
||||
}
|
||||
|
||||
// Connect a Hush Block
|
||||
// Connect a Hush Block, foshizzle
|
||||
int32_t hush_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
|
||||
{
|
||||
static int32_t hwmheight;
|
||||
|
||||
@@ -563,7 +563,6 @@ int32_t komodo_nextheight();
|
||||
uint32_t komodo_heightstamp(int32_t height);
|
||||
int64_t komodo_pricemult(int32_t ind);
|
||||
int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblocks);
|
||||
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight);
|
||||
int32_t komodo_currentheight();
|
||||
int32_t komodo_notarized_bracket(struct notarized_checkpoint *nps[2],int32_t height);
|
||||
arith_uint256 komodo_adaptivepow_target(int32_t height,arith_uint256 bnTarget,uint32_t nTime);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
# 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
|
||||
|
||||
# set working directory to the location of this script
|
||||
# readlink -f does not always exist
|
||||
@@ -14,7 +16,8 @@ NAME=HUSH3
|
||||
# this corresponds to FR address RHushEyeDm7XwtaTWtyCbjGQumYyV8vMjn
|
||||
SCRIPT=76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac
|
||||
|
||||
# First Pure Sapling Zcash Protocol chain!
|
||||
# Hush was and will always be:
|
||||
# The First Pure Sapling Zcash Protocol chain!
|
||||
SAPLING=1
|
||||
|
||||
# We use 3 "eras" of different supply curves
|
||||
@@ -68,8 +71,8 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
# jl777 disgraced his village and so Duke The Elder journeys on
|
||||
# with the True Cypherpunks
|
||||
# jl777 dishonored his village and so Duke The Elder journeys on
|
||||
# with the True Extreme Privacy Cypherpunks
|
||||
$KMD -ac_name=$NAME \
|
||||
-ac_sapling=$SAPLING \
|
||||
-ac_reward=$REWARD \
|
||||
|
||||
+24
-15
@@ -1,15 +1,23 @@
|
||||
#!/bin/bash
|
||||
# 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
|
||||
|
||||
# set working directory to the location of this script
|
||||
DIR="$( cd "$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" && pwd )"
|
||||
cd $DIR
|
||||
DIR="$( cd "$( dirname "$( readlink "${BASH_SOURCE[0]}" )" )" && pwd )"
|
||||
cd $DIR
|
||||
|
||||
# TESTING VALUES, DO NOT USE EXCEPT FOR DEVELOPMENT
|
||||
NAME=HUSH3T
|
||||
# this corresponds to FR address RHushEyeDm7XwtaTWtyCbjGQumYyV8vMjn
|
||||
SCRIPT=76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac
|
||||
|
||||
# Hush was and will always be:
|
||||
# The First Pure Sapling Zcash Protocol chain!
|
||||
SAPLING=1
|
||||
|
||||
# Chain parameters
|
||||
ERAS=3
|
||||
BLOCKTIME=150
|
||||
@@ -32,20 +40,21 @@ ORACLE=236
|
||||
GATEWAY=241
|
||||
CCENABLE=$FAUCET,$HEIR,$CHANNEL,$ORACLE,$GATEWAY
|
||||
|
||||
#NOTE: This is not compatible with upstream KMD komodod,
|
||||
# but you can reuse one hush3 komodod binary in various
|
||||
# directories/repos on one server, to save disk space
|
||||
# jl777 dishonored his village and so Duke The Elder journeys on
|
||||
# with the True Extreme Privacy Cypherpunks
|
||||
KMD=${KOMODOD:-./komodod}
|
||||
$KMD -ac_name=$NAME -ac_sapling=1 \
|
||||
-ac_reward=$REWARD \
|
||||
-ac_halving=$HALVING \
|
||||
-ac_end=$END \
|
||||
-ac_eras=$ERAS \
|
||||
-ac_blocktime=$BLOCKTIME \
|
||||
-ac_cc=2 -ac_ccenable=$CCENABLE \
|
||||
-ac_founders=$FOUNDERS -ac_supply=$SUPPLY \
|
||||
-ac_perc=$PERC \
|
||||
-clientname=$CLIENTNAME \
|
||||
-addnode=$SEEDNODE \
|
||||
-ac_cclib=$CCLIB \
|
||||
$KMD -ac_name=$NAME \
|
||||
-ac_sapling=$SAPLING \
|
||||
-ac_reward=$REWARD \
|
||||
-ac_halving=$HALVING \
|
||||
-ac_end=$END \
|
||||
-ac_eras=$ERAS \
|
||||
-ac_blocktime=$BLOCKTIME \
|
||||
-ac_cc=2 \
|
||||
-ac_ccenable=$CCENABLE \
|
||||
-ac_founders=$FOUNDERS \
|
||||
-ac_supply=$SUPPLY \
|
||||
-ac_perc=$PERC \
|
||||
-clientname=$CLIENTNAME \
|
||||
-ac_cclib=$CCLIB \
|
||||
-ac_script=$SCRIPT "$@"
|
||||
|
||||
@@ -41,14 +41,9 @@ using namespace std;
|
||||
#include "hush_structs.h"
|
||||
#include "hush_globals.h"
|
||||
#include "hush_defs.h"
|
||||
#include "komodo_interest.h"
|
||||
|
||||
CKey NSPV_key;
|
||||
char NSPV_pubkeystr[67],NSPV_wifstr[64];
|
||||
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
static bool fCreateBlank;
|
||||
static std::map<std::string,UniValue> registers;
|
||||
|
||||
@@ -1422,8 +1422,6 @@ int32_t hush_faststateinit(struct hush_state *sp,char *fname,char *symbol,char *
|
||||
return(-1);
|
||||
}
|
||||
|
||||
uint64_t komodo_interestsum();
|
||||
|
||||
void hush_passport_iteration()
|
||||
{
|
||||
static long lastpos[34]; static char userpass[33][1024]; static uint32_t lasttime,callcounter,lastinterest;
|
||||
@@ -1437,9 +1435,6 @@ void hush_passport_iteration()
|
||||
}
|
||||
if ( komodo_chainactive_timestamp() > lastinterest )
|
||||
{
|
||||
if ( SMART_CHAIN_SYMBOL[0] == 0 )
|
||||
komodo_interestsum();
|
||||
//hush_longestchain();
|
||||
lastinterest = komodo_chainactive_timestamp();
|
||||
}
|
||||
refsp = hush_stateptr(symbol,dest);
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// 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. *
|
||||
* *
|
||||
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
|
||||
* the top-level directory of this distribution for the individual copyright *
|
||||
* holder information and the developer policies on copyright and licensing. *
|
||||
* *
|
||||
* Unless otherwise agreed in a custom licensing agreement, no part of the *
|
||||
* SuperNET software, including this file may be copied, modified, propagated *
|
||||
* or distributed except according to the terms contained in the LICENSE file *
|
||||
* *
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "hush_defs.h"
|
||||
|
||||
uint64_t _komodo_interestnew(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t komodo_interestnew(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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. *
|
||||
* *
|
||||
@@ -13,7 +15,6 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef HUSH_NSPVFULLNODE_H
|
||||
#define HUSH_NSPVFULLNODE_H
|
||||
|
||||
@@ -185,11 +186,6 @@ int32_t NSPV_getaddressutxos(struct NSPV_utxosresp *ptr,char *coinaddr,bool isCC
|
||||
ptr->utxos[ind].vout = (int32_t)it->first.index;
|
||||
ptr->utxos[ind].satoshis = it->second.satoshis;
|
||||
ptr->utxos[ind].height = it->second.blockHeight;
|
||||
if ( SMART_CHAIN_SYMBOL[0] == 0 && it->second.satoshis >= 10*COIN )
|
||||
{
|
||||
ptr->utxos[n].extradata = komodo_accrued_interest(&txheight,&locktime,ptr->utxos[ind].txid,ptr->utxos[ind].vout,ptr->utxos[ind].height,ptr->utxos[ind].satoshis,tipheight);
|
||||
interest += ptr->utxos[ind].extradata;
|
||||
}
|
||||
ind++;
|
||||
total += it->second.satoshis;
|
||||
}
|
||||
|
||||
@@ -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. *
|
||||
* *
|
||||
@@ -13,11 +15,10 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef HUSH_NSPVWALLET_H
|
||||
#define HUSH_NSPVWALLET_H
|
||||
|
||||
// nSPV wallet uses superlite functions (and some komodod built in functions) to implement nSPV_spend
|
||||
// nSPV wallet uses superlite functions (and some hushd built in functions) to implement nSPV_spend
|
||||
extern void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry);
|
||||
|
||||
int32_t NSPV_validatehdrs(struct NSPV_ntzsproofresp *ptr)
|
||||
@@ -83,13 +84,7 @@ int32_t NSPV_gettransaction(int32_t skipvalidation,int32_t vout,uint256 txid,int
|
||||
retval = -2001;
|
||||
else if ( skipvalidation == 0 && ptr->unspentvalue <= 0 )
|
||||
retval = -2002;
|
||||
else if ( SMART_CHAIN_SYMBOL[0] == 0 && tiptime != 0 )
|
||||
{
|
||||
rewards = komodo_interestnew(height,tx.vout[vout].nValue,tx.nLockTime,tiptime);
|
||||
if ( rewards != extradata )
|
||||
fprintf(stderr,"extradata %.8f vs rewards %.8f\n",dstr(extradata),dstr(rewards));
|
||||
rewardsum += rewards;
|
||||
}
|
||||
|
||||
//char coinaddr[64];
|
||||
//Getscriptaddress(coinaddr,tx.vout[0].scriptPubKey); causes crash??
|
||||
//fprintf(stderr,"%s txid.%s vs hash.%s\n",coinaddr,txid.GetHex().c_str(),tx.GetHash().GetHex().c_str());
|
||||
|
||||
+9
-26
@@ -2671,20 +2671,6 @@ namespace Consensus {
|
||||
|
||||
// Check for negative or overflow input values
|
||||
nValueIn += coins->vout[prevout.n].nValue;
|
||||
#ifdef KOMODO_ENABLE_INTEREST
|
||||
if ( SMART_CHAIN_SYMBOL[0] == 0 && nSpendHeight > 60000 )//chainActive.LastTip() != 0 && chainActive.LastTip()->GetHeight() >= 60000 )
|
||||
{
|
||||
if ( coins->vout[prevout.n].nValue >= 10*COIN )
|
||||
{
|
||||
int64_t interest; int32_t txheight; uint32_t locktime;
|
||||
if ( (interest= komodo_accrued_interest(&txheight,&locktime,prevout.hash,prevout.n,0,coins->vout[prevout.n].nValue,(int32_t)nSpendHeight-1)) != 0 )
|
||||
{
|
||||
//fprintf(stderr,"checkResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nValueIn/COIN,(double)coins->vout[prevout.n].nValue/COIN,(double)interest/COIN,txheight,locktime,chainActive.LastTip()->nTime);
|
||||
nValueIn += interest;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!MoneyRange(coins->vout[prevout.n].nValue) || !MoneyRange(nValueIn))
|
||||
return state.DoS(100, error("CheckInputs(): txin values out of range"),
|
||||
REJECT_INVALID, "bad-txns-inputvalues-outofrange");
|
||||
@@ -5096,18 +5082,15 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
|
||||
// Size limits
|
||||
//fprintf(stderr,"%s checkblock %d -> %d vs blocksize.%d\n",SMART_CHAIN_SYMBOL,height,MAX_BLOCK_SIZE(height),(int32_t)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION));
|
||||
if (block.vtx.empty() || block.vtx.size() > MAX_BLOCK_SIZE(height) || ::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE(height))
|
||||
return state.DoS(100, error("CheckBlock: size limits failed"),
|
||||
REJECT_INVALID, "bad-blk-length");
|
||||
return state.DoS(100, error("CheckBlock: size limits failed"), REJECT_INVALID, "bad-blk-length");
|
||||
|
||||
// First transaction must be coinbase, the rest must not be
|
||||
if (block.vtx.empty() || !block.vtx[0].IsCoinBase())
|
||||
return state.DoS(100, error("CheckBlock: first tx is not coinbase"),
|
||||
REJECT_INVALID, "bad-cb-missing");
|
||||
return state.DoS(100, error("CheckBlock: first tx is not coinbase"), REJECT_INVALID, "bad-cb-missing");
|
||||
|
||||
for (unsigned int i = 1; i < block.vtx.size(); i++)
|
||||
if (block.vtx[i].IsCoinBase())
|
||||
return state.DoS(100, error("CheckBlock: more than one coinbase"),
|
||||
REJECT_INVALID, "bad-cb-multiple");
|
||||
return state.DoS(100, error("CheckBlock: more than one coinbase"), REJECT_INVALID, "bad-cb-multiple");
|
||||
|
||||
// Check transactions
|
||||
CTransaction sTx;
|
||||
@@ -5115,7 +5098,9 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
|
||||
if ( ASSETCHAINS_CC != 0 && !fCheckPOW )
|
||||
return true;
|
||||
|
||||
if ( ASSETCHAINS_CC != 0 ) // CC contracts might refer to transactions in the current block, from a CC spend within the same block and out of order
|
||||
/*
|
||||
bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
|
||||
if (ASSETCHAINS_CC != 0 ) // CC contracts might refer to transactions in the current block, from a CC spend within the same block and out of order
|
||||
{
|
||||
int32_t i,j,rejects=0,lastrejects=0;
|
||||
//fprintf(stderr,"put block's tx into mempool\n");
|
||||
@@ -5174,15 +5159,11 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
|
||||
}
|
||||
//fprintf(stderr,"done putting block's tx into mempool\n");
|
||||
}
|
||||
*/
|
||||
|
||||
for (uint32_t i = 0; i < block.vtx.size(); i++)
|
||||
{
|
||||
const CTransaction& tx = block.vtx[i];
|
||||
if ( komodo_validate_interest(tx,height == 0 ? hush_block2height((CBlock *)&block) : height,block.nTime,0) < 0 )
|
||||
{
|
||||
fprintf(stderr, "validate intrest failed for txnum.%i tx.%s\n", i, tx.ToString().c_str());
|
||||
return error("CheckBlock: komodo_validate_interest failed");
|
||||
}
|
||||
if (!CheckTransaction(tiptime,tx, state, verifier, i, (int32_t)block.vtx.size()))
|
||||
return error("CheckBlock: CheckTransaction failed");
|
||||
}
|
||||
@@ -5195,6 +5176,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
|
||||
if (nSigOps > MAX_BLOCK_SIGOPS)
|
||||
return state.DoS(100, error("CheckBlock: out-of-bounds SigOpCount"),
|
||||
REJECT_INVALID, "bad-blk-sigops", true);
|
||||
/*
|
||||
if ( fCheckPOW && komodo_check_deposit(height,block,(pindex==0||pindex->pprev==0)?0:pindex->pprev->nTime) < 0 )
|
||||
{
|
||||
//static uint32_t counter;
|
||||
@@ -5218,6 +5200,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
|
||||
// empty the temp mempool for next time.
|
||||
tmpmempool.clear();
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,6 @@ int32_t hush_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,ui
|
||||
int32_t komodo_pax_opreturn(int32_t height,uint8_t *opret,int32_t maxsize);
|
||||
int32_t komodo_baseid(char *origbase);
|
||||
int32_t hush_longestchain();
|
||||
int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_t nTime,int32_t dispflag);
|
||||
int64_t komodo_block_unlocktime(uint32_t nHeight);
|
||||
uint64_t the_commission(const CBlock *block,int32_t height);
|
||||
int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33, void *ptr);
|
||||
@@ -292,14 +291,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
txvalue = tx.GetValueOut();
|
||||
if ( KOMODO_VALUETOOBIG(txvalue) != 0 )
|
||||
continue;
|
||||
//if ( KOMODO_VALUETOOBIG(txvalue + voutsum) != 0 ) // has been commented from main.cpp ?
|
||||
// continue;
|
||||
//voutsum += txvalue;
|
||||
if ( SMART_CHAIN_SYMBOL[0] == 0 && komodo_validate_interest(tx,nHeight,(uint32_t)pblock->nTime,0) < 0 )
|
||||
{
|
||||
//fprintf(stderr,"CreateNewBlock: komodo_validate_interest failure nHeight.%d nTime.%u vs locktime.%u\n",nHeight,(uint32_t)pblock->nTime,(uint32_t)tx.nLockTime);
|
||||
continue;
|
||||
}
|
||||
|
||||
COrphan* porphan = NULL;
|
||||
double dPriority = 0;
|
||||
|
||||
@@ -1487,9 +1487,6 @@ UniValue gettxout(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
ret.push_back(Pair("rawconfirmations", pindex->GetHeight() - coins.nHeight + 1));
|
||||
}
|
||||
ret.push_back(Pair("value", ValueFromAmount(coins.vout[n].nValue)));
|
||||
uint64_t interest; int32_t txheight; uint32_t locktime;
|
||||
if ( (interest= komodo_accrued_interest(&txheight,&locktime,hash,n,coins.nHeight,coins.vout[n].nValue,(int32_t)pindex->GetHeight())) != 0 )
|
||||
ret.push_back(Pair("interest", ValueFromAmount(interest)));
|
||||
UniValue o(UniValue::VOBJ);
|
||||
ScriptPubKeyToJSON(coins.vout[n].scriptPubKey, o, true);
|
||||
ret.push_back(Pair("scriptPubKey", o));
|
||||
|
||||
+3
-5
@@ -3,7 +3,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. *
|
||||
* *
|
||||
@@ -18,7 +17,6 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "amount.h"
|
||||
#include "chainparams.h"
|
||||
#include "consensus/consensus.h"
|
||||
@@ -214,7 +212,7 @@ UniValue generate(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Wallet disabled and -mineraddress not set");
|
||||
}
|
||||
#else
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "komodod compiled without wallet and -mineraddress not set");
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "hushd compiled without wallet and -mineraddress not set");
|
||||
#endif
|
||||
}
|
||||
if (!Params().MineBlocksOnDemand())
|
||||
@@ -345,7 +343,7 @@ UniValue setgenerate(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Wallet disabled and -mineraddress not set");
|
||||
}
|
||||
#else
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "komodod compiled without wallet and -mineraddress not set");
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "hushd compiled without wallet and -mineraddress not set");
|
||||
#endif
|
||||
}
|
||||
if (Params().MineBlocksOnDemand())
|
||||
@@ -605,7 +603,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp, const CPubKey& myp
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Wallet disabled and -mineraddress not set");
|
||||
}
|
||||
#else
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "komodod compiled without wallet and -mineraddress not set");
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "hushd compiled without wallet and -mineraddress not set");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -37,6 +37,7 @@
|
||||
#include <boost/assign/list_of.hpp>
|
||||
#include <univalue.h>
|
||||
#include "zcash/Address.hpp"
|
||||
#include "build.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -54,7 +55,6 @@ using namespace std;
|
||||
* Or alternatively, create a specific query method for the information.
|
||||
**/
|
||||
|
||||
uint64_t komodo_interestsum();
|
||||
int32_t hush_longestchain();
|
||||
int32_t hush_notarized_height(int32_t *prevMoMheightp,uint256 *hashp,uint256 *txidp);
|
||||
bool komodo_txnotarizedconfirmed(uint256 txid);
|
||||
@@ -275,6 +275,7 @@ UniValue getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
#endif
|
||||
obj.push_back(Pair("sapling", ASSETCHAINS_SAPLING));
|
||||
}
|
||||
obj.push_back(Pair("build_date", BUILD_DATE));
|
||||
obj.push_back(Pair("timeoffset", 0));
|
||||
obj.push_back(Pair("connections", (int)vNodes.size()));
|
||||
obj.push_back(Pair("tls_connections", (int)std::count_if(vNodes.begin(), vNodes.end(), [](CNode* n) {return n->ssl != NULL;})));
|
||||
|
||||
@@ -3,7 +3,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. *
|
||||
* *
|
||||
@@ -18,7 +17,6 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "consensus/upgrades.h"
|
||||
#include "consensus/validation.h"
|
||||
#include "core_io.h"
|
||||
@@ -85,8 +83,6 @@ void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fInclud
|
||||
out.push_back(Pair("addresses", a));
|
||||
}
|
||||
|
||||
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight);
|
||||
|
||||
UniValue TxShieldedSpendsToJSON(const CTransaction& tx) {
|
||||
UniValue vdesc(UniValue::VARR);
|
||||
for (const SpendDescription& spendDesc : tx.vShieldedSpend) {
|
||||
@@ -217,13 +213,7 @@ void TxToJSONExpanded(const CTransaction& tx, const uint256 hashBlock, UniValue&
|
||||
const CTxOut& txout = tx.vout[i];
|
||||
UniValue out(UniValue::VOBJ);
|
||||
out.push_back(Pair("value", ValueFromAmount(txout.nValue)));
|
||||
if ( SMART_CHAIN_SYMBOL[0] == 0 && pindex != 0 && tx.nLockTime >= 500000000 && (tipindex= chainActive.LastTip()) != 0 )
|
||||
{
|
||||
int64_t interest; int32_t txheight; uint32_t locktime;
|
||||
interest = komodo_accrued_interest(&txheight,&locktime,tx.GetHash(),i,0,txout.nValue,(int32_t)tipindex->GetHeight());
|
||||
out.push_back(Pair("interest", ValueFromAmount(interest)));
|
||||
}
|
||||
out.push_back(Pair("valueSat", txout.nValue)); // [+] Decker
|
||||
out.push_back(Pair("valueSat", txout.nValue));
|
||||
out.push_back(Pair("n", (int64_t)i));
|
||||
UniValue o(UniValue::VOBJ);
|
||||
ScriptPubKeyToJSON(txout.scriptPubKey, o, true);
|
||||
@@ -316,12 +306,6 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
|
||||
const CTxOut& txout = tx.vout[i];
|
||||
UniValue out(UniValue::VOBJ);
|
||||
out.push_back(Pair("value", ValueFromAmount(txout.nValue)));
|
||||
if ( HUSH_NSPV_FULLNODE && SMART_CHAIN_SYMBOL[0] == 0 && tx.nLockTime >= 500000000 && (tipindex= chainActive.LastTip()) != 0 )
|
||||
{
|
||||
int64_t interest; int32_t txheight; uint32_t locktime;
|
||||
interest = komodo_accrued_interest(&txheight,&locktime,tx.GetHash(),i,0,txout.nValue,(int32_t)tipindex->GetHeight());
|
||||
out.push_back(Pair("interest", ValueFromAmount(interest)));
|
||||
}
|
||||
out.push_back(Pair("valueZat", txout.nValue));
|
||||
out.push_back(Pair("n", (int64_t)i));
|
||||
UniValue o(UniValue::VOBJ);
|
||||
|
||||
+1
-7
@@ -3,7 +3,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. *
|
||||
* *
|
||||
@@ -18,9 +17,7 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "rpc/server.h"
|
||||
|
||||
#include "init.h"
|
||||
#include "key_io.h"
|
||||
#include "random.h"
|
||||
@@ -29,11 +26,8 @@
|
||||
#include "util.h"
|
||||
#include "utilstrencodings.h"
|
||||
#include "asyncrpcqueue.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <univalue.h>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
@@ -889,7 +883,7 @@ std::string HelpExampleRpc(const std::string& methodname, const std::string& arg
|
||||
|
||||
string experimentalDisabledHelpMsg(const string& rpc, const string& enableArg)
|
||||
{
|
||||
string daemon = SMART_CHAIN_SYMBOL[0] == 0 ? "komodod" : "hushd";
|
||||
string daemon = "hushd";
|
||||
string ticker = SMART_CHAIN_SYMBOL[0] == 0 ? "komodo" : SMART_CHAIN_SYMBOL;
|
||||
|
||||
return "\nWARNING: " + rpc + " is disabled.\n"
|
||||
|
||||
+3
-8
@@ -1,10 +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. *
|
||||
* *
|
||||
@@ -19,9 +17,7 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "txmempool.h"
|
||||
|
||||
#include "clientversion.h"
|
||||
#include "consensus/consensus.h"
|
||||
#include "consensus/validation.h"
|
||||
@@ -510,7 +506,6 @@ void CTxMemPool::removeConflicts(const CTransaction &tx, std::list<CTransaction>
|
||||
}
|
||||
}
|
||||
|
||||
int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_t nTime,int32_t dispflag);
|
||||
extern char SMART_CHAIN_SYMBOL[];
|
||||
|
||||
std::vector<uint256> CTxMemPool::removeExpired(unsigned int nBlockHeight)
|
||||
@@ -524,6 +519,7 @@ std::vector<uint256> CTxMemPool::removeExpired(unsigned int nBlockHeight)
|
||||
const CTransaction& tx = it->GetTx();
|
||||
tipindex = chainActive.LastTip();
|
||||
|
||||
/*
|
||||
bool fInterestNotValidated = SMART_CHAIN_SYMBOL[0] == 0 && tipindex != 0 && komodo_validate_interest(tx,tipindex->GetHeight()+1,tipindex->GetMedianTimePast() + 777,0) < 0;
|
||||
if (IsExpiredTx(tx, nBlockHeight) || fInterestNotValidated)
|
||||
{
|
||||
@@ -531,6 +527,7 @@ std::vector<uint256> CTxMemPool::removeExpired(unsigned int nBlockHeight)
|
||||
LogPrintf("Removing interest violate txid.%s nHeight.%d nTime.%u vs locktime.%u\n",tx.GetHash().ToString(),tipindex->GetHeight()+1,tipindex->GetMedianTimePast() + 777,tx.nLockTime);
|
||||
transactionsToRemove.push_back(tx);
|
||||
}
|
||||
*/
|
||||
}
|
||||
std::vector<uint256> ids;
|
||||
for (const CTransaction& tx : transactionsToRemove) {
|
||||
@@ -542,9 +539,7 @@ std::vector<uint256> CTxMemPool::removeExpired(unsigned int nBlockHeight)
|
||||
return ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a block is connected. Removes from mempool and updates the miner fee estimator.
|
||||
*/
|
||||
// Called when a block is connected. Removes from mempool and updates the miner fee estimator.
|
||||
void CTxMemPool::removeForBlock(const std::vector<CTransaction>& vtx, unsigned int nBlockHeight,
|
||||
std::list<CTransaction>& conflicts, bool fCurrentEstimate)
|
||||
{
|
||||
|
||||
+23
-72
@@ -130,11 +130,8 @@ void Unlock2NSPV(const CPubKey &pk)
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight);
|
||||
|
||||
void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry)
|
||||
{
|
||||
//int32_t i,n,txheight; uint32_t locktime; uint64_t interest = 0;
|
||||
int confirms = wtx.GetDepthInMainChain();
|
||||
entry.push_back(Pair("rawconfirmations", confirms));
|
||||
if (wtx.IsCoinBase())
|
||||
@@ -976,11 +973,11 @@ UniValue getreceivedbyaddress(const UniValue& params, bool fHelp, const CPubKey&
|
||||
int nHeight = tx_height(wtx.GetHash());
|
||||
int dpowconfs = hush_dpowconfs(nHeight, nDepth);
|
||||
if (dpowconfs >= nMinDepth) {
|
||||
nAmount += txout.nValue; // komodo_interest?
|
||||
nAmount += txout.nValue;
|
||||
}
|
||||
} else {
|
||||
if (nDepth >= nMinDepth) {
|
||||
nAmount += txout.nValue; // komodo_interest?
|
||||
nAmount += txout.nValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1039,7 +1036,7 @@ UniValue getreceivedbyaccount(const UniValue& params, bool fHelp, const CPubKey&
|
||||
CTxDestination address;
|
||||
if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*pwalletMain, address) && setAddress.count(address))
|
||||
if (wtx.GetDepthInMainChain() >= nMinDepth)
|
||||
nAmount += txout.nValue; // komodo_interest?
|
||||
nAmount += txout.nValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1660,7 +1657,7 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts)
|
||||
continue;
|
||||
|
||||
tallyitem& item = mapTally[address];
|
||||
item.nAmount += txout.nValue; // komodo_interest?
|
||||
item.nAmount += txout.nValue;
|
||||
item.nConf = min(item.nConf, nDepth);
|
||||
item.nHeight = komodo_blockheight(wtx.hashBlock);
|
||||
item.txids.push_back(wtx.GetHash());
|
||||
@@ -2967,13 +2964,7 @@ UniValue listunspent(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
{
|
||||
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
|
||||
CBlockIndex *tipindex,*pindex = it->second;
|
||||
uint64_t interest; uint32_t locktime;
|
||||
if ( pindex != 0 && (tipindex= chainActive.LastTip()) != 0 )
|
||||
{
|
||||
interest = komodo_accrued_interest(&txheight,&locktime,out.tx->GetHash(),out.i,0,nValue,(int32_t)tipindex->GetHeight());
|
||||
//interest = komodo_interest(txheight,nValue,out.tx->nLockTime,tipindex->nTime);
|
||||
entry.push_back(Pair("interest",ValueFromAmount(interest)));
|
||||
}
|
||||
uint32_t locktime;
|
||||
//fprintf(stderr,"nValue %.8f pindex.%p tipindex.%p locktime.%u txheight.%d pindexht.%d\n",(double)nValue/COIN,pindex,chainActive.LastTip(),locktime,txheight,pindex->GetHeight());
|
||||
}
|
||||
else if ( chainActive.LastTip() != 0 )
|
||||
@@ -2987,42 +2978,7 @@ UniValue listunspent(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
return results;
|
||||
}
|
||||
|
||||
uint64_t komodo_interestsum()
|
||||
{
|
||||
#ifdef ENABLE_WALLET
|
||||
if ( SMART_CHAIN_SYMBOL[0] == 0 && GetBoolArg("-disablewallet", false) == 0 && HUSH_NSPV_FULLNODE )
|
||||
{
|
||||
uint64_t interest,sum = 0; int32_t txheight; uint32_t locktime;
|
||||
vector<COutput> vecOutputs;
|
||||
assert(pwalletMain != NULL);
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
pwalletMain->AvailableCoins(vecOutputs, false, NULL, true);
|
||||
BOOST_FOREACH(const COutput& out,vecOutputs)
|
||||
{
|
||||
CAmount nValue = out.tx->vout[out.i].nValue;
|
||||
if ( out.tx->nLockTime != 0 && out.fSpendable != 0 )
|
||||
{
|
||||
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
|
||||
CBlockIndex *tipindex,*pindex = it->second;
|
||||
if ( pindex != 0 && (tipindex= chainActive.LastTip()) != 0 )
|
||||
{
|
||||
interest = komodo_accrued_interest(&txheight,&locktime,out.tx->GetHash(),out.i,0,nValue,(int32_t)tipindex->GetHeight());
|
||||
//interest = komodo_interest(pindex->GetHeight(),nValue,out.tx->nLockTime,tipindex->nTime);
|
||||
sum += interest;
|
||||
}
|
||||
}
|
||||
}
|
||||
KOMODO_INTERESTSUM = sum;
|
||||
KOMODO_WALLETBALANCE = pwalletMain->GetBalance();
|
||||
return(sum);
|
||||
}
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
*Return current blockchain status, wallet balance, address balance and the last 200 transactions
|
||||
**/
|
||||
// Return current blockchain status, wallet balance, address balance and the last 200 transactions
|
||||
UniValue getalldata(const UniValue& params, bool fHelp,const CPubKey&)
|
||||
{
|
||||
if (fHelp || params.size() > 3)
|
||||
@@ -3059,23 +3015,20 @@ UniValue getalldata(const UniValue& params, bool fHelp,const CPubKey&)
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
int nMinDepth = 1;
|
||||
|
||||
CAmount confirmed = 0;
|
||||
CAmount unconfirmed = 0;
|
||||
CAmount locked = 0;
|
||||
CAmount immature = 0;
|
||||
|
||||
CAmount privateConfirmed = 0;
|
||||
CAmount privateUnconfirmed = 0;
|
||||
CAmount privateLocked = 0;
|
||||
CAmount privateImmature = 0;
|
||||
|
||||
balancestruct txAmounts;
|
||||
txAmounts.confirmed = 0;
|
||||
txAmounts.unconfirmed = 0;
|
||||
txAmounts.locked = 0;
|
||||
txAmounts.immature = 0;
|
||||
|
||||
CAmount confirmed = 0;
|
||||
CAmount unconfirmed = 0;
|
||||
CAmount locked = 0;
|
||||
CAmount immature = 0;
|
||||
CAmount privateConfirmed = 0;
|
||||
CAmount privateUnconfirmed = 0;
|
||||
CAmount privateLocked = 0;
|
||||
CAmount privateImmature = 0;
|
||||
txAmounts.confirmed = 0;
|
||||
txAmounts.unconfirmed = 0;
|
||||
txAmounts.locked = 0;
|
||||
txAmounts.immature = 0;
|
||||
|
||||
//Create map of addresses
|
||||
//Add all Transaparent addresses to list
|
||||
@@ -3087,7 +3040,7 @@ UniValue getalldata(const UniValue& params, bool fHelp,const CPubKey&)
|
||||
addressBalances.insert(make_pair(addressString,txAmounts));
|
||||
}
|
||||
|
||||
//Add all Sapling addresses to map
|
||||
// Add all zaddrs
|
||||
std::set<libzcash::SaplingPaymentAddress> zs_addresses;
|
||||
pwalletMain->GetSaplingPaymentAddresses(zs_addresses);
|
||||
for (auto addr : zs_addresses) {
|
||||
@@ -4038,7 +3991,7 @@ CAmount getBalanceTaddr(std::string transparentAddress, int minDepth=1, bool ign
|
||||
}
|
||||
}
|
||||
|
||||
CAmount nValue = out.tx->vout[out.i].nValue; // komodo_interest
|
||||
CAmount nValue = out.tx->vout[out.i].nValue;
|
||||
balance += nValue;
|
||||
}
|
||||
return balance;
|
||||
@@ -4299,14 +4252,12 @@ UniValue z_gettotalbalance(const UniValue& params, bool fHelp, const CPubKey& my
|
||||
// getbalance and "getbalance * 1 true" should return the same number
|
||||
// but they don't because wtx.GetAmounts() does not handle tx where there are no outputs
|
||||
// pwalletMain->GetBalance() does not accept min depth parameter
|
||||
// so we use our own method to get balance of utxos.
|
||||
CAmount nBalance = getBalanceTaddr("", nMinDepth, !fIncludeWatchonly);
|
||||
// so we use our own method to get balance of utxos, lulzwtfbbq
|
||||
CAmount nBalance = getBalanceTaddr("", nMinDepth, !fIncludeWatchonly);
|
||||
CAmount nPrivateBalance = getBalanceZaddr("", nMinDepth, !fIncludeWatchonly);
|
||||
uint64_t interest = komodo_interestsum();
|
||||
CAmount nTotalBalance = nBalance + nPrivateBalance;
|
||||
CAmount nTotalBalance = nBalance + nPrivateBalance;
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.push_back(Pair("transparent", FormatMoney(nBalance)));
|
||||
result.push_back(Pair("interest", FormatMoney(interest)));
|
||||
result.push_back(Pair("private", FormatMoney(nPrivateBalance)));
|
||||
result.push_back(Pair("total", FormatMoney(nTotalBalance)));
|
||||
return result;
|
||||
|
||||
+3
-15
@@ -18,10 +18,8 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "wallet/wallet.h"
|
||||
#include "asyncrpcqueue.h"
|
||||
|
||||
#include "checkpoints.h"
|
||||
#include "coincontrol.h"
|
||||
#include "consensus/upgrades.h"
|
||||
@@ -42,9 +40,7 @@
|
||||
#include "wallet/asyncrpcoperation_saplingconsolidation.h"
|
||||
#include "zcash/zip32.h"
|
||||
#include "cc/CCinclude.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
@@ -1814,7 +1810,7 @@ CAmount CWallet::GetDebit(const CTxIn &txin, const isminefilter& filter) const
|
||||
const CWalletTx& prev = (*mi).second;
|
||||
if (txin.prevout.n < prev.vout.size())
|
||||
if (::IsMine(*this, prev.vout[txin.prevout.n].scriptPubKey) & filter)
|
||||
return prev.vout[txin.prevout.n].nValue; // komodo_interest?
|
||||
return prev.vout[txin.prevout.n].nValue;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -3206,8 +3202,6 @@ CAmount CWallet::GetImmatureWatchOnlyBalance() const
|
||||
/**
|
||||
* populate vCoins with vector of available COutputs.
|
||||
*/
|
||||
uint64_t komodo_interestnew(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime);
|
||||
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight);
|
||||
|
||||
void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const CCoinControl *coinControl, bool fIncludeZeroValue, bool fIncludeCoinBase) const
|
||||
{
|
||||
@@ -3252,10 +3246,8 @@ void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const
|
||||
{
|
||||
if ( (tipindex= chainActive.LastTip()) != 0 )
|
||||
{
|
||||
komodo_accrued_interest(&txheight,&locktime,wtxid,i,0,pcoin->vout[i].nValue,(int32_t)tipindex->GetHeight());
|
||||
interest = komodo_interestnew(txheight,pcoin->vout[i].nValue,locktime,tipindex->nTime);
|
||||
interest = 0;
|
||||
} else interest = 0;
|
||||
//interest = komodo_interestnew(chainActive.LastTip()->GetHeight()+1,pcoin->vout[i].nValue,pcoin->nLockTime,chainActive.LastTip()->nTime);
|
||||
if ( interest != 0 )
|
||||
{
|
||||
ptr = (uint64_t *)&pcoin->vout[i].interest;
|
||||
@@ -3434,11 +3426,6 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
|
||||
{
|
||||
// Output parameter fOnlyCoinbaseCoinsRet is set to true when the only available coins are coinbase utxos.
|
||||
uint64_t tmp; int32_t retval;
|
||||
//if ( interestp == 0 )
|
||||
//{
|
||||
// interestp = &tmp;
|
||||
// *interestp = 0;
|
||||
//}
|
||||
vector<COutput> vCoinsNoCoinbase, vCoinsWithCoinbase;
|
||||
AvailableCoins(vCoinsNoCoinbase, true, coinControl, false, false);
|
||||
AvailableCoins(vCoinsWithCoinbase, true, coinControl, false, true);
|
||||
@@ -3724,6 +3711,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||
age += 1;
|
||||
dPriority += (double)nCredit * age;
|
||||
}
|
||||
//TODO: delete this
|
||||
if ( SMART_CHAIN_SYMBOL[0] == 0 && DONATION_PUBKEY.size() == 66 && interest2 > 5000 )
|
||||
{
|
||||
CScript scriptDonation = CScript() << ParseHex(DONATION_PUBKEY) << OP_CHECKSIG;
|
||||
|
||||
Reference in New Issue
Block a user