@@ -9,7 +9,7 @@ $(package)_config_opts=
|
|||||||
else
|
else
|
||||||
package=libsodium
|
package=libsodium
|
||||||
$(package)_version=1.0.15
|
$(package)_version=1.0.15
|
||||||
$(package)_download_path=https://download.libsodium.org/libsodium/releases
|
$(package)_download_path=https://download.libsodium.org/libsodium/releases/old
|
||||||
$(package)_file_name=$(package)-$($(package)_version).tar.gz
|
$(package)_file_name=$(package)-$($(package)_version).tar.gz
|
||||||
$(package)_sha256_hash=fb6a9e879a2f674592e4328c5d9f79f082405ee4bb05cb6e679b90afe9e178f4
|
$(package)_sha256_hash=fb6a9e879a2f674592e4328c5d9f79f082405ee4bb05cb6e679b90afe9e178f4
|
||||||
$(package)_dependencies=
|
$(package)_dependencies=
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ libbitcoin_server_a_SOURCES = \
|
|||||||
cc/oracles.cpp \
|
cc/oracles.cpp \
|
||||||
cc/prices.cpp \
|
cc/prices.cpp \
|
||||||
cc/pegs.cpp \
|
cc/pegs.cpp \
|
||||||
cc/triggers.cpp \
|
cc/marmara.cpp \
|
||||||
cc/payments.cpp \
|
cc/payments.cpp \
|
||||||
cc/gateways.cpp \
|
cc/gateways.cpp \
|
||||||
cc/channels.cpp \
|
cc/channels.cpp \
|
||||||
|
|||||||
@@ -19,9 +19,9 @@
|
|||||||
|
|
||||||
#include "CCinclude.h"
|
#include "CCinclude.h"
|
||||||
|
|
||||||
bool TriggersValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
|
bool MarmaraValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
|
||||||
|
|
||||||
// CCcustom
|
// CCcustom
|
||||||
UniValue TriggersInfo();
|
UniValue MarmaraInfo();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
#include "CCOracles.h"
|
#include "CCOracles.h"
|
||||||
#include "CCPrices.h"
|
#include "CCPrices.h"
|
||||||
#include "CCPegs.h"
|
#include "CCPegs.h"
|
||||||
#include "CCTriggers.h"
|
#include "CCMarmara.h"
|
||||||
#include "CCPayments.h"
|
#include "CCPayments.h"
|
||||||
#include "CCGateways.h"
|
#include "CCGateways.h"
|
||||||
|
|
||||||
@@ -189,13 +189,13 @@ uint8_t PegsCCpriv[32] = { 0x52, 0x56, 0x4c, 0x78, 0x87, 0xf7, 0xa2, 0x39, 0xb0,
|
|||||||
#undef FUNCNAME
|
#undef FUNCNAME
|
||||||
#undef EVALCODE
|
#undef EVALCODE
|
||||||
|
|
||||||
// Triggers
|
// Marmara
|
||||||
#define FUNCNAME IsTriggersInput
|
#define FUNCNAME IsMarmaraInput
|
||||||
#define EVALCODE EVAL_TRIGGERS
|
#define EVALCODE EVAL_MARMARA
|
||||||
const char *TriggersCCaddr = "RGLSRDnUqTB43bYtRtNVgmwSSd1sun2te8";
|
const char *MarmaraCCaddr = "RGLSRDnUqTB43bYtRtNVgmwSSd1sun2te8";
|
||||||
const char *TriggersNormaladdr = "RMN25Tn8NNzcyQDiQNuMp8UmwLMFd9thYc";
|
const char *MarmaraNormaladdr = "RMN25Tn8NNzcyQDiQNuMp8UmwLMFd9thYc";
|
||||||
char TriggersCChexstr[67] = { "03afc5be570d0ff419425cfcc580cc762ab82baad88c148f5b028d7db7bfeee61d" };
|
char MarmaraCChexstr[67] = { "03afc5be570d0ff419425cfcc580cc762ab82baad88c148f5b028d7db7bfeee61d" };
|
||||||
uint8_t TriggersCCpriv[32] = { 0x7c, 0x0b, 0x54, 0x9b, 0x65, 0xd4, 0x89, 0x57, 0xdf, 0x05, 0xfe, 0xa2, 0x62, 0x41, 0xa9, 0x09, 0x0f, 0x2a, 0x6b, 0x11, 0x2c, 0xbe, 0xbd, 0x06, 0x31, 0x8d, 0xc0, 0xb9, 0x96, 0x76, 0x3f, 0x24 };
|
uint8_t MarmaraCCpriv[32] = { 0x7c, 0x0b, 0x54, 0x9b, 0x65, 0xd4, 0x89, 0x57, 0xdf, 0x05, 0xfe, 0xa2, 0x62, 0x41, 0xa9, 0x09, 0x0f, 0x2a, 0x6b, 0x11, 0x2c, 0xbe, 0xbd, 0x06, 0x31, 0x8d, 0xc0, 0xb9, 0x96, 0x76, 0x3f, 0x24 };
|
||||||
#include "CCcustom.inc"
|
#include "CCcustom.inc"
|
||||||
#undef FUNCNAME
|
#undef FUNCNAME
|
||||||
#undef EVALCODE
|
#undef EVALCODE
|
||||||
@@ -323,13 +323,13 @@ struct CCcontract_info *CCinit(struct CCcontract_info *cp, uint8_t evalcode)
|
|||||||
cp->validate = PegsValidate;
|
cp->validate = PegsValidate;
|
||||||
cp->ismyvin = IsPegsInput;
|
cp->ismyvin = IsPegsInput;
|
||||||
break;
|
break;
|
||||||
case EVAL_TRIGGERS:
|
case EVAL_MARMARA:
|
||||||
strcpy(cp->unspendableCCaddr,TriggersCCaddr);
|
strcpy(cp->unspendableCCaddr,MarmaraCCaddr);
|
||||||
strcpy(cp->normaladdr,TriggersNormaladdr);
|
strcpy(cp->normaladdr,MarmaraNormaladdr);
|
||||||
strcpy(cp->CChexstr,TriggersCChexstr);
|
strcpy(cp->CChexstr,MarmaraCChexstr);
|
||||||
memcpy(cp->CCpriv,TriggersCCpriv,32);
|
memcpy(cp->CCpriv,MarmaraCCpriv,32);
|
||||||
cp->validate = TriggersValidate;
|
cp->validate = MarmaraValidate;
|
||||||
cp->ismyvin = IsTriggersInput;
|
cp->ismyvin = IsMarmaraInput;
|
||||||
break;
|
break;
|
||||||
case EVAL_PAYMENTS:
|
case EVAL_PAYMENTS:
|
||||||
strcpy(cp->unspendableCCaddr,PaymentsCCaddr);
|
strcpy(cp->unspendableCCaddr,PaymentsCCaddr);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
EVAL(EVAL_ORACLES, 0xec) \
|
EVAL(EVAL_ORACLES, 0xec) \
|
||||||
EVAL(EVAL_PRICES, 0xed) \
|
EVAL(EVAL_PRICES, 0xed) \
|
||||||
EVAL(EVAL_PEGS, 0xee) \
|
EVAL(EVAL_PEGS, 0xee) \
|
||||||
EVAL(EVAL_TRIGGERS, 0xef) \
|
EVAL(EVAL_MARMARA, 0xef) \
|
||||||
EVAL(EVAL_PAYMENTS, 0xf0) \
|
EVAL(EVAL_PAYMENTS, 0xf0) \
|
||||||
EVAL(EVAL_GATEWAYS, 0xf1)
|
EVAL(EVAL_GATEWAYS, 0xf1)
|
||||||
|
|
||||||
|
|||||||
@@ -13,16 +13,16 @@
|
|||||||
* *
|
* *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "CCTriggers.h"
|
#include "CCMarmara.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Triggers CC is a building block CC that allows creation of event -> action processing, where events are defined during trigger creation and actions to be mostly done via payments, but by making payments to other CC contracts, it can be used to invoke other CC contracts
|
Marmara CC is for the MARMARA project
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// start of consensus code
|
// start of consensus code
|
||||||
|
|
||||||
int64_t IsTriggersvout(struct CCcontract_info *cp,const CTransaction& tx,int32_t v)
|
int64_t IsMarmaravout(struct CCcontract_info *cp,const CTransaction& tx,int32_t v)
|
||||||
{
|
{
|
||||||
char destaddr[64];
|
char destaddr[64];
|
||||||
if ( tx.vout[v].scriptPubKey.IsPayToCryptoCondition() != 0 )
|
if ( tx.vout[v].scriptPubKey.IsPayToCryptoCondition() != 0 )
|
||||||
@@ -33,7 +33,7 @@ int64_t IsTriggersvout(struct CCcontract_info *cp,const CTransaction& tx,int32_t
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TriggersExactAmounts(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx,int32_t minage,uint64_t txfee)
|
bool MarmaraExactAmounts(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx,int32_t minage,uint64_t txfee)
|
||||||
{
|
{
|
||||||
static uint256 zerohash;
|
static uint256 zerohash;
|
||||||
CTransaction vinTx; uint256 hashBlock,activehash; int32_t i,numvins,numvouts; int64_t inputs=0,outputs=0,assetoshis;
|
CTransaction vinTx; uint256 hashBlock,activehash; int32_t i,numvins,numvouts; int64_t inputs=0,outputs=0,assetoshis;
|
||||||
@@ -51,8 +51,8 @@ bool TriggersExactAmounts(struct CCcontract_info *cp,Eval* eval,const CTransacti
|
|||||||
{
|
{
|
||||||
//fprintf(stderr,"vini.%d check hash and vout\n",i);
|
//fprintf(stderr,"vini.%d check hash and vout\n",i);
|
||||||
if ( hashBlock == zerohash )
|
if ( hashBlock == zerohash )
|
||||||
return eval->Invalid("cant Triggers from mempool");
|
return eval->Invalid("cant Marmara from mempool");
|
||||||
if ( (assetoshis= IsTriggersvout(cp,vinTx,tx.vin[i].prevout.n)) != 0 )
|
if ( (assetoshis= IsMarmaravout(cp,vinTx,tx.vin[i].prevout.n)) != 0 )
|
||||||
inputs += assetoshis;
|
inputs += assetoshis;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ bool TriggersExactAmounts(struct CCcontract_info *cp,Eval* eval,const CTransacti
|
|||||||
for (i=0; i<numvouts; i++)
|
for (i=0; i<numvouts; i++)
|
||||||
{
|
{
|
||||||
//fprintf(stderr,"i.%d of numvouts.%d\n",i,numvouts);
|
//fprintf(stderr,"i.%d of numvouts.%d\n",i,numvouts);
|
||||||
if ( (assetoshis= IsTriggersvout(cp,tx,i)) != 0 )
|
if ( (assetoshis= IsMarmaravout(cp,tx,i)) != 0 )
|
||||||
outputs += assetoshis;
|
outputs += assetoshis;
|
||||||
}
|
}
|
||||||
if ( inputs != outputs+txfee )
|
if ( inputs != outputs+txfee )
|
||||||
@@ -71,7 +71,7 @@ bool TriggersExactAmounts(struct CCcontract_info *cp,Eval* eval,const CTransacti
|
|||||||
else return(true);
|
else return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TriggersValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn)
|
bool MarmaraValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn)
|
||||||
{
|
{
|
||||||
int32_t numvins,numvouts,preventCCvins,preventCCvouts,i,numblocks; bool retval; uint256 txid; uint8_t hash[32]; char str[65],destaddr[64];
|
int32_t numvins,numvouts,preventCCvins,preventCCvouts,i,numblocks; bool retval; uint256 txid; uint8_t hash[32]; char str[65],destaddr[64];
|
||||||
return(false);
|
return(false);
|
||||||
@@ -91,9 +91,9 @@ bool TriggersValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//fprintf(stderr,"check amounts\n");
|
//fprintf(stderr,"check amounts\n");
|
||||||
if ( TriggersExactAmounts(cp,eval,tx,1,10000) == false )
|
if ( MarmaraExactAmounts(cp,eval,tx,1,10000) == false )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"Triggersget invalid amount\n");
|
fprintf(stderr,"Marmaraget invalid amount\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -102,8 +102,8 @@ bool TriggersValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &
|
|||||||
memcpy(hash,&txid,sizeof(hash));
|
memcpy(hash,&txid,sizeof(hash));
|
||||||
retval = PreventCC(eval,tx,preventCCvins,numvins,preventCCvouts,numvouts);
|
retval = PreventCC(eval,tx,preventCCvins,numvins,preventCCvouts,numvouts);
|
||||||
if ( retval != 0 )
|
if ( retval != 0 )
|
||||||
fprintf(stderr,"Triggersget validated\n");
|
fprintf(stderr,"Marmaraget validated\n");
|
||||||
else fprintf(stderr,"Triggersget invalid\n");
|
else fprintf(stderr,"Marmaraget invalid\n");
|
||||||
return(retval);
|
return(retval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ bool TriggersValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &
|
|||||||
|
|
||||||
// helper functions for rpc calls in rpcwallet.cpp
|
// helper functions for rpc calls in rpcwallet.cpp
|
||||||
|
|
||||||
int64_t AddTriggersInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey pk,int64_t total,int32_t maxinputs)
|
int64_t AddMarmaraInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey pk,int64_t total,int32_t maxinputs)
|
||||||
{
|
{
|
||||||
// add threshold check
|
// add threshold check
|
||||||
char coinaddr[64]; int64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t vout,n = 0;
|
char coinaddr[64]; int64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t vout,n = 0;
|
||||||
@@ -126,7 +126,7 @@ int64_t AddTriggersInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CP
|
|||||||
// no need to prevent dup
|
// no need to prevent dup
|
||||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
|
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
|
||||||
{
|
{
|
||||||
if ( (nValue= IsTriggersvout(cp,vintx,vout)) > 1000000 && myIsutxo_spentinmempool(txid,vout) == 0 )
|
if ( (nValue= IsMarmaravout(cp,vintx,vout)) > 1000000 && myIsutxo_spentinmempool(txid,vout) == 0 )
|
||||||
{
|
{
|
||||||
if ( total != 0 && maxinputs != 0 )
|
if ( total != 0 && maxinputs != 0 )
|
||||||
mtx.vin.push_back(CTxIn(txid,vout,CScript()));
|
mtx.vin.push_back(CTxIn(txid,vout,CScript()));
|
||||||
@@ -141,28 +141,28 @@ int64_t AddTriggersInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CP
|
|||||||
return(totalinputs);
|
return(totalinputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TriggersGet(uint64_t txfee,int64_t nValue)
|
std::string MarmaraGet(uint64_t txfee,int64_t nValue)
|
||||||
{
|
{
|
||||||
CMutableTransaction tmpmtx,mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
CMutableTransaction tmpmtx,mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||||
CPubKey mypk,Triggerspk; int64_t inputs,CCchange=0; struct CCcontract_info *cp,C; std::string rawhex; uint32_t j; int32_t i,len; uint8_t buf[32768]; bits256 hash;
|
CPubKey mypk,Marmarapk; int64_t inputs,CCchange=0; struct CCcontract_info *cp,C; std::string rawhex; uint32_t j; int32_t i,len; uint8_t buf[32768]; bits256 hash;
|
||||||
cp = CCinit(&C,EVAL_TRIGGERS);
|
cp = CCinit(&C,EVAL_MARMARA);
|
||||||
if ( txfee == 0 )
|
if ( txfee == 0 )
|
||||||
txfee = 10000;
|
txfee = 10000;
|
||||||
Triggerspk = GetUnspendable(cp,0);
|
Marmarapk = GetUnspendable(cp,0);
|
||||||
mypk = pubkey2pk(Mypubkey());
|
mypk = pubkey2pk(Mypubkey());
|
||||||
if ( (inputs= AddTriggersInputs(cp,mtx,Triggerspk,nValue+txfee,60)) > 0 )
|
if ( (inputs= AddMarmaraInputs(cp,mtx,Marmarapk,nValue+txfee,60)) > 0 )
|
||||||
{
|
{
|
||||||
if ( inputs > nValue )
|
if ( inputs > nValue )
|
||||||
CCchange = (inputs - nValue - txfee);
|
CCchange = (inputs - nValue - txfee);
|
||||||
if ( CCchange != 0 )
|
if ( CCchange != 0 )
|
||||||
mtx.vout.push_back(MakeCC1vout(EVAL_TRIGGERS,CCchange,Triggerspk));
|
mtx.vout.push_back(MakeCC1vout(EVAL_MARMARA,CCchange,Marmarapk));
|
||||||
mtx.vout.push_back(CTxOut(nValue,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
|
mtx.vout.push_back(CTxOut(nValue,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
|
||||||
fprintf(stderr,"start at %u\n",(uint32_t)time(NULL));
|
fprintf(stderr,"start at %u\n",(uint32_t)time(NULL));
|
||||||
j = rand() & 0xfffffff;
|
j = rand() & 0xfffffff;
|
||||||
for (i=0; i<1000000; i++,j++)
|
for (i=0; i<1000000; i++,j++)
|
||||||
{
|
{
|
||||||
tmpmtx = mtx;
|
tmpmtx = mtx;
|
||||||
rawhex = FinalizeCCTx(-1LL,cp,tmpmtx,mypk,txfee,CScript() << OP_RETURN << E_MARSHAL(ss << (uint8_t)EVAL_TRIGGERS << (uint8_t)'G' << j));
|
rawhex = FinalizeCCTx(-1LL,cp,tmpmtx,mypk,txfee,CScript() << OP_RETURN << E_MARSHAL(ss << (uint8_t)EVAL_MARMARA << (uint8_t)'G' << j));
|
||||||
if ( (len= (int32_t)rawhex.size()) > 0 && len < 65536 )
|
if ( (len= (int32_t)rawhex.size()) > 0 && len < 65536 )
|
||||||
{
|
{
|
||||||
len >>= 1;
|
len >>= 1;
|
||||||
@@ -178,37 +178,37 @@ std::string TriggersGet(uint64_t txfee,int64_t nValue)
|
|||||||
}
|
}
|
||||||
fprintf(stderr,"couldnt generate valid txid %u\n",(uint32_t)time(NULL));
|
fprintf(stderr,"couldnt generate valid txid %u\n",(uint32_t)time(NULL));
|
||||||
return("");
|
return("");
|
||||||
} else fprintf(stderr,"cant find Triggers inputs\n");
|
} else fprintf(stderr,"cant find Marmara inputs\n");
|
||||||
return("");
|
return("");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TriggersFund(uint64_t txfee,int64_t funds)
|
std::string MarmaraFund(uint64_t txfee,int64_t funds)
|
||||||
{
|
{
|
||||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||||
CPubKey mypk,Triggerspk; CScript opret; struct CCcontract_info *cp,C;
|
CPubKey mypk,Marmarapk; CScript opret; struct CCcontract_info *cp,C;
|
||||||
cp = CCinit(&C,EVAL_TRIGGERS);
|
cp = CCinit(&C,EVAL_MARMARA);
|
||||||
if ( txfee == 0 )
|
if ( txfee == 0 )
|
||||||
txfee = 10000;
|
txfee = 10000;
|
||||||
mypk = pubkey2pk(Mypubkey());
|
mypk = pubkey2pk(Mypubkey());
|
||||||
Triggerspk = GetUnspendable(cp,0);
|
Marmarapk = GetUnspendable(cp,0);
|
||||||
if ( AddNormalinputs(mtx,mypk,funds+txfee,64) > 0 )
|
if ( AddNormalinputs(mtx,mypk,funds+txfee,64) > 0 )
|
||||||
{
|
{
|
||||||
mtx.vout.push_back(MakeCC1vout(EVAL_TRIGGERS,funds,Triggerspk));
|
mtx.vout.push_back(MakeCC1vout(EVAL_MARMARA,funds,Marmarapk));
|
||||||
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,opret));
|
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,opret));
|
||||||
}
|
}
|
||||||
return("");
|
return("");
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue TriggersInfo()
|
UniValue MarmaraInfo()
|
||||||
{
|
{
|
||||||
UniValue result(UniValue::VOBJ); char numstr[64];
|
UniValue result(UniValue::VOBJ); char numstr[64];
|
||||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||||
CPubKey Triggerspk; struct CCcontract_info *cp,C; int64_t funding;
|
CPubKey Marmarapk; struct CCcontract_info *cp,C; int64_t funding;
|
||||||
result.push_back(Pair("result","success"));
|
result.push_back(Pair("result","success"));
|
||||||
result.push_back(Pair("name","Triggers"));
|
result.push_back(Pair("name","Marmara"));
|
||||||
cp = CCinit(&C,EVAL_TRIGGERS);
|
cp = CCinit(&C,EVAL_MARMARA);
|
||||||
Triggerspk = GetUnspendable(cp,0);
|
Marmarapk = GetUnspendable(cp,0);
|
||||||
funding = AddTriggersInputs(cp,mtx,Triggerspk,0,0);
|
funding = AddMarmaraInputs(cp,mtx,Marmarapk,0,0);
|
||||||
sprintf(numstr,"%.8f",(double)funding/COIN);
|
sprintf(numstr,"%.8f",(double)funding/COIN);
|
||||||
result.push_back(Pair("funding",numstr));
|
result.push_back(Pair("funding",numstr));
|
||||||
return(result);
|
return(result);
|
||||||
@@ -68,13 +68,13 @@ bool UnmarshalBurnTx(const CTransaction &burnTx, std::string &targetSymbol, uint
|
|||||||
if (burnTx.vout.size() == 0) return false;
|
if (burnTx.vout.size() == 0) return false;
|
||||||
GetOpReturnData(burnTx.vout.back().scriptPubKey, burnOpret);
|
GetOpReturnData(burnTx.vout.back().scriptPubKey, burnOpret);
|
||||||
E_UNMARSHAL(burnOpret, ss >> VARINT(ccid));
|
E_UNMARSHAL(burnOpret, ss >> VARINT(ccid));
|
||||||
if ( ccid != 0xffffffff )
|
/*if ( ccid != 0xffffffff )
|
||||||
{
|
{
|
||||||
return E_UNMARSHAL(burnOpret, ss >> VARINT(*targetCCid);
|
return E_UNMARSHAL(burnOpret, ss >> VARINT(*targetCCid);
|
||||||
ss >> targetSymbol;
|
ss >> targetSymbol;
|
||||||
ss >> payoutsHash);
|
ss >> payoutsHash);
|
||||||
}
|
}
|
||||||
else
|
else*/
|
||||||
{
|
{
|
||||||
return E_UNMARSHAL(burnOpret, ss >> VARINT(*targetCCid);
|
return E_UNMARSHAL(burnOpret, ss >> VARINT(*targetCCid);
|
||||||
ss >> targetSymbol;
|
ss >> targetSymbol;
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ extern uint8_t NOTARY_PUBKEY33[33];
|
|||||||
extern int32_t KOMODO_LOADINGBLOCKS,KOMODO_LONGESTCHAIN,KOMODO_INSYNC,KOMODO_CONNECTING,KOMODO_EXTRASATOSHI;
|
extern int32_t KOMODO_LOADINGBLOCKS,KOMODO_LONGESTCHAIN,KOMODO_INSYNC,KOMODO_CONNECTING,KOMODO_EXTRASATOSHI;
|
||||||
int32_t KOMODO_NEWBLOCKS;
|
int32_t KOMODO_NEWBLOCKS;
|
||||||
int32_t komodo_block2pubkey33(uint8_t *pubkey33,CBlock *block);
|
int32_t komodo_block2pubkey33(uint8_t *pubkey33,CBlock *block);
|
||||||
void komodo_broadcast(CBlock *pblock,int32_t limit);
|
//void komodo_broadcast(CBlock *pblock,int32_t limit);
|
||||||
bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey);
|
bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey);
|
||||||
void komodo_setactivation(int32_t height);
|
void komodo_setactivation(int32_t height);
|
||||||
|
|
||||||
@@ -3987,10 +3987,10 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
|
|||||||
KOMODO_INSYNC = (int32_t)pindexNew->GetHeight();
|
KOMODO_INSYNC = (int32_t)pindexNew->GetHeight();
|
||||||
else KOMODO_INSYNC = 0;
|
else KOMODO_INSYNC = 0;
|
||||||
//fprintf(stderr,"connect.%d insync.%d ASSETCHAINS_SAPLING.%d\n",(int32_t)pindexNew->GetHeight(),KOMODO_INSYNC,ASSETCHAINS_SAPLING);
|
//fprintf(stderr,"connect.%d insync.%d ASSETCHAINS_SAPLING.%d\n",(int32_t)pindexNew->GetHeight(),KOMODO_INSYNC,ASSETCHAINS_SAPLING);
|
||||||
if ( KOMODO_INSYNC != 0 ) //ASSETCHAINS_SYMBOL[0] == 0 &&
|
/*if ( KOMODO_INSYNC != 0 ) //ASSETCHAINS_SYMBOL[0] == 0 &&
|
||||||
komodo_broadcast(pblock,8);
|
komodo_broadcast(pblock,8);
|
||||||
else if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
else if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
komodo_broadcast(pblock,4);
|
komodo_broadcast(pblock,4);*/
|
||||||
if ( ASSETCHAINS_SAPLING <= 0 && pindexNew->nTime > KOMODO_SAPLING_ACTIVATION - 24*3600 )
|
if ( ASSETCHAINS_SAPLING <= 0 && pindexNew->nTime > KOMODO_SAPLING_ACTIVATION - 24*3600 )
|
||||||
komodo_activate_sapling(pindexNew);
|
komodo_activate_sapling(pindexNew);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -848,7 +848,7 @@ static bool ProcessBlockFound(CBlock* pblock)
|
|||||||
return error("KomodoMiner: ProcessNewBlock, block not accepted");
|
return error("KomodoMiner: ProcessNewBlock, block not accepted");
|
||||||
|
|
||||||
TrackMinedBlock(pblock->GetHash());
|
TrackMinedBlock(pblock->GetHash());
|
||||||
komodo_broadcast(pblock,16);
|
//komodo_broadcast(pblock,16);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ static const unsigned int MAX_INV_SZ = 50000;
|
|||||||
/** The maximum number of new addresses to accumulate before announcing. */
|
/** The maximum number of new addresses to accumulate before announcing. */
|
||||||
static const unsigned int MAX_ADDR_TO_SEND = 1000;
|
static const unsigned int MAX_ADDR_TO_SEND = 1000;
|
||||||
/** Maximum length of incoming protocol messages (no message over 2 MiB is currently acceptable). */
|
/** Maximum length of incoming protocol messages (no message over 2 MiB is currently acceptable). */
|
||||||
static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = 2 * 1024 * 1024;
|
static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = 4 * 1024 * 1024;
|
||||||
/** Maximum length of strSubVer in `version` message */
|
/** Maximum length of strSubVer in `version` message */
|
||||||
static const unsigned int MAX_SUBVERSION_LENGTH = 256;
|
static const unsigned int MAX_SUBVERSION_LENGTH = 256;
|
||||||
/** -listen default */
|
/** -listen default */
|
||||||
|
|||||||
@@ -695,7 +695,8 @@ UniValue getblockheader(const UniValue& params, bool fHelp)
|
|||||||
"\nResult (for verbose = true):\n"
|
"\nResult (for verbose = true):\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"hash\" : \"hash\", (string) the block hash (same as provided)\n"
|
" \"hash\" : \"hash\", (string) the block hash (same as provided)\n"
|
||||||
" \"confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain\n"
|
" \"confirmations\" : n, (numeric) The number of notarized DPoW confirmations, or -1 if the block is not on the main chain\n"
|
||||||
|
" \"rawconfirmations\" : n,(numeric) The number of raw confirmations, or -1 if the block is not on the main chain\n"
|
||||||
" \"height\" : n, (numeric) The block height or index\n"
|
" \"height\" : n, (numeric) The block height or index\n"
|
||||||
" \"version\" : n, (numeric) The block version\n"
|
" \"version\" : n, (numeric) The block version\n"
|
||||||
" \"merkleroot\" : \"xxxx\", (string) The merkle root\n"
|
" \"merkleroot\" : \"xxxx\", (string) The merkle root\n"
|
||||||
@@ -755,7 +756,8 @@ UniValue getblock(const UniValue& params, bool fHelp)
|
|||||||
"\nResult (for verbosity = 1):\n"
|
"\nResult (for verbosity = 1):\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"hash\" : \"hash\", (string) the block hash (same as provided hash)\n"
|
" \"hash\" : \"hash\", (string) the block hash (same as provided hash)\n"
|
||||||
" \"confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain\n"
|
" \"confirmations\" : n, (numeric) The number of notarized DPoW confirmations, or -1 if the block is not on the main chain\n"
|
||||||
|
" \"rawconfirmations\" : n,(numeric) The number of raw confirmations, or -1 if the block is not on the main chain\n"
|
||||||
" \"size\" : n, (numeric) The block size\n"
|
" \"size\" : n, (numeric) The block size\n"
|
||||||
" \"height\" : n, (numeric) The block height or index (same as provided height)\n"
|
" \"height\" : n, (numeric) The block height or index (same as provided height)\n"
|
||||||
" \"version\" : n, (numeric) The block version\n"
|
" \"version\" : n, (numeric) The block version\n"
|
||||||
@@ -1198,7 +1200,8 @@ UniValue gettxout(const UniValue& params, bool fHelp)
|
|||||||
"\nResult:\n"
|
"\nResult:\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"bestblock\" : \"hash\", (string) the block hash\n"
|
" \"bestblock\" : \"hash\", (string) the block hash\n"
|
||||||
" \"confirmations\" : n, (numeric) The number of confirmations\n"
|
" \"confirmations\" : n, (numeric) The number of notarized DPoW confirmations\n"
|
||||||
|
" \"rawconfirmations\" : n, (numeric) The number of raw confirmations\n"
|
||||||
" \"value\" : x.xxx, (numeric) The transaction value in " + CURRENCY_UNIT + "\n"
|
" \"value\" : x.xxx, (numeric) The transaction value in " + CURRENCY_UNIT + "\n"
|
||||||
" \"scriptPubKey\" : { (json object)\n"
|
" \"scriptPubKey\" : { (json object)\n"
|
||||||
" \"asm\" : \"code\", (string) \n"
|
" \"asm\" : \"code\", (string) \n"
|
||||||
@@ -1251,10 +1254,10 @@ UniValue gettxout(const UniValue& params, bool fHelp)
|
|||||||
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
|
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
|
||||||
CBlockIndex *pindex = it->second;
|
CBlockIndex *pindex = it->second;
|
||||||
ret.push_back(Pair("bestblock", pindex->GetBlockHash().GetHex()));
|
ret.push_back(Pair("bestblock", pindex->GetBlockHash().GetHex()));
|
||||||
if ((unsigned int)coins.nHeight == MEMPOOL_HEIGHT)
|
if ((unsigned int)coins.nHeight == MEMPOOL_HEIGHT) {
|
||||||
ret.push_back(Pair("confirmations", 0));
|
ret.push_back(Pair("confirmations", 0));
|
||||||
else
|
ret.push_back(Pair("rawconfirmations", 0));
|
||||||
{
|
} else {
|
||||||
ret.push_back(Pair("confirmations", komodo_dpowconfs(coins.nHeight,pindex->GetHeight() - coins.nHeight + 1)));
|
ret.push_back(Pair("confirmations", komodo_dpowconfs(coins.nHeight,pindex->GetHeight() - coins.nHeight + 1)));
|
||||||
ret.push_back(Pair("rawconfirmations", pindex->GetHeight() - coins.nHeight + 1));
|
ret.push_back(Pair("rawconfirmations", pindex->GetHeight() - coins.nHeight + 1));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
|||||||
uint32_t komodo_segid32(char *coinaddr);
|
uint32_t komodo_segid32(char *coinaddr);
|
||||||
int64_t komodo_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height);
|
int64_t komodo_coinsupply(int64_t *zfundsp,int64_t *sproutfundsp,int32_t height);
|
||||||
int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heightp);
|
int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heightp);
|
||||||
#define KOMODO_VERSION "0.3.1"
|
#define KOMODO_VERSION "0.3.3"
|
||||||
#define VERUS_VERSION "0.4.0g"
|
#define VERUS_VERSION "0.4.0g"
|
||||||
extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
|
extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
|
||||||
extern uint32_t ASSETCHAINS_CC;
|
extern uint32_t ASSETCHAINS_CC;
|
||||||
|
|||||||
@@ -297,6 +297,7 @@ void TxToJSONExpanded(const CTransaction& tx, const uint256 hashBlock, UniValue&
|
|||||||
} else {
|
} else {
|
||||||
entry.push_back(Pair("height", -1));
|
entry.push_back(Pair("height", -1));
|
||||||
entry.push_back(Pair("confirmations", 0));
|
entry.push_back(Pair("confirmations", 0));
|
||||||
|
entry.push_back(Pair("rawconfirmations", 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,9 +380,10 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
|
|||||||
entry.push_back(Pair("confirmations", komodo_dpowconfs(pindex->GetHeight(),1 + chainActive.Height() - pindex->GetHeight())));
|
entry.push_back(Pair("confirmations", komodo_dpowconfs(pindex->GetHeight(),1 + chainActive.Height() - pindex->GetHeight())));
|
||||||
entry.push_back(Pair("time", pindex->GetBlockTime()));
|
entry.push_back(Pair("time", pindex->GetBlockTime()));
|
||||||
entry.push_back(Pair("blocktime", pindex->GetBlockTime()));
|
entry.push_back(Pair("blocktime", pindex->GetBlockTime()));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
entry.push_back(Pair("confirmations", 0));
|
entry.push_back(Pair("confirmations", 0));
|
||||||
|
entry.push_back(Pair("rawconfirmations", 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -469,7 +471,8 @@ UniValue getrawtransaction(const UniValue& params, bool fHelp)
|
|||||||
" ,...\n"
|
" ,...\n"
|
||||||
" ],\n"
|
" ],\n"
|
||||||
" \"blockhash\" : \"hash\", (string) the block hash\n"
|
" \"blockhash\" : \"hash\", (string) the block hash\n"
|
||||||
" \"confirmations\" : n, (numeric) The confirmations\n"
|
" \"confirmations\" : n, (numeric) The number of notarized DPoW confirmations\n"
|
||||||
|
" \"rawconfirmations\" : n, (numeric) The number of raw confirmations\n"
|
||||||
" \"time\" : ttt, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT)\n"
|
" \"time\" : ttt, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT)\n"
|
||||||
" \"blocktime\" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n"
|
" \"blocktime\" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
|
|||||||
@@ -441,8 +441,8 @@ static const CRPCCommand vRPCCommands[] =
|
|||||||
// Pegs
|
// Pegs
|
||||||
{ "pegs", "pegsaddress", &pegsaddress, true },
|
{ "pegs", "pegsaddress", &pegsaddress, true },
|
||||||
|
|
||||||
// Triggers
|
// Marmara
|
||||||
{ "triggers", "triggersaddress", &triggersaddress, true },
|
{ "marmara", "Marmaraaddress", &marmaraaddress, true },
|
||||||
|
|
||||||
// Payments
|
// Payments
|
||||||
{ "payments", "paymentsaddress", &paymentsaddress, true },
|
{ "payments", "paymentsaddress", &paymentsaddress, true },
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ extern UniValue pricesbet(const UniValue& params, bool fHelp);
|
|||||||
extern UniValue pricesstatus(const UniValue& params, bool fHelp);
|
extern UniValue pricesstatus(const UniValue& params, bool fHelp);
|
||||||
extern UniValue pricesfinish(const UniValue& params, bool fHelp);
|
extern UniValue pricesfinish(const UniValue& params, bool fHelp);
|
||||||
extern UniValue pegsaddress(const UniValue& params, bool fHelp);
|
extern UniValue pegsaddress(const UniValue& params, bool fHelp);
|
||||||
extern UniValue triggersaddress(const UniValue& params, bool fHelp);
|
extern UniValue marmaraaddress(const UniValue& params, bool fHelp);
|
||||||
extern UniValue paymentsaddress(const UniValue& params, bool fHelp);
|
extern UniValue paymentsaddress(const UniValue& params, bool fHelp);
|
||||||
extern UniValue gatewaysaddress(const UniValue& params, bool fHelp);
|
extern UniValue gatewaysaddress(const UniValue& params, bool fHelp);
|
||||||
extern UniValue gatewayslist(const UniValue& params, bool fHelp);
|
extern UniValue gatewayslist(const UniValue& params, bool fHelp);
|
||||||
|
|||||||
@@ -1435,11 +1435,13 @@ struct tallyitem
|
|||||||
int nConf;
|
int nConf;
|
||||||
vector<uint256> txids;
|
vector<uint256> txids;
|
||||||
bool fIsWatchonly;
|
bool fIsWatchonly;
|
||||||
|
int nHeight;
|
||||||
tallyitem()
|
tallyitem()
|
||||||
{
|
{
|
||||||
nAmount = 0;
|
nAmount = 0;
|
||||||
nConf = std::numeric_limits<int>::max();
|
nConf = std::numeric_limits<int>::max();
|
||||||
fIsWatchonly = false;
|
fIsWatchonly = false;
|
||||||
|
nHeight = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1485,6 +1487,7 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts)
|
|||||||
tallyitem& item = mapTally[address];
|
tallyitem& item = mapTally[address];
|
||||||
item.nAmount += txout.nValue; // komodo_interest?
|
item.nAmount += txout.nValue; // komodo_interest?
|
||||||
item.nConf = min(item.nConf, nDepth);
|
item.nConf = min(item.nConf, nDepth);
|
||||||
|
item.nHeight = mapBlockIndex[wtx.hashBlock]->GetHeight();
|
||||||
item.txids.push_back(wtx.GetHash());
|
item.txids.push_back(wtx.GetHash());
|
||||||
if (mine & ISMINE_WATCH_ONLY)
|
if (mine & ISMINE_WATCH_ONLY)
|
||||||
item.fIsWatchonly = true;
|
item.fIsWatchonly = true;
|
||||||
@@ -1504,11 +1507,13 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts)
|
|||||||
CAmount nAmount = 0;
|
CAmount nAmount = 0;
|
||||||
int nConf = std::numeric_limits<int>::max();
|
int nConf = std::numeric_limits<int>::max();
|
||||||
bool fIsWatchonly = false;
|
bool fIsWatchonly = false;
|
||||||
|
int nHeight=0;
|
||||||
if (it != mapTally.end())
|
if (it != mapTally.end())
|
||||||
{
|
{
|
||||||
nAmount = (*it).second.nAmount;
|
nAmount = (*it).second.nAmount;
|
||||||
nConf = (*it).second.nConf;
|
nConf = (*it).second.nConf;
|
||||||
fIsWatchonly = (*it).second.fIsWatchonly;
|
fIsWatchonly = (*it).second.fIsWatchonly;
|
||||||
|
nHeight = (*it).second.nHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fByAccounts)
|
if (fByAccounts)
|
||||||
@@ -1521,12 +1526,14 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
UniValue obj(UniValue::VOBJ);
|
UniValue obj(UniValue::VOBJ);
|
||||||
|
|
||||||
if(fIsWatchonly)
|
if(fIsWatchonly)
|
||||||
obj.push_back(Pair("involvesWatchonly", true));
|
obj.push_back(Pair("involvesWatchonly", true));
|
||||||
obj.push_back(Pair("address", EncodeDestination(dest)));
|
obj.push_back(Pair("address", EncodeDestination(dest)));
|
||||||
obj.push_back(Pair("account", strAccount));
|
obj.push_back(Pair("account", strAccount));
|
||||||
obj.push_back(Pair("amount", ValueFromAmount(nAmount)));
|
obj.push_back(Pair("amount", ValueFromAmount(nAmount)));
|
||||||
obj.push_back(Pair("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf)));
|
obj.push_back(Pair("rawconfirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf)));
|
||||||
|
obj.push_back(Pair("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : komodo_dpowconfs(nHeight, nConf))));
|
||||||
UniValue transactions(UniValue::VARR);
|
UniValue transactions(UniValue::VARR);
|
||||||
if (it != mapTally.end())
|
if (it != mapTally.end())
|
||||||
{
|
{
|
||||||
@@ -1546,12 +1553,14 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts)
|
|||||||
{
|
{
|
||||||
CAmount nAmount = (*it).second.nAmount;
|
CAmount nAmount = (*it).second.nAmount;
|
||||||
int nConf = (*it).second.nConf;
|
int nConf = (*it).second.nConf;
|
||||||
|
int nHeight = (*it).second.nHeight;
|
||||||
UniValue obj(UniValue::VOBJ);
|
UniValue obj(UniValue::VOBJ);
|
||||||
if((*it).second.fIsWatchonly)
|
if((*it).second.fIsWatchonly)
|
||||||
obj.push_back(Pair("involvesWatchonly", true));
|
obj.push_back(Pair("involvesWatchonly", true));
|
||||||
obj.push_back(Pair("account", (*it).first));
|
obj.push_back(Pair("account", (*it).first));
|
||||||
obj.push_back(Pair("amount", ValueFromAmount(nAmount)));
|
obj.push_back(Pair("amount", ValueFromAmount(nAmount)));
|
||||||
obj.push_back(Pair("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf)));
|
obj.push_back(Pair("rawconfirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf)));
|
||||||
|
obj.push_back(Pair("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : komodo_dpowconfs(nHeight, nConf))));
|
||||||
ret.push_back(obj);
|
ret.push_back(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2954,10 +2963,29 @@ UniValue z_listunspent(const UniValue& params, bool fHelp)
|
|||||||
|
|
||||||
for (auto & entry : sproutEntries) {
|
for (auto & entry : sproutEntries) {
|
||||||
UniValue obj(UniValue::VOBJ);
|
UniValue obj(UniValue::VOBJ);
|
||||||
|
int nHeight = 0;
|
||||||
|
CTransaction tx;
|
||||||
|
uint256 hashBlock;
|
||||||
|
|
||||||
obj.push_back(Pair("txid", entry.jsop.hash.ToString()));
|
obj.push_back(Pair("txid", entry.jsop.hash.ToString()));
|
||||||
obj.push_back(Pair("jsindex", (int)entry.jsop.js ));
|
obj.push_back(Pair("jsindex", (int)entry.jsop.js ));
|
||||||
obj.push_back(Pair("jsoutindex", (int)entry.jsop.n));
|
obj.push_back(Pair("jsoutindex", (int)entry.jsop.n));
|
||||||
obj.push_back(Pair("confirmations", entry.confirmations));
|
|
||||||
|
if (!GetTransaction(entry.jsop.hash, tx, hashBlock, true)) {
|
||||||
|
// TODO: should we throw JSONRPCError ?
|
||||||
|
fprintf(stderr,"tx hash %s does not exist!\n", entry.jsop.hash.ToString().c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockMap::const_iterator it = mapBlockIndex.find(hashBlock);
|
||||||
|
if (it != mapBlockIndex.end()) {
|
||||||
|
nHeight = it->second->GetHeight();
|
||||||
|
fprintf(stderr,"blockHash %s height %d\n",hashBlock.ToString().c_str(), nHeight);
|
||||||
|
} else {
|
||||||
|
// TODO: should we throw JSONRPCError ?
|
||||||
|
fprintf(stderr,"block hash %s does not exist!\n", hashBlock.ToString().c_str() );
|
||||||
|
}
|
||||||
|
obj.push_back(Pair("confirmations", komodo_dpowconfs(nHeight, entry.confirmations)));
|
||||||
|
obj.push_back(Pair("rawconfirmations", entry.confirmations));
|
||||||
bool hasSproutSpendingKey = pwalletMain->HaveSproutSpendingKey(boost::get<libzcash::SproutPaymentAddress>(entry.address));
|
bool hasSproutSpendingKey = pwalletMain->HaveSproutSpendingKey(boost::get<libzcash::SproutPaymentAddress>(entry.address));
|
||||||
obj.push_back(Pair("spendable", hasSproutSpendingKey));
|
obj.push_back(Pair("spendable", hasSproutSpendingKey));
|
||||||
obj.push_back(Pair("address", EncodePaymentAddress(entry.address)));
|
obj.push_back(Pair("address", EncodePaymentAddress(entry.address)));
|
||||||
@@ -2974,7 +3002,24 @@ UniValue z_listunspent(const UniValue& params, bool fHelp)
|
|||||||
UniValue obj(UniValue::VOBJ);
|
UniValue obj(UniValue::VOBJ);
|
||||||
obj.push_back(Pair("txid", entry.op.hash.ToString()));
|
obj.push_back(Pair("txid", entry.op.hash.ToString()));
|
||||||
obj.push_back(Pair("outindex", (int)entry.op.n));
|
obj.push_back(Pair("outindex", (int)entry.op.n));
|
||||||
obj.push_back(Pair("confirmations", entry.confirmations));
|
int nHeight = 0;
|
||||||
|
CTransaction tx;
|
||||||
|
uint256 hashBlock;
|
||||||
|
if (!GetTransaction(entry.op.hash, tx, hashBlock, true)) {
|
||||||
|
// TODO: should we throw JSONRPCError ?
|
||||||
|
fprintf(stderr,"tx hash %s does not exist!\n", entry.op.hash.ToString().c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockMap::const_iterator it = mapBlockIndex.find(hashBlock);
|
||||||
|
if (it != mapBlockIndex.end()) {
|
||||||
|
nHeight = it->second->GetHeight();
|
||||||
|
fprintf(stderr,"blockHash %s height %d\n",hashBlock.ToString().c_str(), nHeight);
|
||||||
|
} else {
|
||||||
|
// TODO: should we throw JSONRPCError ?
|
||||||
|
fprintf(stderr,"block hash %s does not exist!\n", hashBlock.ToString().c_str() );
|
||||||
|
}
|
||||||
|
obj.push_back(Pair("confirmations", komodo_dpowconfs(nHeight, entry.confirmations)));
|
||||||
|
obj.push_back(Pair("rawconfirmations", entry.confirmations));
|
||||||
libzcash::SaplingIncomingViewingKey ivk;
|
libzcash::SaplingIncomingViewingKey ivk;
|
||||||
libzcash::SaplingFullViewingKey fvk;
|
libzcash::SaplingFullViewingKey fvk;
|
||||||
pwalletMain->GetSaplingIncomingViewingKey(boost::get<libzcash::SaplingPaymentAddress>(entry.address), ivk);
|
pwalletMain->GetSaplingIncomingViewingKey(boost::get<libzcash::SaplingPaymentAddress>(entry.address), ivk);
|
||||||
@@ -3702,7 +3747,11 @@ UniValue z_listreceivedbyaddress(const UniValue& params, bool fHelp)
|
|||||||
"{\n"
|
"{\n"
|
||||||
" \"txid\": xxxxx, (string) the transaction id\n"
|
" \"txid\": xxxxx, (string) the transaction id\n"
|
||||||
" \"amount\": xxxxx, (numeric) the amount of value in the note\n"
|
" \"amount\": xxxxx, (numeric) the amount of value in the note\n"
|
||||||
" \"memo\": xxxxx, (string) hexademical string representation of memo field\n"
|
" \"memo\": xxxxx, (string) hexadecimal string representation of memo field\n"
|
||||||
|
" \"confirmations\" : n, (numeric) the number of confirmations\n"
|
||||||
|
" \"jsindex\" (sprout) : n, (numeric) the joinsplit index\n"
|
||||||
|
" \"jsoutindex\" (sprout) : n, (numeric) the output index of the joinsplit\n"
|
||||||
|
" \"outindex\" (sapling) : n, (numeric) the output index\n"
|
||||||
" \"change\": true|false, (boolean) true if the address that received the note is also one of the sending addresses\n"
|
" \"change\": true|false, (boolean) true if the address that received the note is also one of the sending addresses\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\nExamples:\n"
|
"\nExamples:\n"
|
||||||
@@ -3747,12 +3796,30 @@ UniValue z_listreceivedbyaddress(const UniValue& params, bool fHelp)
|
|||||||
if (boost::get<libzcash::SproutPaymentAddress>(&zaddr) != nullptr) {
|
if (boost::get<libzcash::SproutPaymentAddress>(&zaddr) != nullptr) {
|
||||||
for (CSproutNotePlaintextEntry & entry : sproutEntries) {
|
for (CSproutNotePlaintextEntry & entry : sproutEntries) {
|
||||||
UniValue obj(UniValue::VOBJ);
|
UniValue obj(UniValue::VOBJ);
|
||||||
|
int nHeight = 0;
|
||||||
|
CTransaction tx;
|
||||||
|
uint256 hashBlock;
|
||||||
|
|
||||||
|
if (GetTransaction(entry.jsop.hash, tx, hashBlock, true)) {
|
||||||
|
BlockMap::const_iterator it = mapBlockIndex.find(hashBlock);
|
||||||
|
if (it != mapBlockIndex.end()) {
|
||||||
|
nHeight = it->second->GetHeight();
|
||||||
|
fprintf(stderr,"blockHash %s height %d\n",hashBlock.ToString().c_str(), nHeight);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr,"block hash %s does not exist!\n", hashBlock.ToString().c_str() );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fprintf(stderr,"tx hash %s does not exist!\n", entry.jsop.hash.ToString().c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
obj.push_back(Pair("txid", entry.jsop.hash.ToString()));
|
obj.push_back(Pair("txid", entry.jsop.hash.ToString()));
|
||||||
obj.push_back(Pair("amount", ValueFromAmount(CAmount(entry.plaintext.value()))));
|
obj.push_back(Pair("amount", ValueFromAmount(CAmount(entry.plaintext.value()))));
|
||||||
std::string data(entry.plaintext.memo().begin(), entry.plaintext.memo().end());
|
std::string data(entry.plaintext.memo().begin(), entry.plaintext.memo().end());
|
||||||
obj.push_back(Pair("memo", HexStr(data)));
|
obj.push_back(Pair("memo", HexStr(data)));
|
||||||
obj.push_back(Pair("jsindex", entry.jsop.js));
|
obj.push_back(Pair("jsindex", entry.jsop.js));
|
||||||
obj.push_back(Pair("jsoutindex", entry.jsop.n));
|
obj.push_back(Pair("jsoutindex", entry.jsop.n));
|
||||||
|
obj.push_back(Pair("rawconfirmations", entry.confirmations));
|
||||||
|
obj.push_back(Pair("confirmations", komodo_dpowconfs(nHeight, entry.confirmations)));
|
||||||
if (hasSpendingKey) {
|
if (hasSpendingKey) {
|
||||||
obj.push_back(Pair("change", pwalletMain->IsNoteSproutChange(nullifierSet, entry.address, entry.jsop)));
|
obj.push_back(Pair("change", pwalletMain->IsNoteSproutChange(nullifierSet, entry.address, entry.jsop)));
|
||||||
}
|
}
|
||||||
@@ -3761,10 +3828,27 @@ UniValue z_listreceivedbyaddress(const UniValue& params, bool fHelp)
|
|||||||
} else if (boost::get<libzcash::SaplingPaymentAddress>(&zaddr) != nullptr) {
|
} else if (boost::get<libzcash::SaplingPaymentAddress>(&zaddr) != nullptr) {
|
||||||
for (SaplingNoteEntry & entry : saplingEntries) {
|
for (SaplingNoteEntry & entry : saplingEntries) {
|
||||||
UniValue obj(UniValue::VOBJ);
|
UniValue obj(UniValue::VOBJ);
|
||||||
|
int nHeight = 0;
|
||||||
|
CTransaction tx;
|
||||||
|
uint256 hashBlock;
|
||||||
|
|
||||||
|
if (GetTransaction(entry.op.hash, tx, hashBlock, true)) {
|
||||||
|
BlockMap::const_iterator it = mapBlockIndex.find(hashBlock);
|
||||||
|
if (it != mapBlockIndex.end()) {
|
||||||
|
nHeight = it->second->GetHeight();
|
||||||
|
fprintf(stderr,"blockHash %s height %d\n",hashBlock.ToString().c_str(), nHeight);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr,"block hash %s does not exist!\n", hashBlock.ToString().c_str() );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fprintf(stderr,"tx hash %s does not exist!\n", entry.op.hash.ToString().c_str() );
|
||||||
|
}
|
||||||
obj.push_back(Pair("txid", entry.op.hash.ToString()));
|
obj.push_back(Pair("txid", entry.op.hash.ToString()));
|
||||||
obj.push_back(Pair("amount", ValueFromAmount(CAmount(entry.note.value()))));
|
obj.push_back(Pair("amount", ValueFromAmount(CAmount(entry.note.value()))));
|
||||||
obj.push_back(Pair("memo", HexStr(entry.memo)));
|
obj.push_back(Pair("memo", HexStr(entry.memo)));
|
||||||
obj.push_back(Pair("outindex", (int)entry.op.n));
|
obj.push_back(Pair("outindex", (int)entry.op.n));
|
||||||
|
obj.push_back(Pair("rawconfirmations", entry.confirmations));
|
||||||
|
obj.push_back(Pair("confirmations", komodo_dpowconfs(nHeight, entry.confirmations)));
|
||||||
if (hasSpendingKey) {
|
if (hasSpendingKey) {
|
||||||
obj.push_back(Pair("change", pwalletMain->IsNoteSaplingChange(nullifierSet, entry.address, entry.op)));
|
obj.push_back(Pair("change", pwalletMain->IsNoteSaplingChange(nullifierSet, entry.address, entry.op)));
|
||||||
}
|
}
|
||||||
@@ -5111,6 +5195,7 @@ int32_t ensure_CCrequirements()
|
|||||||
#include "../cc/CCGateways.h"
|
#include "../cc/CCGateways.h"
|
||||||
#include "../cc/CCPrices.h"
|
#include "../cc/CCPrices.h"
|
||||||
#include "../cc/CCHeir.h"
|
#include "../cc/CCHeir.h"
|
||||||
|
#include "../cc/CCMarmara.h"
|
||||||
|
|
||||||
UniValue CCaddress(struct CCcontract_info *cp,char *name,std::vector<unsigned char> &pubkey)
|
UniValue CCaddress(struct CCcontract_info *cp,char *name,std::vector<unsigned char> &pubkey)
|
||||||
{
|
{
|
||||||
@@ -5291,17 +5376,17 @@ UniValue pegsaddress(const UniValue& params, bool fHelp)
|
|||||||
return(CCaddress(cp,(char *)"Pegs",pubkey));
|
return(CCaddress(cp,(char *)"Pegs",pubkey));
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue triggersaddress(const UniValue& params, bool fHelp)
|
UniValue marmaraaddress(const UniValue& params, bool fHelp)
|
||||||
{
|
{
|
||||||
struct CCcontract_info *cp,C; std::vector<unsigned char> pubkey;
|
struct CCcontract_info *cp,C; std::vector<unsigned char> pubkey;
|
||||||
cp = CCinit(&C,EVAL_TRIGGERS);
|
cp = CCinit(&C,EVAL_MARMARA);
|
||||||
if ( fHelp || params.size() > 1 )
|
if ( fHelp || params.size() > 1 )
|
||||||
throw runtime_error("triggersaddress [pubkey]\n");
|
throw runtime_error("Marmaraaddress [pubkey]\n");
|
||||||
if ( ensure_CCrequirements() < 0 )
|
if ( ensure_CCrequirements() < 0 )
|
||||||
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
|
||||||
if ( params.size() == 1 )
|
if ( params.size() == 1 )
|
||||||
pubkey = ParseHex(params[0].get_str().c_str());
|
pubkey = ParseHex(params[0].get_str().c_str());
|
||||||
return(CCaddress(cp,(char *)"Triggers",pubkey));
|
return(CCaddress(cp,(char *)"Marmara",pubkey));
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue paymentsaddress(const UniValue& params, bool fHelp)
|
UniValue paymentsaddress(const UniValue& params, bool fHelp)
|
||||||
|
|||||||
Reference in New Issue
Block a user