fix opreturn_burn merge conflict
This commit is contained in:
338
src/ac.json
Normal file
338
src/ac.json
Normal file
@@ -0,0 +1,338 @@
|
||||
{
|
||||
"REVS": {
|
||||
"ac_supply": "1300000"
|
||||
}
|
||||
,
|
||||
|
||||
"SUPERNET": {
|
||||
"ac_supply": "816061"
|
||||
}
|
||||
,
|
||||
|
||||
"DEX": {
|
||||
"ac_supply": "999999"
|
||||
}
|
||||
,
|
||||
|
||||
"PANGEA": {
|
||||
"ac_supply": "999999"
|
||||
}
|
||||
|
||||
,
|
||||
"JUMBLR": {
|
||||
"ac_supply": "999999"
|
||||
}
|
||||
,
|
||||
|
||||
"BET": {
|
||||
"ac_supply": "999999"
|
||||
}
|
||||
,
|
||||
|
||||
"CRYPTO": {
|
||||
"ac_supply": "999999"
|
||||
}
|
||||
,
|
||||
|
||||
"HODL": {
|
||||
"ac_supply": "9999999"
|
||||
}
|
||||
,
|
||||
|
||||
"MSHARK": {
|
||||
"ac_supply": "1400000"
|
||||
}
|
||||
,
|
||||
|
||||
"BOTS": {
|
||||
"ac_supply": "999999"
|
||||
}
|
||||
,
|
||||
|
||||
"MGW": {
|
||||
"ac_supply": "999999"
|
||||
}
|
||||
,
|
||||
"COQUICASH": {
|
||||
"ac_supply": "72000000",
|
||||
"ac_reward": "7200000000",
|
||||
"ac_staked": "50",
|
||||
"ac_halving": "420000",
|
||||
"ac_cc": "2",
|
||||
"ac_ccenable": "227,235,236,241",
|
||||
"addnode": [
|
||||
"78.47.108.168"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"WLC": {
|
||||
"ac_supply": "210000000"
|
||||
}
|
||||
,
|
||||
|
||||
"KV": {
|
||||
"ac_supply": "1000000"
|
||||
}
|
||||
,
|
||||
|
||||
"CEAL": {
|
||||
"ac_supply": "366666666"
|
||||
}
|
||||
,
|
||||
|
||||
"MESH": {
|
||||
"ac_supply": "1000007"
|
||||
}
|
||||
,
|
||||
|
||||
"AXO": {
|
||||
"ac_supply": "200000000",
|
||||
"ac_ccactivate": "130000"
|
||||
}
|
||||
,
|
||||
|
||||
"ETOMIC": {
|
||||
"ac_supply": "100000000"
|
||||
}
|
||||
,
|
||||
|
||||
"BTCH": {
|
||||
"ac_supply": "20998641"
|
||||
}
|
||||
,
|
||||
|
||||
"PIZZA": {
|
||||
"ac_supply": "100000000"
|
||||
}
|
||||
,
|
||||
|
||||
"BEER": {
|
||||
"ac_supply": "100000000"
|
||||
}
|
||||
,
|
||||
|
||||
"NINJA": {
|
||||
"ac_supply": "100000000"
|
||||
}
|
||||
,
|
||||
|
||||
"OOT": {
|
||||
"ac_supply": "216000000",
|
||||
"ac_sapling": "5000000"
|
||||
}
|
||||
,
|
||||
|
||||
"BNTN": {
|
||||
"ac_supply": "500000000"
|
||||
}
|
||||
,
|
||||
|
||||
"CHAIN": {
|
||||
"ac_supply": "999999"
|
||||
}
|
||||
,
|
||||
|
||||
"PRLPAY": {
|
||||
"ac_supply": "500000000"
|
||||
}
|
||||
,
|
||||
|
||||
"DSEC": {
|
||||
"ac_supply": "7000000"
|
||||
}
|
||||
,
|
||||
|
||||
"GLXT": {
|
||||
"ac_supply": "10000000000"
|
||||
}
|
||||
,
|
||||
|
||||
"EQL": {
|
||||
"ac_supply": "500000000",
|
||||
"ac_ccactivate": "205000"
|
||||
}
|
||||
,
|
||||
|
||||
"ZILLA": {
|
||||
"ac_supply": "11000000",
|
||||
"ac_sapling": "5000000",
|
||||
"addnode": [
|
||||
"51.68.215.104"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"RFOX": {
|
||||
"ac_supply": "1000000000",
|
||||
"ac_reward": "100000000"
|
||||
}
|
||||
,
|
||||
|
||||
"SEC": {
|
||||
"ac_supply": "1000000000",
|
||||
"ac_cc": "333"
|
||||
}
|
||||
,
|
||||
|
||||
"CCL": {
|
||||
"ac_supply": "200000000",
|
||||
"ac_end": "1",
|
||||
"ac_cc": "2",
|
||||
"addressindex": "1",
|
||||
"spentindex": "1",
|
||||
"addnode": [
|
||||
"142.93.136.89",
|
||||
"195.201.22.89"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"PIRATE": {
|
||||
"ac_supply": "0",
|
||||
"ac_reward": "25600000000",
|
||||
"ac_halving": "77777",
|
||||
"ac_private": "1",
|
||||
"addnode": [
|
||||
"136.243.102.225"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"PGT": {
|
||||
"ac_supply": "10000000",
|
||||
"ac_end": "1",
|
||||
"addnode": [
|
||||
"190.114.254.104"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"DION": {
|
||||
"ac_supply": "3900000000",
|
||||
"ac_reward": "22260000000",
|
||||
"ac_staked": "100",
|
||||
"ac_cc": "1",
|
||||
"ac_end": "4300000000",
|
||||
"addnode": [
|
||||
"51.75.124.34"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"KMDICE": {
|
||||
"ac_supply": "10500000",
|
||||
"ac_reward": "2500000000",
|
||||
"ac_halving": "210000",
|
||||
"ac_cc": "2",
|
||||
"addressindex": "1",
|
||||
"spentindex": "1",
|
||||
"addnode": [
|
||||
"144.76.217.232"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"KSB": {
|
||||
"ac_supply": "1000000000",
|
||||
"ac_end": "1",
|
||||
"ac_public": "1",
|
||||
"addnode": [
|
||||
"37.187.225.231"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"OUR": {
|
||||
"ac_reward": "1478310502",
|
||||
"ac_halving": "525600",
|
||||
"ac_cc": "42",
|
||||
"ac_supply": "100000000",
|
||||
"ac_perc": "77700",
|
||||
"ac_staked": "93",
|
||||
"ac_pubkey": "02652a3f3e00b3a1875a918314f0bac838d6dd189a346fa623f5efe9541ac0b98c",
|
||||
"ac_public": "1",
|
||||
"addnode": [
|
||||
"51.255.195.65",
|
||||
"217.182.129.38",
|
||||
"37.187.225.231"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"ILN": {
|
||||
"ac_supply": "10000000000",
|
||||
"ac_cc": "2",
|
||||
"addnode": ["51.75.122.83"]
|
||||
}
|
||||
,
|
||||
|
||||
"RICK": {
|
||||
"ac_supply": "90000000000",
|
||||
"ac_reward": "100000000",
|
||||
"ac_cc": "3",
|
||||
"addnode": ["138.201.136.145"]
|
||||
}
|
||||
,
|
||||
|
||||
"MORTY": {
|
||||
"ac_supply": "90000000000",
|
||||
"ac_reward": "100000000",
|
||||
"ac_cc": "3",
|
||||
"addnode": ["138.201.136.145"]
|
||||
}
|
||||
,
|
||||
|
||||
"KOIN": {
|
||||
"ac_supply": "125000000",
|
||||
"addnode": ["3.0.32.10"]
|
||||
}
|
||||
,
|
||||
|
||||
"ZEXO": {
|
||||
"ac_reward": "1478310502",
|
||||
"ac_halving": "525600",
|
||||
"ac_cc": "42",
|
||||
"ac_ccenable": "236",
|
||||
"ac_supply": "100000000",
|
||||
"ac_perc": "77700",
|
||||
"ac_staked": "93",
|
||||
"ac_pubkey": "02713bd85e054db923694b6b7a85306264edf4d6bd6d331814f2b40af444b3ebbc",
|
||||
"ac_public": "1",
|
||||
"addnode": [
|
||||
"195.201.20.230",
|
||||
"80.240.17.222"
|
||||
]
|
||||
}
|
||||
,
|
||||
|
||||
"K64": {
|
||||
"ac_reward": "0",
|
||||
"ac_supply": "64000777",
|
||||
"ac_staked": "10",
|
||||
"addnode": ["18.197.20.21"]
|
||||
}
|
||||
,
|
||||
|
||||
"HUSH3": {
|
||||
"ac_sapling": "1",
|
||||
"ac_founders": "1",
|
||||
"ac_reward": "0,1125000000,562500000",
|
||||
"ac_end": "128,340000,5422111",
|
||||
"ac_blocktime": "150",
|
||||
"ac_supply": "6178674",
|
||||
"ac_halving": "129,340000,840000",
|
||||
"ac_cc": "2",
|
||||
"ac_cclib": "hush3",
|
||||
"ac_ccenable": "228,234,235,236,241",
|
||||
"ac_perc": "11111111",
|
||||
"ac_eras": "3",
|
||||
"ac_script": "76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac",
|
||||
"clientname": "GoldenSandtrout",
|
||||
"addnode": [
|
||||
"188.165.212.101",
|
||||
"136.243.227.142",
|
||||
"5.9.224.250"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -44,9 +44,16 @@
|
||||
"ac_supply": "999999"
|
||||
},
|
||||
{
|
||||
"ac_name": "COQUI",
|
||||
"ac_name": "COQUICASH",
|
||||
"ac_supply": "72000000",
|
||||
"ac_ccactivate": "200000"
|
||||
"ac_reward": "7200000000",
|
||||
"ac_staked": "50",
|
||||
"ac_halving": "420000",
|
||||
"ac_cc": "2",
|
||||
"ac_ccenable": "227,235,236,241",
|
||||
"addnode": [
|
||||
"78.47.108.168"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ac_name": "WLC",
|
||||
@@ -235,12 +242,6 @@
|
||||
"ac_cc": "3",
|
||||
"addnode": ["138.201.136.145"]
|
||||
},
|
||||
{
|
||||
"ac_name": "VOTE2019",
|
||||
"ac_supply": "123651638",
|
||||
"ac_public": "1",
|
||||
"addnode": ["95.213.238.98"]
|
||||
},
|
||||
{
|
||||
"ac_name": "KOIN",
|
||||
"ac_supply": "125000000",
|
||||
@@ -268,5 +269,27 @@
|
||||
"ac_supply": "64000777",
|
||||
"ac_staked": "10",
|
||||
"addnode": ["18.197.20.21"]
|
||||
},
|
||||
{
|
||||
"ac_name": "HUSH3",
|
||||
"ac_sapling": "1",
|
||||
"ac_founders": "1",
|
||||
"ac_reward": "0,1125000000,562500000",
|
||||
"ac_end": "128,340000,5422111",
|
||||
"ac_blocktime": "150",
|
||||
"ac_supply": "6178674",
|
||||
"ac_halving": "129,340000,840000",
|
||||
"ac_cc": "2",
|
||||
"ac_cclib": "hush3",
|
||||
"ac_ccenable": "228,234,235,236,241",
|
||||
"ac_perc": "11111111",
|
||||
"ac_eras": "3",
|
||||
"ac_script": "76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac",
|
||||
"clientname": "GoldenSandtrout",
|
||||
"addnode": [
|
||||
"188.165.212.101",
|
||||
"136.243.227.142",
|
||||
"5.9.224.250"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -52,3 +52,4 @@ echo $pubkey
|
||||
./komodod -pubkey=$pubkey -ac_name=KOIN -ac_supply=125000000 -addnode=3.0.32.10 &
|
||||
./komodod -pubkey=$pubkey -ac_name=ZEXO -ac_supply=100000000 -ac_reward=1478310502 -ac_halving=525600 -ac_cc=42 -ac_ccenable=236 -ac_perc=77700 -ac_staked=93 -ac_pubkey=02713bd85e054db923694b6b7a85306264edf4d6bd6d331814f2b40af444b3ebbc -ac_public=1 -addnode=80.240.17.222 &
|
||||
./komodod -pubkey=$pubkey -ac_name=K64 -ac_supply=64000777 -ac_reward=0 -ac_staked=10 -addnode=18.197.20.211 &
|
||||
./komodod -pubkey=$pubkey -ac_name=HUSH3 -ac_sapling=1 -ac_reward=0,1125000000,562500000 -ac_halving=129,340000,840000 -ac_end=128,340000,5422111 -ac_eras=3 -ac_blocktime=150 -ac_cc=2 -ac_ccenable=228,234,235,236,241 -ac_founders=1 -ac_supply=6178674 -ac_perc=11111111 -clientname=GoldenSandtrout -addnode=188.165.212.101 -addnode=136.243.227.142 -addnode=5.9.224.250 -ac_cclib=hush3 -ac_script=76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac &
|
||||
|
||||
@@ -72,7 +72,7 @@ void WaitForShutdown(boost::thread_group* threadGroup)
|
||||
// Tell the main threads to shutdown.
|
||||
if (komodo_currentheight()>KOMODO_EARLYTXID_HEIGHT && KOMODO_EARLYTXID!=zeroid && ((height=tx_height(KOMODO_EARLYTXID))==0 || height>KOMODO_EARLYTXID_HEIGHT))
|
||||
{
|
||||
fprintf(stderr,"error: earlytx must be before block height 100 or tx does not exist\n");
|
||||
fprintf(stderr,"error: earlytx must be before block height %d or tx does not exist\n",KOMODO_EARLYTXID_HEIGHT);
|
||||
StartShutdown();
|
||||
}
|
||||
if ( ASSETCHAINS_CBOPRET != 0 )
|
||||
|
||||
@@ -39,7 +39,7 @@ UniValue AssetOrders(uint256 refassetid, CPubKey pk, uint8_t additionalEvalCode)
|
||||
|
||||
txid = it->first.txhash;
|
||||
LOGSTREAM("ccassets", CCLOG_DEBUG2, stream << "addOrders() checking txid=" << txid.GetHex() << std::endl);
|
||||
if ( GetTransaction(txid, ordertx, hashBlock, false) != 0 )
|
||||
if ( myGetTransaction(txid, ordertx, hashBlock) != 0 )
|
||||
{
|
||||
// for logging: funcid = DecodeAssetOpRet(vintx.vout[vintx.vout.size() - 1].scriptPubKey, evalCode, assetid, assetid2, price, origpubkey);
|
||||
if (ordertx.vout.size() > 0 && (funcid = DecodeAssetTokenOpRet(ordertx.vout[ordertx.vout.size()-1].scriptPubKey, evalCode, assetid, assetid2, price, origpubkey)) != 0)
|
||||
@@ -273,7 +273,7 @@ std::string CreateBuyOffer(int64_t txfee, int64_t bidamount, uint256 assetid, in
|
||||
fprintf(stderr,"negative bidamount %lld, pricetotal %lld\n", (long long)bidamount, (long long)pricetotal);
|
||||
return("");
|
||||
}
|
||||
if (GetTransaction(assetid, vintx, hashBlock, false) == 0)
|
||||
if (myGetTransaction(assetid, vintx, hashBlock) == 0)
|
||||
{
|
||||
fprintf(stderr,"cant find assetid\n");
|
||||
return("");
|
||||
@@ -470,7 +470,7 @@ std::string CancelBuyOffer(int64_t txfee,uint256 assetid,uint256 bidtxid)
|
||||
if (AddNormalinputs(mtx, mypk, txfee, 3) > 0)
|
||||
{
|
||||
mask = ~((1LL << mtx.vin.size()) - 1);
|
||||
if (GetTransaction(bidtxid, vintx, hashBlock, false) != 0)
|
||||
if (myGetTransaction(bidtxid, vintx, hashBlock) != 0)
|
||||
{
|
||||
std::vector<uint8_t> vopretNonfungible;
|
||||
GetNonfungibleData(assetid, vopretNonfungible);
|
||||
@@ -520,7 +520,7 @@ std::string CancelSell(int64_t txfee,uint256 assetid,uint256 asktxid)
|
||||
if (AddNormalinputs(mtx, mypk, txfee, 3) > 0)
|
||||
{
|
||||
mask = ~((1LL << mtx.vin.size()) - 1);
|
||||
if (GetTransaction(asktxid, vintx, hashBlock, false) != 0)
|
||||
if (myGetTransaction(asktxid, vintx, hashBlock) != 0)
|
||||
{
|
||||
std::vector<uint8_t> vopretNonfungible;
|
||||
GetNonfungibleData(assetid, vopretNonfungible);
|
||||
@@ -594,7 +594,7 @@ std::string FillBuyOffer(int64_t txfee,uint256 assetid,uint256 bidtxid,int64_t f
|
||||
if (AddNormalinputs(mtx, mypk, 2*txfee, 3) > 0)
|
||||
{
|
||||
mask = ~((1LL << mtx.vin.size()) - 1);
|
||||
if (GetTransaction(bidtxid, vintx, hashBlock, false) != 0)
|
||||
if (myGetTransaction(bidtxid, vintx, hashBlock) != 0)
|
||||
{
|
||||
bidamount = vintx.vout[bidvout].nValue;
|
||||
SetAssetOrigpubkey(origpubkey, origprice, vintx);
|
||||
@@ -697,7 +697,7 @@ std::string FillSell(int64_t txfee, uint256 assetid, uint256 assetid2, uint256 a
|
||||
//if (AddNormalinputs(mtx, mypk, 2*txfee, 3) > 0)
|
||||
//{
|
||||
//mask = ~((1LL << mtx.vin.size()) - 1);
|
||||
if (GetTransaction(asktxid, vintx, hashBlock, false) != 0)
|
||||
if (myGetTransaction(asktxid, vintx, hashBlock) != 0)
|
||||
{
|
||||
orig_assetoshis = vintx.vout[askvout].nValue;
|
||||
SetAssetOrigpubkey(origpubkey, total_nValue, vintx);
|
||||
|
||||
@@ -52,9 +52,11 @@ one other technical note is that komodod has the insight-explorer extensions bui
|
||||
#include "../utlist.h"
|
||||
#include "../uthash.h"
|
||||
#include "merkleblock.h"
|
||||
#include "../komodo_nSPV_defs.h"
|
||||
|
||||
#define CC_BURNPUBKEY "02deaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead"
|
||||
#define CC_MAXVINS 1024
|
||||
#define CC_REQUIREMENTS_MSG (KOMODO_NSPV!=0?"to use CC contracts you need to nspv_login first\n":"to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n")
|
||||
|
||||
#define SMALLVAL 0.000000000000001
|
||||
#define SATOSHIDEN ((uint64_t)100000000L)
|
||||
@@ -151,6 +153,7 @@ struct oracleprice_info
|
||||
};
|
||||
|
||||
typedef std::vector<uint8_t> vscript_t;
|
||||
extern struct NSPV_CCmtxinfo NSPV_U;
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
extern CWallet* pwalletMain;
|
||||
@@ -287,6 +290,7 @@ extern std::vector<CPubKey> NULL_pubkeys;
|
||||
std::string FinalizeCCTx(uint64_t skipmask,struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey mypk,uint64_t txfee,CScript opret,std::vector<CPubKey> pubkeys = NULL_pubkeys);
|
||||
void SetCCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &unspentOutputs,char *coinaddr,bool CCflag = true);
|
||||
void SetCCtxids(std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex,char *coinaddr,bool CCflag = true);
|
||||
int64_t NSPV_AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int32_t maxinputs,struct NSPV_CCmtxinfo *ptr);
|
||||
int64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int32_t maxinputs);
|
||||
int64_t AddNormalinputs2(CMutableTransaction &mtx,int64_t total,int32_t maxinputs);
|
||||
int64_t CCutxovalue(char *coinaddr,uint256 utxotxid,int32_t utxovout,int32_t CCflag);
|
||||
|
||||
@@ -654,7 +654,7 @@ int64_t AddTokenCCInputs(struct CCcontract_info *cp, CMutableTransaction &mtx, C
|
||||
if (ivin != mtx.vin.size()) // that is, the tx.vout is already added to mtx.vin (in some previous calls)
|
||||
continue;
|
||||
|
||||
if (GetTransaction(vintxid, vintx, hashBlock, false) != 0)
|
||||
if (myGetTransaction(vintxid, vintx, hashBlock) != 0)
|
||||
{
|
||||
Getscriptaddress(destaddr, vintx.vout[vout].scriptPubKey);
|
||||
if (strcmp(destaddr, tokenaddr) != 0 &&
|
||||
@@ -870,7 +870,12 @@ std::string TokenTransfer(int64_t txfee, uint256 tokenid, vscript_t destpubkey,
|
||||
if (txfee == 0)
|
||||
txfee = 10000;
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
if (AddNormalinputs(mtx, mypk, txfee, 3) > 0)
|
||||
/*if ( cp->tokens1of2addr[0] == 0 )
|
||||
{
|
||||
GetTokensCCaddress(cp, cp->tokens1of2addr, mypk);
|
||||
fprintf(stderr,"set tokens1of2addr <- %s\n",cp->tokens1of2addr);
|
||||
}*/
|
||||
if (AddNormalinputs(mtx, mypk, txfee, 3) > 0)
|
||||
{
|
||||
mask = ~((1LL << mtx.vin.size()) - 1); // seems, mask is not used anymore
|
||||
|
||||
@@ -920,7 +925,7 @@ int64_t GetTokenBalance(CPubKey pk, uint256 tokenid)
|
||||
// CCerror = strprintf("obsolete, cannot return correct value without eval");
|
||||
// return 0;
|
||||
|
||||
if (GetTransaction(tokenid, tokentx, hashBlock, false) == 0)
|
||||
if (myGetTransaction(tokenid, tokentx, hashBlock) == 0)
|
||||
{
|
||||
LOGSTREAM((char *)"cctokens", CCLOG_INFO, stream << "cant find tokenid" << std::endl);
|
||||
CCerror = strprintf("cant find tokenid");
|
||||
@@ -945,14 +950,14 @@ UniValue TokenInfo(uint256 tokenid)
|
||||
|
||||
cpTokens = CCinit(&tokensCCinfo, EVAL_TOKENS);
|
||||
|
||||
if( !GetTransaction(tokenid, tokenbaseTx, hashBlock, false) )
|
||||
if( !myGetTransaction(tokenid, tokenbaseTx, hashBlock) )
|
||||
{
|
||||
fprintf(stderr, "TokenInfo() cant find tokenid\n");
|
||||
result.push_back(Pair("result", "error"));
|
||||
result.push_back(Pair("error", "cant find tokenid"));
|
||||
return(result);
|
||||
}
|
||||
if (hashBlock.IsNull()) {
|
||||
if ( KOMODO_NSPV == 0 && hashBlock.IsNull()) {
|
||||
result.push_back(Pair("result", "error"));
|
||||
result.push_back(Pair("error", "the transaction is still in mempool"));
|
||||
return(result);
|
||||
@@ -1031,7 +1036,7 @@ UniValue TokenList()
|
||||
cp = CCinit(&C, EVAL_TOKENS);
|
||||
|
||||
auto addTokenId = [&](uint256 txid) {
|
||||
if (GetTransaction(txid, vintx, hashBlock, false) != 0) {
|
||||
if (myGetTransaction(txid, vintx, hashBlock) != 0) {
|
||||
if (vintx.vout.size() > 0 && DecodeTokenCreateOpRet(vintx.vout[vintx.vout.size() - 1].scriptPubKey, origpubkey, name, description) != 0) {
|
||||
result.push_back(txid.GetHex());
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "key_io.h"
|
||||
|
||||
std::vector<CPubKey> NULL_pubkeys;
|
||||
struct NSPV_CCmtxinfo NSPV_U;
|
||||
|
||||
/*
|
||||
FinalizeCCTx is a very useful function that will properly sign both CC and normal inputs, adds normal change and the opreturn.
|
||||
@@ -45,7 +46,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
||||
auto consensusBranchId = CurrentEpochBranchId(chainActive.Height() + 1, Params().GetConsensus());
|
||||
CTransaction vintx; std::string hex; CPubKey globalpk; uint256 hashBlock; uint64_t mask=0,nmask=0,vinimask=0;
|
||||
int64_t utxovalues[CC_MAXVINS],change,normalinputs=0,totaloutputs=0,normaloutputs=0,totalinputs=0,normalvins=0,ccvins=0;
|
||||
int32_t i,flag,utxovout,n,err = 0;
|
||||
int32_t i,flag,mgret,utxovout,n,err = 0;
|
||||
char myaddr[64], destaddr[64], unspendable[64], mytokensaddr[64], mysingletokensaddr[64], unspendabletokensaddr[64],CC1of2CCaddr[64];
|
||||
uint8_t *privkey, myprivkey[32], unspendablepriv[32], /*tokensunspendablepriv[32],*/ *msg32 = 0;
|
||||
CC *mycond=0, *othercond=0, *othercond2=0,*othercond4=0, *othercond3=0, *othercond1of2=NULL, *othercond1of2tokens = NULL, *cond=0, *condCC2=0,*mytokenscond = NULL, *mysingletokenscond = NULL, *othertokenscond = NULL;
|
||||
@@ -96,13 +97,19 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
||||
//This is a must to avoid hardfork change of validation in every CC, because there could be maximum one normal vin at the begining with current validation.
|
||||
for (i=0; i<n; i++)
|
||||
{
|
||||
if (i==0 && mtx.vin[i].prevout.n==10e8) continue;
|
||||
if ( GetTransaction(mtx.vin[i].prevout.hash,vintx,hashBlock,false) != 0 )
|
||||
if (i==0 && mtx.vin[i].prevout.n==10e8)
|
||||
continue;
|
||||
if ( myGetTransaction(mtx.vin[i].prevout.hash,vintx,hashBlock) != 0 && mtx.vin[i].prevout.n < vintx.vout.size() )
|
||||
{
|
||||
if ( vintx.vout[mtx.vin[i].prevout.n].scriptPubKey.IsPayToCryptoCondition() == 0 && ccvins==0)
|
||||
normalvins++;
|
||||
else ccvins++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"vin.%d vout.%d is bigger than vintx.%d\n",i,mtx.vin[i].prevout.n,(int32_t)vintx.vout.size());
|
||||
return("");
|
||||
}
|
||||
}
|
||||
if (normalvins>1 && ccvins)
|
||||
{
|
||||
@@ -116,7 +123,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
||||
for (i=0; i<n; i++)
|
||||
{
|
||||
if (i==0 && mtx.vin[i].prevout.n==10e8) continue;
|
||||
if ( GetTransaction(mtx.vin[i].prevout.hash,vintx,hashBlock,false) != 0 )
|
||||
if ( (mgret= myGetTransaction(mtx.vin[i].prevout.hash,vintx,hashBlock)) != 0 )
|
||||
{
|
||||
utxovout = mtx.vin[i].prevout.n;
|
||||
utxovalues[i] = vintx.vout[utxovout].nValue;
|
||||
@@ -131,7 +138,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
||||
{
|
||||
mask |= (1LL << i);
|
||||
}
|
||||
} else fprintf(stderr,"FinalizeCCTx couldnt find %s\n",mtx.vin[i].prevout.hash.ToString().c_str());
|
||||
} else fprintf(stderr,"FinalizeCCTx couldnt find %s mgret.%d\n",mtx.vin[i].prevout.hash.ToString().c_str(),mgret);
|
||||
}
|
||||
nmask = (1LL << n) - 1;
|
||||
if ( 0 && (mask & nmask) != (CCmask & nmask) )
|
||||
@@ -148,8 +155,9 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
||||
n = mtx.vin.size();
|
||||
for (i=0; i<n; i++)
|
||||
{
|
||||
if (i==0 && mtx.vin[i].prevout.n==10e8) continue;
|
||||
if ( GetTransaction(mtx.vin[i].prevout.hash,vintx,hashBlock,false) != 0 )
|
||||
if (i==0 && mtx.vin[i].prevout.n==10e8)
|
||||
continue;
|
||||
if ( (mgret= myGetTransaction(mtx.vin[i].prevout.hash,vintx,hashBlock)) != 0 )
|
||||
{
|
||||
utxovout = mtx.vin[i].prevout.n;
|
||||
if ( vintx.vout[utxovout].scriptPubKey.IsPayToCryptoCondition() == 0 )
|
||||
@@ -161,6 +169,11 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
char addr[64];
|
||||
Getscriptaddress(addr,vintx.vout[utxovout].scriptPubKey);
|
||||
fprintf(stderr,"vout[%d] %.8f -> %s\n",utxovout,dstr(vintx.vout[utxovout].nValue),addr);
|
||||
}
|
||||
if ( NSPV_SignTx(mtx,i,vintx.vout[utxovout].nValue,vintx.vout[utxovout].scriptPubKey,0) == 0 )
|
||||
fprintf(stderr,"NSPV signing error for vini.%d of %llx\n",i,(long long)vinimask);
|
||||
}
|
||||
@@ -168,11 +181,11 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
||||
else
|
||||
{
|
||||
Getscriptaddress(destaddr,vintx.vout[utxovout].scriptPubKey);
|
||||
//fprintf(stderr,"FinalizeCCTx() vin.%d is CC %.8f -> (%s) vs %s\n",i,(double)utxovalues[i]/COIN,destaddr,cp->unspendableaddr2);
|
||||
//fprintf(stderr,"FinalizeCCTx() vin.%d is CC %.8f -> (%s) vs %s\n",i,(double)utxovalues[i]/COIN,destaddr,mysingletokensaddr);
|
||||
//std::cerr << "FinalizeCCtx() searching destaddr=" << destaddr << " for vin[" << i << "] satoshis=" << utxovalues[i] << std::endl;
|
||||
if( strcmp(destaddr, myaddr) == 0 )
|
||||
{
|
||||
//fprintf(stderr, "FinalizeCCTx() matched cc myaddr (%s)\n", myaddr);
|
||||
//fprintf(stderr, "FinalizeCCTx() matched cc myaddr (%s)\n", myaddr);
|
||||
privkey = myprivkey;
|
||||
cond = mycond;
|
||||
}
|
||||
@@ -180,30 +193,30 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
||||
{
|
||||
privkey = myprivkey;
|
||||
cond = mytokenscond;
|
||||
//fprintf(stderr,"FinalizeCCTx() matched dual-eval TokensCC1vout my token addr.(%s)\n",mytokensaddr);
|
||||
//fprintf(stderr,"FinalizeCCTx() matched dual-eval TokensCC1vout my token addr.(%s)\n",mytokensaddr);
|
||||
}
|
||||
else if (strcmp(destaddr, mysingletokensaddr) == 0) // if this is TokensCC1vout
|
||||
{
|
||||
privkey = myprivkey;
|
||||
cond = mysingletokenscond;
|
||||
//fprintf(stderr, "FinalizeCCTx() matched single-eval token CC1vout my token addr.(%s)\n", mytokensaddr);
|
||||
//fprintf(stderr, "FinalizeCCTx() matched single-eval token CC1vout my token addr.(%s)\n", mytokensaddr);
|
||||
}
|
||||
else if ( strcmp(destaddr,unspendable) == 0 )
|
||||
{
|
||||
privkey = unspendablepriv;
|
||||
cond = othercond;
|
||||
//fprintf(stderr,"FinalizeCCTx evalcode(%d) matched unspendable CC addr.(%s)\n",cp->evalcode,unspendable);
|
||||
//fprintf(stderr,"FinalizeCCTx evalcode(%d) matched unspendable CC addr.(%s)\n",cp->evalcode,unspendable);
|
||||
}
|
||||
else if (strcmp(destaddr, unspendabletokensaddr) == 0)
|
||||
{
|
||||
privkey = unspendablepriv;
|
||||
cond = othertokenscond;
|
||||
//fprintf(stderr,"FinalizeCCTx() matched unspendabletokensaddr dual/three-eval CC addr.(%s)\n",unspendabletokensaddr);
|
||||
//fprintf(stderr,"FinalizeCCTx() matched unspendabletokensaddr dual/three-eval CC addr.(%s)\n",unspendabletokensaddr);
|
||||
}
|
||||
// check if this is the 2nd additional evalcode + 'unspendable' cc addr:
|
||||
else if ( strcmp(destaddr, cp->unspendableaddr2) == 0)
|
||||
{
|
||||
//fprintf(stderr,"FinalizeCCTx() matched %s unspendable2!\n",cp->unspendableaddr2);
|
||||
//fprintf(stderr,"FinalizeCCTx() matched %s unspendable2!\n",cp->unspendableaddr2);
|
||||
privkey = cp->unspendablepriv2;
|
||||
if( othercond2 == 0 )
|
||||
othercond2 = MakeCCcond1(cp->unspendableEvalcode2, cp->unspendablepk2);
|
||||
@@ -212,7 +225,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
||||
// check if this is 3rd additional evalcode + 'unspendable' cc addr:
|
||||
else if ( strcmp(destaddr,cp->unspendableaddr3) == 0 )
|
||||
{
|
||||
//fprintf(stderr,"FinalizeCCTx() matched %s unspendable3!\n",cp->unspendableaddr3);
|
||||
//fprintf(stderr,"FinalizeCCTx() matched %s unspendable3!\n",cp->unspendableaddr3);
|
||||
privkey = cp->unspendablepriv3;
|
||||
if( othercond3 == 0 )
|
||||
othercond3 = MakeCCcond1(cp->unspendableEvalcode3, cp->unspendablepk3);
|
||||
@@ -221,7 +234,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
||||
// check if this is spending from 1of2 cc coins addr:
|
||||
else if (strcmp(cp->coins1of2addr, destaddr) == 0)
|
||||
{
|
||||
//fprintf(stderr,"FinalizeCCTx() matched %s unspendable1of2!\n",cp->coins1of2addr);
|
||||
//fprintf(stderr,"FinalizeCCTx() matched %s unspendable1of2!\n",cp->coins1of2addr);
|
||||
privkey = cp->coins1of2priv;//myprivkey;
|
||||
if (othercond1of2 == 0)
|
||||
othercond1of2 = MakeCCcond1of2(cp->evalcode, cp->coins1of2pk[0], cp->coins1of2pk[1]);
|
||||
@@ -229,7 +242,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
||||
}
|
||||
else if ( strcmp(CC1of2CCaddr,destaddr) == 0 )
|
||||
{
|
||||
//fprintf(stderr,"FinalizeCCTx() matched %s CC1of2CCaddr!\n",CC1of2CCaddr);
|
||||
//fprintf(stderr,"FinalizeCCTx() matched %s CC1of2CCaddr!\n",CC1of2CCaddr);
|
||||
privkey = unspendablepriv;
|
||||
if (condCC2 == 0)
|
||||
condCC2 = MakeCCcond1of2(cp->evalcode,unspendablepk,unspendablepk);
|
||||
@@ -238,7 +251,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
||||
// check if this is spending from 1of2 cc tokens addr:
|
||||
else if (strcmp(cp->tokens1of2addr, destaddr) == 0)
|
||||
{
|
||||
//fprintf(stderr,"FinalizeCCTx() matched %s cp->tokens1of2addr!\n", cp->tokens1of2addr);
|
||||
//fprintf(stderr,"FinalizeCCTx() matched %s cp->tokens1of2addr!\n", cp->tokens1of2addr);
|
||||
privkey = cp->tokens1of2priv;//myprivkey;
|
||||
if (othercond1of2tokens == 0)
|
||||
// NOTE: if additionalEvalcode2 is not set then it is dual-eval cc else three-eval cc
|
||||
@@ -263,32 +276,34 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
||||
cond = othercond4;
|
||||
flag = 1;
|
||||
}
|
||||
}
|
||||
} //else privkey = myprivkey;
|
||||
|
||||
if ( flag == 0 )
|
||||
{
|
||||
fprintf(stderr,"CC signing error: vini.%d has unknown CC address.(%s)\n",i,destaddr);
|
||||
return("");
|
||||
}
|
||||
}
|
||||
uint256 sighash = SignatureHash(CCPubKey(cond), mtx, i, SIGHASH_ALL, utxovalues[i],consensusBranchId, &txdata);
|
||||
uint256 sighash = SignatureHash(CCPubKey(cond), mtx, i, SIGHASH_ALL,utxovalues[i],consensusBranchId, &txdata);
|
||||
int32_t z;
|
||||
for (z=0; z<32; z++)
|
||||
fprintf(stderr,"%02x",privkey[z]);
|
||||
fprintf(stderr," privkey, ");
|
||||
for (z=0; z<32; z++)
|
||||
fprintf(stderr,"%02x",((uint8_t *)sighash.begin())[z]);
|
||||
fprintf(stderr," sighash [%d] %.8f %x\n",i,(double)utxovalues[i]/COIN,consensusBranchId);
|
||||
if ( cc_signTreeSecp256k1Msg32(cond,privkey,sighash.begin()) != 0 )
|
||||
{
|
||||
//int32_t z;
|
||||
//for (z=0; z<32; z++)
|
||||
// fprintf(stderr,"%02x",((uint8_t *)sighash.begin())[z]);
|
||||
//fprintf(stderr," sighash, ");
|
||||
//for (z=0; z<32; z++)
|
||||
// fprintf(stderr,"%02x",privkey[z]);
|
||||
//fprintf(stderr," signed with privkey\n");
|
||||
mtx.vin[i].scriptSig = CCSig(cond);
|
||||
mtx.vin[i].scriptSig = CCSig(cond);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"vini.%d has CC signing error address.(%s)\n",i,destaddr);
|
||||
fprintf(stderr,"vini.%d has CC signing error address.(%s) %s\n",i,destaddr,EncodeHexTx(mtx).c_str());
|
||||
memset(myprivkey,0,sizeof(myprivkey));
|
||||
return("");
|
||||
}
|
||||
}
|
||||
} else fprintf(stderr,"FinalizeCCTx couldnt find %s\n",mtx.vin[i].prevout.hash.ToString().c_str());
|
||||
} else fprintf(stderr,"FinalizeCCTx2 couldnt find %s mgret.%d\n",mtx.vin[i].prevout.hash.ToString().c_str(),mgret);
|
||||
}
|
||||
if ( mycond != 0 )
|
||||
cc_free(mycond);
|
||||
@@ -312,15 +327,23 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
||||
cc_free(mysingletokenscond);
|
||||
if ( othertokenscond != 0 )
|
||||
cc_free(othertokenscond);
|
||||
memset(myprivkey,0,sizeof(myprivkey));
|
||||
std::string strHex = EncodeHexTx(mtx);
|
||||
if ( strHex.size() > 0 )
|
||||
return(strHex);
|
||||
else return("0");
|
||||
}
|
||||
|
||||
void NSPV_CCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &unspentOutputs,char *coinaddr,bool ccflag);
|
||||
|
||||
void SetCCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &unspentOutputs,char *coinaddr,bool ccflag)
|
||||
{
|
||||
int32_t type=0,i,n; char *ptr; std::string addrstr; uint160 hashBytes; std::vector<std::pair<uint160, int> > addresses;
|
||||
if ( KOMODO_NSPV != 0 )
|
||||
{
|
||||
NSPV_CCunspents(unspentOutputs,coinaddr,ccflag);
|
||||
return;
|
||||
}
|
||||
n = (int32_t)strlen(coinaddr);
|
||||
addrstr.resize(n+1);
|
||||
ptr = (char *)addrstr.data();
|
||||
@@ -523,9 +546,7 @@ int64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int3
|
||||
{
|
||||
int32_t abovei,belowi,ind,vout,i,n = 0; int64_t sum,threshold,above,below; int64_t remains,nValue,totalinputs = 0; uint256 txid,hashBlock; std::vector<COutput> vecOutputs; CTransaction tx; struct CC_utxo *utxos,*up;
|
||||
if ( KOMODO_NSPV != 0 )
|
||||
{
|
||||
//return(NSPV_addinputs(struct NSPV_utxoresp *used,CMutableTransaction &mtx,int64_t total,int32_t maxinputs,struct NSPV_utxoresp *ptr,int32_t num));
|
||||
}
|
||||
return(NSPV_AddNormalinputs(mtx,mypk,total,maxinputs,&NSPV_U));
|
||||
#ifdef ENABLE_WALLET
|
||||
assert(pwalletMain != NULL);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
@@ -622,9 +643,7 @@ int64_t AddNormalinputs2(CMutableTransaction &mtx,int64_t total,int32_t maxinput
|
||||
int32_t abovei,belowi,ind,vout,i,n = 0; int64_t sum,threshold,above,below; int64_t remains,nValue,totalinputs = 0; char coinaddr[64]; uint256 txid,hashBlock; CTransaction tx; struct CC_utxo *utxos,*up;
|
||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||
if ( KOMODO_NSPV != 0 )
|
||||
{
|
||||
//return(NSPV_addinputs(struct NSPV_utxoresp *used,CMutableTransaction &mtx,int64_t total,int32_t maxinputs,struct NSPV_utxoresp *ptr,int32_t num));
|
||||
}
|
||||
return(NSPV_AddNormalinputs(mtx,pubkey2pk(Mypubkey()),total,maxinputs,&NSPV_U));
|
||||
utxos = (struct CC_utxo *)calloc(CC_MAXVINS,sizeof(*utxos));
|
||||
if ( maxinputs > CC_MAXVINS )
|
||||
maxinputs = CC_MAXVINS;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
#include "CCinclude.h"
|
||||
#include "komodo_structs.h"
|
||||
#include "key_io.h"
|
||||
|
||||
#ifdef TESTMODE
|
||||
#define MIN_NON_NOTARIZED_CONFIRMS 2
|
||||
@@ -208,10 +209,14 @@ void CCaddrTokens1of2set(struct CCcontract_info *cp, CPubKey pk1, CPubKey pk2, u
|
||||
bool Getscriptaddress(char *destaddr,const CScript &scriptPubKey)
|
||||
{
|
||||
CTxDestination address; txnouttype whichType;
|
||||
if ( ExtractDestination(scriptPubKey,address) != 0 )
|
||||
destaddr[0] = 0;
|
||||
if ( scriptPubKey.begin() != 0 )
|
||||
{
|
||||
strcpy(destaddr,(char *)CBitcoinAddress(address).ToString().c_str());
|
||||
return(true);
|
||||
if ( ExtractDestination(scriptPubKey,address) != 0 )
|
||||
{
|
||||
strcpy(destaddr,(char *)CBitcoinAddress(address).ToString().c_str());
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
//fprintf(stderr,"ExtractDestination failed\n");
|
||||
return(false);
|
||||
@@ -438,13 +443,19 @@ std::vector<uint8_t> Mypubkey()
|
||||
return(pubkey);
|
||||
}
|
||||
|
||||
extern CKey NSPV_key;
|
||||
extern char NSPV_wifstr[],NSPV_pubkeystr[];
|
||||
|
||||
bool Myprivkey(uint8_t myprivkey[])
|
||||
{
|
||||
char coinaddr[64],checkaddr[64]; std::string strAddress; char *dest; int32_t i,n; CBitcoinAddress address; CKeyID keyID; CKey vchSecret; uint8_t buf33[33];
|
||||
if ( KOMODO_NSPV != 0 )
|
||||
{
|
||||
NSPV_key.SetKey32(myprivkey);
|
||||
vchSecret = DecodeSecret(NSPV_wifstr);
|
||||
memcpy(myprivkey,vchSecret.begin(),32);
|
||||
//for (i=0; i<32; i++)
|
||||
// fprintf(stderr,"%02x",myprivkey[i]);
|
||||
//fprintf(stderr," myprivkey %s\n",NSPV_wifstr);
|
||||
memset((uint8_t *)vchSecret.begin(),0,32);
|
||||
return true;
|
||||
}
|
||||
if ( Getscriptaddress(coinaddr,CScript() << Mypubkey() << OP_CHECKSIG) != 0 )
|
||||
@@ -461,6 +472,7 @@ bool Myprivkey(uint8_t myprivkey[])
|
||||
if ( pwalletMain->GetKey(keyID,vchSecret) != 0 )
|
||||
{
|
||||
memcpy(myprivkey,vchSecret.begin(),32);
|
||||
memset((uint8_t *)vchSecret.begin(),0,32);
|
||||
if ( 0 )
|
||||
{
|
||||
for (i=0; i<32; i++)
|
||||
|
||||
@@ -131,7 +131,7 @@ int64_t AddAuctionInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPu
|
||||
// prevent dup
|
||||
if ( it->second.satoshis < 1000000 )
|
||||
continue;
|
||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
|
||||
{
|
||||
if ( (nValue= IsAuctionvout(cp,vintx,(int32_t)it->first.index)) > 0 )
|
||||
{
|
||||
|
||||
@@ -520,7 +520,7 @@ int64_t AddCClibInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubK
|
||||
if ( it->second.satoshis < threshold || it->second.satoshis == txfee )
|
||||
continue;
|
||||
// no need to prevent dup
|
||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
|
||||
{
|
||||
if ( (nValue= IsCClibvout(cp,vintx,vout,cmpaddr)) >= 1000000 && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 )
|
||||
{
|
||||
@@ -550,7 +550,7 @@ int64_t AddCClibtxfee(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKe
|
||||
//char str[65]; fprintf(stderr,"%s check %s/v%d %.8f vs %.8f\n",coinaddr,uint256_str(str,txid),vout,(double)it->second.satoshis/COIN,(double)threshold/COIN);
|
||||
if ( it->second.satoshis < txfee )
|
||||
continue;
|
||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
|
||||
{
|
||||
if ( (nValue= IsCClibvout(cp,vintx,vout,coinaddr)) != 0 && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 )
|
||||
{
|
||||
|
||||
@@ -416,7 +416,7 @@ int64_t AddChannelsInputs(struct CCcontract_info *cp,CMutableTransaction &mtx, C
|
||||
else marker=2;
|
||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||
{
|
||||
if ( (int32_t)it->first.index==0 && GetTransaction(it->first.txhash,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size()) > 0)
|
||||
if ( (int32_t)it->first.index==0 && myGetTransaction(it->first.txhash,tx,hashBlock) != 0 && (numvouts=tx.vout.size()) > 0)
|
||||
{
|
||||
if (DecodeChannelsOpRet(tx.vout[numvouts-1].scriptPubKey,tokenid,tmp_txid,srcpub,destpub,param1,param2,param3)!=0 &&
|
||||
(tmp_txid==openTx.GetHash() || tx.GetHash()==openTx.GetHash()) && IsChannelsMarkervout(cp,tx,marker==1?srcpub:destpub,marker)>0 &&
|
||||
@@ -517,7 +517,7 @@ std::string ChannelPayment(uint64_t txfee,uint256 opentxid,int64_t amount, uint2
|
||||
if ( txfee == 0 )
|
||||
txfee = 10000;
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
if (GetTransaction(opentxid,channelOpenTx,hashblock,false) == 0)
|
||||
if (myGetTransaction(opentxid,channelOpenTx,hashblock) == 0)
|
||||
{
|
||||
CCerror = strprintf("invalid channel open txid");
|
||||
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -555,7 +555,7 @@ std::string ChannelPayment(uint64_t txfee,uint256 opentxid,int64_t amount, uint2
|
||||
if ((funds=AddChannelsInputs(cp,mtx,channelOpenTx,prevtxid,mypk)) !=0 && (change=funds-amount)>=0)
|
||||
{
|
||||
numpayments=amount/payment;
|
||||
if (GetTransaction(prevtxid,prevTx,hashblock,false) != 0 && (numvouts=prevTx.vout.size()) > 0 &&
|
||||
if (myGetTransaction(prevtxid,prevTx,hashblock) != 0 && (numvouts=prevTx.vout.size()) > 0 &&
|
||||
((funcid = DecodeChannelsOpRet(prevTx.vout[numvouts-1].scriptPubKey, tokenid, txid, srcpub, destpub, prevdepth, param2, param3)) != 0) &&
|
||||
(funcid == 'P' || funcid=='O'))
|
||||
{
|
||||
@@ -642,7 +642,7 @@ std::string ChannelClose(uint64_t txfee,uint256 opentxid)
|
||||
if ( txfee == 0 )
|
||||
txfee = 10000;
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
if (GetTransaction(opentxid,channelOpenTx,hashblock,false) == 0)
|
||||
if (myGetTransaction(opentxid,channelOpenTx,hashblock) == 0)
|
||||
{
|
||||
CCerror = strprintf("invalid channel open txid");
|
||||
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -702,7 +702,7 @@ std::string ChannelRefund(uint64_t txfee,uint256 opentxid,uint256 closetxid)
|
||||
if ( txfee == 0 )
|
||||
txfee = 10000;
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
if (GetTransaction(closetxid,channelCloseTx,hashblock,false) == 0)
|
||||
if (myGetTransaction(closetxid,channelCloseTx,hashblock) == 0)
|
||||
{
|
||||
CCerror = strprintf("invalid channel close txid");
|
||||
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -726,7 +726,7 @@ std::string ChannelRefund(uint64_t txfee,uint256 opentxid,uint256 closetxid)
|
||||
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return ("");
|
||||
}
|
||||
if (GetTransaction(opentxid,channelOpenTx,hashblock,false) == 0)
|
||||
if (myGetTransaction(opentxid,channelOpenTx,hashblock) == 0)
|
||||
{
|
||||
CCerror = strprintf("invalid channel open txid");
|
||||
LOGSTREAM("channelscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -754,7 +754,7 @@ std::string ChannelRefund(uint64_t txfee,uint256 opentxid,uint256 closetxid)
|
||||
{
|
||||
if ((funds=AddChannelsInputs(cp,mtx,channelOpenTx,prevtxid,mypk)) !=0 && funds>0)
|
||||
{
|
||||
if ((GetTransaction(prevtxid,prevTx,hashblock,false) != 0) && (numvouts=prevTx.vout.size()) > 0 &&
|
||||
if ((myGetTransaction(prevtxid,prevTx,hashblock) != 0) && (numvouts=prevTx.vout.size()) > 0 &&
|
||||
DecodeChannelsOpRet(prevTx.vout[numvouts-1].scriptPubKey, tokenid, txid, srcpub, destpub, param1, param2, param3) != 0)
|
||||
{
|
||||
mtx.vout.push_back(MakeCC1vout(EVAL_CHANNELS,CC_MARKER_VALUE,mypk));
|
||||
@@ -799,7 +799,7 @@ UniValue ChannelsList()
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
nValue = (int64_t)it->second;
|
||||
if ( (vout == 1 || vout == 2) && nValue == CC_MARKER_VALUE && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 0 )
|
||||
if ( (vout == 1 || vout == 2) && nValue == CC_MARKER_VALUE && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 )
|
||||
{
|
||||
if (DecodeChannelsOpRet(tx.vout[numvouts-1].scriptPubKey,tokenid,tmp_txid,srcpub,destpub,param1,param2,param3) == 'O')
|
||||
{
|
||||
@@ -822,7 +822,7 @@ UniValue ChannelsInfo(uint256 channeltxid)
|
||||
cp = CCinit(&C,EVAL_CHANNELS);
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
|
||||
if (GetTransaction(channeltxid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 0 &&
|
||||
if (myGetTransaction(channeltxid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 &&
|
||||
(DecodeChannelsOpRet(tx.vout[numvouts-1].scriptPubKey,tokenid,opentxid,srcpub,destpub,param1,param2,param3) == 'O'))
|
||||
{
|
||||
GetCCaddress(cp,CCaddr,mypk);
|
||||
@@ -845,7 +845,7 @@ UniValue ChannelsInfo(uint256 channeltxid)
|
||||
SetCCtxids(addressIndex,CCaddr,true);
|
||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||
{
|
||||
if (GetTransaction(it->first.txhash,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 0 )
|
||||
if (myGetTransaction(it->first.txhash,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 )
|
||||
if (DecodeChannelsOpRet(tx.vout[numvouts-1].scriptPubKey,tokenid,tmp_txid,srcpub,destpub,param1,param2,param3)!=0 && (tmp_txid==channeltxid || tx.GetHash()==channeltxid))
|
||||
txids.push_back(it->first.txhash);
|
||||
}
|
||||
@@ -861,7 +861,7 @@ UniValue ChannelsInfo(uint256 channeltxid)
|
||||
for (std::vector<uint256>::const_iterator it=txids.begin(); it!=txids.end(); it++)
|
||||
{
|
||||
txid=*it;
|
||||
if (txid!=prevtxid && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 0 )
|
||||
if (txid!=prevtxid && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 )
|
||||
{
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
if (DecodeChannelsOpRet(tx.vout[numvouts-1].scriptPubKey,tokenid,tmp_txid,srcpub,destpub,param1,param2,param3) == 'O' && tx.GetHash()==channeltxid)
|
||||
@@ -870,7 +870,7 @@ UniValue ChannelsInfo(uint256 channeltxid)
|
||||
}
|
||||
else if (DecodeChannelsOpRet(tx.vout[numvouts-1].scriptPubKey,tokenid,opentxid,srcpub,destpub,param1,param2,param3) == 'P' && opentxid==channeltxid)
|
||||
{
|
||||
if (GetTransaction(opentxid,opentx,hashBlock,false) != 0 && (numvouts=opentx.vout.size()) > 0 &&
|
||||
if (myGetTransaction(opentxid,opentx,hashBlock) != 0 && (numvouts=opentx.vout.size()) > 0 &&
|
||||
DecodeChannelsOpRet(opentx.vout[numvouts-1].scriptPubKey,tokenid,tmp_txid,srcpub,destpub,numpayments,payment,hashchain) == 'O')
|
||||
{
|
||||
Getscriptaddress(str,tx.vout[3].scriptPubKey);
|
||||
|
||||
@@ -3354,7 +3354,7 @@ int64_t dilithium_inputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPu
|
||||
//char str[65]; fprintf(stderr,"%s check %s/v%d %.8f vs %.8f\n",coinaddr,uint256_str(str,txid),vout,(double)it->second.satoshis/COIN,(double)threshold/COIN);
|
||||
if ( it->second.satoshis < threshold || it->second.satoshis == DILITHIUM_TXFEE )
|
||||
continue;
|
||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 && (numvouts= vintx.vout.size()) > 1 )
|
||||
if ( myGetTransaction(txid,vintx,hashBlock) != 0 && (numvouts= vintx.vout.size()) > 1 )
|
||||
{
|
||||
if ( (nValue= IsCClibvout(cp,vintx,vout,cmpaddr)) > DILITHIUM_TXFEE && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 )
|
||||
{
|
||||
|
||||
@@ -129,7 +129,7 @@ bool Eval::GetTxUnconfirmed(const uint256 &hash, CTransaction &txOut, uint256 &h
|
||||
{
|
||||
return(myGetTransaction(hash, txOut,hashBlock));
|
||||
/*if (!myGetTransaction(hash, txOut,hashBlock)) {
|
||||
return(GetTransaction(hash, txOut,hashBlock));
|
||||
return(myGetTransaction(hash, txOut,hashBlock));
|
||||
} else return(true);*/
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ int64_t AddFaucetInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPub
|
||||
continue;
|
||||
//char str[65]; fprintf(stderr,"check %s/v%d %.8f`\n",uint256_str(str,txid),vout,(double)it->second.satoshis/COIN);
|
||||
// no need to prevent dup
|
||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
|
||||
{
|
||||
if ( (nValue= IsFaucetvout(cp,vintx,vout)) > 1000000 && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 )
|
||||
{
|
||||
@@ -221,6 +221,7 @@ std::string FaucetFund(uint64_t txfee,int64_t funds)
|
||||
{
|
||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||
CPubKey mypk,faucetpk; CScript opret; struct CCcontract_info *cp,C;
|
||||
|
||||
cp = CCinit(&C,EVAL_FAUCET);
|
||||
if ( txfee == 0 )
|
||||
txfee = 10000;
|
||||
|
||||
@@ -133,7 +133,7 @@ int64_t AddFSMInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey
|
||||
// prevent dup
|
||||
if ( it->second.satoshis < 1000000 )
|
||||
continue;
|
||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
|
||||
{
|
||||
if ( (nValue= IsFSMvout(cp,vintx,(int32_t)it->first.index)) > 0 )
|
||||
{
|
||||
|
||||
@@ -823,7 +823,7 @@ int64_t AddGatewaysInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CP
|
||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs; std::string refcoin,tmprefcoin; CPubKey withdrawpub,destpub;
|
||||
uint256 tokenid,txid,oracletxid,tmpbindtxid,tmptokenid,deposittxid,hashBlock;
|
||||
|
||||
if ( GetTransaction(bindtxid,bindtx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(bindtxid,bindtx,hashBlock) != 0 )
|
||||
{
|
||||
if ((numvouts=bindtx.vout.size())!=0 && DecodeGatewaysBindOpRet(depositaddr,bindtx.vout[numvouts-1].scriptPubKey,tokenid,refcoin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) == 'B')
|
||||
{
|
||||
@@ -839,7 +839,7 @@ int64_t AddGatewaysInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CP
|
||||
{
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
|
||||
{
|
||||
funcid=DecodeGatewaysOpRet(vintx.vout[vintx.vout.size()-1].scriptPubKey);
|
||||
if ((vout==0 && funcid=='B' && bindtxid==txid && total != 0 && maxinputs != 0) ||
|
||||
@@ -932,7 +932,7 @@ std::string GatewaysBind(uint64_t txfee,std::string coin,uint256 tokenid,int64_t
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
if ( GetTransaction(oracletxid,oracletx,hashBlock,false) == 0 || (numvouts= oracletx.vout.size()) <= 0 )
|
||||
if ( myGetTransaction(oracletxid,oracletx,hashBlock) == 0 || (numvouts= oracletx.vout.size()) <= 0 )
|
||||
{
|
||||
CCerror = strprintf("cant find oracletxid %s",uint256_str(str,oracletxid));
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -982,7 +982,7 @@ std::string GatewaysDeposit(uint64_t txfee,uint256 bindtxid,int32_t height,std::
|
||||
txfee = 10000;
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
LOGSTREAM("gatewayscc",CCLOG_DEBUG1, stream << "GatewaysDeposit ht." << height << " " << refcoin << " " << (double)amount/COIN << " numpks." << (int32_t)pubkeys.size() << std::endl);
|
||||
if ( GetTransaction(bindtxid,bindtx,hashBlock,false) == 0 || (numvouts= bindtx.vout.size()) <= 0 )
|
||||
if ( myGetTransaction(bindtxid,bindtx,hashBlock) == 0 || (numvouts= bindtx.vout.size()) <= 0 )
|
||||
{
|
||||
CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1059,7 +1059,7 @@ std::string GatewaysClaim(uint64_t txfee,uint256 bindtxid,std::string refcoin,ui
|
||||
txfee = 10000;
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
gatewayspk = GetUnspendable(cp,0);
|
||||
if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
{
|
||||
CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1077,7 +1077,7 @@ std::string GatewaysClaim(uint64_t txfee,uint256 bindtxid,std::string refcoin,ui
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
if ( GetTransaction(deposittxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
if ( myGetTransaction(deposittxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
{
|
||||
CCerror = strprintf("cant find deposittxid %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1138,7 +1138,7 @@ std::string GatewaysWithdraw(uint64_t txfee,uint256 bindtxid,std::string refcoin
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
gatewayspk = GetUnspendable(cp, 0);
|
||||
|
||||
if( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
if( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
{
|
||||
CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1164,7 +1164,7 @@ std::string GatewaysWithdraw(uint64_t txfee,uint256 bindtxid,std::string refcoin
|
||||
vout = (int32_t)it->first.index;
|
||||
nValue = (int64_t)it->second.satoshis;
|
||||
K=0;
|
||||
if ( vout == 0 && nValue == 10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size())>0 &&
|
||||
if ( vout == 0 && nValue == 10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size())>0 &&
|
||||
(funcid=DecodeGatewaysOpRet(tx.vout[numvouts-1].scriptPubKey))!=0 && (funcid=='W' || funcid=='P'))
|
||||
{
|
||||
if (funcid=='W' && DecodeGatewaysWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmptokenid,tmpbindtxid,coin,withdrawpub,tmpamount)=='W'
|
||||
@@ -1176,7 +1176,7 @@ std::string GatewaysWithdraw(uint64_t txfee,uint256 bindtxid,std::string refcoin
|
||||
}
|
||||
|
||||
else if (funcid=='P' && DecodeGatewaysPartialOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,signerpk,hex)=='P' &&
|
||||
GetTransaction(withdrawtxid,tx,hashBlock,false)!=0 && (numvouts=tx.vout.size())>0 && DecodeGatewaysWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmptokenid,tmpbindtxid,coin,withdrawpub,tmpamount)=='W'
|
||||
myGetTransaction(withdrawtxid,tx,hashBlock)!=0 && (numvouts=tx.vout.size())>0 && DecodeGatewaysWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmptokenid,tmpbindtxid,coin,withdrawpub,tmpamount)=='W'
|
||||
&& refcoin==coin && tmptokenid==tokenid && tmpbindtxid==bindtxid)
|
||||
{
|
||||
CCerror = strprintf("unable to create withdraw, another withdraw pending");
|
||||
@@ -1220,7 +1220,7 @@ std::string GatewaysPartialSign(uint64_t txfee,uint256 lasttxid,std::string refc
|
||||
txfee = 10000;
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
gatewayspk = GetUnspendable(cp,0);
|
||||
if (GetTransaction(lasttxid,tx,hashBlock,false)==0 || (numvouts= tx.vout.size())<=0
|
||||
if (myGetTransaction(lasttxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())<=0
|
||||
|| (funcid=DecodeGatewaysOpRet(tx.vout[numvouts-1].scriptPubKey))==0 || (funcid!='W' && funcid!='P'))
|
||||
{
|
||||
CCerror = strprintf("can't find last tx %s",uint256_str(str,lasttxid));
|
||||
@@ -1242,7 +1242,7 @@ std::string GatewaysPartialSign(uint64_t txfee,uint256 lasttxid,std::string refc
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (GetTransaction(bindtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())<=0)
|
||||
else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1264,7 +1264,7 @@ std::string GatewaysPartialSign(uint64_t txfee,uint256 lasttxid,std::string refc
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (GetTransaction(withdrawtxid,tmptx,hashBlock,false)==0 || (numvouts= tmptx.vout.size())<=0)
|
||||
else if (myGetTransaction(withdrawtxid,tmptx,hashBlock)==0 || (numvouts= tmptx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("can't find withdraw tx %s",uint256_str(str,withdrawtxid));
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1283,7 +1283,7 @@ std::string GatewaysPartialSign(uint64_t txfee,uint256 lasttxid,std::string refc
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (GetTransaction(bindtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())<=0)
|
||||
else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1320,7 +1320,7 @@ std::string GatewaysCompleteSigning(uint64_t txfee,uint256 lasttxid,std::string
|
||||
gatewayspk = GetUnspendable(cp,0);
|
||||
if ( txfee == 0 )
|
||||
txfee = 10000;
|
||||
if (GetTransaction(lasttxid,tx,hashBlock,false)==0 || (numvouts= tx.vout.size())<=0
|
||||
if (myGetTransaction(lasttxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())<=0
|
||||
|| (funcid=DecodeGatewaysOpRet(tx.vout[numvouts-1].scriptPubKey))==0 || (funcid!='W' && funcid!='P'))
|
||||
{
|
||||
CCerror = strprintf("invalid last txid %s",uint256_str(str,lasttxid));
|
||||
@@ -1336,7 +1336,7 @@ std::string GatewaysCompleteSigning(uint64_t txfee,uint256 lasttxid,std::string
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (GetTransaction(bindtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())<=0)
|
||||
else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1364,7 +1364,7 @@ std::string GatewaysCompleteSigning(uint64_t txfee,uint256 lasttxid,std::string
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (GetTransaction(withdrawtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())==0)
|
||||
else if (myGetTransaction(withdrawtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())==0)
|
||||
{
|
||||
CCerror = strprintf("invalid withdraw txid %s",uint256_str(str,withdrawtxid));
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1382,7 +1382,7 @@ std::string GatewaysCompleteSigning(uint64_t txfee,uint256 lasttxid,std::string
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (GetTransaction(bindtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())<=0)
|
||||
else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1418,7 +1418,7 @@ std::string GatewaysMarkDone(uint64_t txfee,uint256 completetxid,std::string ref
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
if ( txfee == 0 )
|
||||
txfee = 10000;
|
||||
if (GetTransaction(completetxid,tx,hashBlock,false)==0 || (numvouts= tx.vout.size())<=0)
|
||||
if (myGetTransaction(completetxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("invalid completesigning txid %s",uint256_str(str,completetxid));
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1436,7 +1436,7 @@ std::string GatewaysMarkDone(uint64_t txfee,uint256 completetxid,std::string ref
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (GetTransaction(withdrawtxid,tx,hashBlock,false)==0 || (numvouts= tx.vout.size())==0)
|
||||
else if (myGetTransaction(withdrawtxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())==0)
|
||||
{
|
||||
CCerror = strprintf("invalid withdraw txid %s",uint256_str(str,withdrawtxid));
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1448,7 +1448,7 @@ std::string GatewaysMarkDone(uint64_t txfee,uint256 completetxid,std::string ref
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (GetTransaction(bindtxid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0)
|
||||
else if (myGetTransaction(bindtxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1485,7 +1485,7 @@ UniValue GatewaysPendingDeposits(uint256 bindtxid,std::string refcoin)
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
gatewayspk = GetUnspendable(cp,0);
|
||||
_GetCCaddress(coinaddr,EVAL_GATEWAYS,mypk);
|
||||
if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
{
|
||||
result.push_back(Pair("result","error"));
|
||||
result.push_back(Pair("error",strprintf("cant find bindtxid %s",uint256_str(str,bindtxid))));
|
||||
@@ -1503,7 +1503,7 @@ UniValue GatewaysPendingDeposits(uint256 bindtxid,std::string refcoin)
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
nValue = (int64_t)it->second.satoshis;
|
||||
if ( vout == 0 && nValue == 10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 &&
|
||||
if ( vout == 0 && nValue == 10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 &&
|
||||
DecodeGatewaysDepositOpRet(tx.vout[numvouts-1].scriptPubKey,tmpbindtxid,coin,publishers,txids,height,cointxid,claimvout,hex,proof,destpub,amount) == 'D'
|
||||
&& tmpbindtxid==bindtxid && refcoin == coin && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0)
|
||||
{
|
||||
@@ -1540,7 +1540,7 @@ UniValue GatewaysPendingWithdraws(uint256 bindtxid,std::string refcoin)
|
||||
gatewayspk = GetUnspendable(cp,0);
|
||||
_GetCCaddress(coinaddr,EVAL_GATEWAYS,gatewayspk);
|
||||
GetTokensCCaddress(cp,tokensaddr,gatewayspk);
|
||||
if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
{
|
||||
result.push_back(Pair("result","error"));
|
||||
result.push_back(Pair("error",strprintf("cant find bindtxid %s",uint256_str(str,bindtxid))));
|
||||
@@ -1567,7 +1567,7 @@ UniValue GatewaysPendingWithdraws(uint256 bindtxid,std::string refcoin)
|
||||
vout = (int32_t)it->first.index;
|
||||
nValue = (int64_t)it->second.satoshis;
|
||||
K=0;
|
||||
if ( vout == 0 && nValue == 10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size())>0 &&
|
||||
if ( vout == 0 && nValue == 10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size())>0 &&
|
||||
(funcid=DecodeGatewaysOpRet(tx.vout[numvouts-1].scriptPubKey))!=0 && (funcid=='W' || funcid=='P') && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0)
|
||||
{
|
||||
if (funcid=='W')
|
||||
@@ -1576,7 +1576,7 @@ UniValue GatewaysPendingWithdraws(uint256 bindtxid,std::string refcoin)
|
||||
}
|
||||
else if (funcid=='P')
|
||||
{
|
||||
if (DecodeGatewaysPartialOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,signerpk,hex)!='P' || GetTransaction(withdrawtxid,tx,hashBlock,false)==0
|
||||
if (DecodeGatewaysPartialOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,signerpk,hex)!='P' || myGetTransaction(withdrawtxid,tx,hashBlock)==0
|
||||
|| (numvouts=tx.vout.size())<=0 || DecodeGatewaysWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmptokenid,tmpbindtxid,coin,withdrawpub,amount)!='W'
|
||||
|| refcoin!=coin || tmptokenid!=tokenid || tmpbindtxid!=bindtxid)
|
||||
continue;
|
||||
@@ -1628,7 +1628,7 @@ UniValue GatewaysProcessedWithdraws(uint256 bindtxid,std::string refcoin)
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
gatewayspk = GetUnspendable(cp,0);
|
||||
_GetCCaddress(coinaddr,EVAL_GATEWAYS,gatewayspk);
|
||||
if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
{
|
||||
result.push_back(Pair("result","error"));
|
||||
result.push_back(Pair("error",strprintf("cant find bindtxid %s",uint256_str(str,bindtxid))));
|
||||
@@ -1654,10 +1654,10 @@ UniValue GatewaysProcessedWithdraws(uint256 bindtxid,std::string refcoin)
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
nValue = (int64_t)it->second.satoshis;
|
||||
if ( vout == 0 && nValue == 10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size())>0 &&
|
||||
if ( vout == 0 && nValue == 10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size())>0 &&
|
||||
DecodeGatewaysCompleteSigningOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,hex) == 'S' && refcoin == coin && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0)
|
||||
{
|
||||
if (GetTransaction(withdrawtxid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size())>0
|
||||
if (myGetTransaction(withdrawtxid,tx,hashBlock) != 0 && (numvouts= tx.vout.size())>0
|
||||
&& DecodeGatewaysWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmptokenid,bindtxid,coin,withdrawpub,amount) == 'W' || refcoin!=coin || tmptokenid!=tokenid)
|
||||
{
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
@@ -1689,7 +1689,7 @@ UniValue GatewaysList()
|
||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||
{
|
||||
txid = it->first.txhash;
|
||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
|
||||
{
|
||||
if ( vintx.vout.size() > 0 && DecodeGatewaysBindOpRet(depositaddr,vintx.vout[vintx.vout.size()-1].scriptPubKey,tokenid,coin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 0 )
|
||||
{
|
||||
@@ -1706,7 +1706,7 @@ UniValue GatewaysExternalAddress(uint256 bindtxid,CPubKey pubkey)
|
||||
std::string coin; int64_t numvouts,totalsupply; char str[65],addr[65],depositaddr[65]; uint8_t M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> msigpubkeys;
|
||||
|
||||
cp = CCinit(&C,EVAL_GATEWAYS);
|
||||
if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
{
|
||||
result.push_back(Pair("result","error"));
|
||||
result.push_back(Pair("error",strprintf("cant find bindtxid %s",uint256_str(str,bindtxid))));
|
||||
@@ -1730,7 +1730,7 @@ UniValue GatewaysDumpPrivKey(uint256 bindtxid,CKey key)
|
||||
std::string coin,priv; int64_t numvouts,totalsupply; char str[65],addr[65],depositaddr[65]; uint8_t M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> msigpubkeys;
|
||||
|
||||
cp = CCinit(&C,EVAL_GATEWAYS);
|
||||
if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
{
|
||||
result.push_back(Pair("result","error"));
|
||||
result.push_back(Pair("error",strprintf("cant find bindtxid %s",uint256_str(str,bindtxid))));
|
||||
@@ -1759,7 +1759,7 @@ UniValue GatewaysInfo(uint256 bindtxid)
|
||||
cp = CCinit(&C,EVAL_GATEWAYS);
|
||||
Gatewayspk = GetUnspendable(cp,0);
|
||||
GetTokensCCaddress(cp,gatewaystokens,Gatewayspk);
|
||||
if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
{
|
||||
result.push_back(Pair("result","error"));
|
||||
result.push_back(Pair("error",strprintf("cant find bindtxid %s",uint256_str(str,bindtxid))));
|
||||
@@ -1771,7 +1771,7 @@ UniValue GatewaysInfo(uint256 bindtxid)
|
||||
result.push_back(Pair("error",strprintf("invalid bindtxid %s coin.%s",uint256_str(str,bindtxid),coin.c_str())));
|
||||
return(result);
|
||||
}
|
||||
if ( GetTransaction(bindtxid,tx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(bindtxid,tx,hashBlock) != 0 )
|
||||
{
|
||||
result.push_back(Pair("result","success"));
|
||||
result.push_back(Pair("name","Gateways"));
|
||||
|
||||
@@ -531,7 +531,7 @@ template <class Helper> int64_t Add1of2AddressInputs(struct CCcontract_info* cp,
|
||||
|
||||
//std::cerr << "Add1of2AddressInputs() txid=" << txid.GetHex() << std::endl;
|
||||
|
||||
if (GetTransaction(txid, heirtx, hashBlock, false) != 0) {
|
||||
if (myGetTransaction(txid, heirtx, hashBlock) != 0) {
|
||||
uint256 tokenid;
|
||||
uint256 fundingTxidInOpret;
|
||||
uint8_t hasHeirSpendingBegunDummy;
|
||||
@@ -579,7 +579,7 @@ template <class Helper> int64_t LifetimeHeirContractFunds(struct CCcontract_info
|
||||
CTransaction heirtx;
|
||||
|
||||
// TODO: check all funding tx should contain unspendable markers
|
||||
if (GetTransaction(txid, heirtx, hashBlock, false) && heirtx.vout.size() > 0) {
|
||||
if (myGetTransaction(txid, heirtx, hashBlock) && heirtx.vout.size() > 0) {
|
||||
uint256 tokenid;
|
||||
uint256 fundingTxidInOpret;
|
||||
uint8_t hasHeirSpendingBegunDummy;
|
||||
@@ -1232,7 +1232,7 @@ void _HeirList(struct CCcontract_info *cp, UniValue &result)
|
||||
//std::cerr << "HeirList() checking txid=" << txid.GetHex() << " vout=" << vout << '\n';
|
||||
|
||||
CTransaction fundingtx;
|
||||
if (GetTransaction(txid, fundingtx, hashBlock, false)) {
|
||||
if (myGetTransaction(txid, fundingtx, hashBlock)) {
|
||||
CPubKey ownerPubkey, heirPubkey;
|
||||
std::string heirName, memo;
|
||||
int64_t inactivityTimeSec;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
How this works:
|
||||
- earlytxid must be a transaction included in the chain before block 100. The chain MUST not have any other of these type of tx before block 100, or someone may be able to change it and mess things up.
|
||||
- When it gets to block 100, it takes the txid specified by the -earlytxid param (does not affect magic)
|
||||
- earlytxid must be a transaction included in the chain before block KOMODO_EARLYTXID_HEIGHT. The chain MUST not have any other of these type of tx before block KOMODO_EARLYTXID_HEIGHT, or someone may be able to change it and mess things up.
|
||||
- When it gets to block KOMODO_EARLYTXID_HEIGHT, it takes the txid specified by the -earlytxid param (does not affect magic)
|
||||
- Looks up the transaction searches for the opreturn, then permenantly appends it to the end of ac_script in RAM.
|
||||
- After every daemon restart, the first time the daemon mines a block, or receives a block that pays ac_script it will look up the op_return and save it again.
|
||||
- this enables it to always reach consensus but doesnt need to constantly keep looking up the tx in the chain.
|
||||
|
||||
@@ -367,7 +367,7 @@ int32_t CheckGATEWAYimport(CTransaction importTx,CTransaction burnTx,std::string
|
||||
return(-1);
|
||||
}
|
||||
// check for valid burn from external coin blockchain and if valid return(0);
|
||||
if (GetTransaction(bindtxid, bindtx, hashBlock, false) == 0 || (numvouts = bindtx.vout.size()) <= 0)
|
||||
if (myGetTransaction(bindtxid, bindtx, hashBlock) == 0 || (numvouts = bindtx.vout.size()) <= 0)
|
||||
{
|
||||
LOGSTREAM("importgateway", CCLOG_INFO, stream << "CheckGATEWAYimport cant find bindtxid=" << bindtxid.GetHex() << std::endl);
|
||||
return(-1);
|
||||
@@ -397,7 +397,7 @@ int32_t CheckGATEWAYimport(CTransaction importTx,CTransaction burnTx,std::string
|
||||
LOGSTREAM("importgateway", CCLOG_INFO, stream << "CheckGATEWAYimport bindtx not yet confirmed/notarized" << std::endl);
|
||||
return(-1);
|
||||
}
|
||||
else if (GetTransaction(oracletxid, oracletx, hashBlock, false) == 0 || (numvouts = oracletx.vout.size()) <= 0)
|
||||
else if (myGetTransaction(oracletxid, oracletx, hashBlock) == 0 || (numvouts = oracletx.vout.size()) <= 0)
|
||||
{
|
||||
LOGSTREAM("importgateway", CCLOG_INFO, stream << "CheckGATEWAYimport cant find oracletxid=" << oracletxid.GetHex() << std::endl);
|
||||
return(-1);
|
||||
@@ -417,7 +417,7 @@ int32_t CheckGATEWAYimport(CTransaction importTx,CTransaction burnTx,std::string
|
||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||
{
|
||||
txid = it->first.txhash;
|
||||
if ( GetTransaction(txid,regtx,hashBlock,false) != 0 && regtx.vout.size() > 0
|
||||
if ( myGetTransaction(txid,regtx,hashBlock) != 0 && regtx.vout.size() > 0
|
||||
&& DecodeOraclesOpRet(regtx.vout[regtx.vout.size()-1].scriptPubKey,tmporacletxid,regpk,datafee) == 'R' && oracletxid == tmporacletxid )
|
||||
{
|
||||
pubkeys.push_back(regpk);
|
||||
|
||||
@@ -525,7 +525,7 @@ std::string ImportGatewayBind(uint64_t txfee,std::string coin,uint256 oracletxid
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
if ( GetTransaction(oracletxid,oracletx,hashBlock,false) == 0 || (numvouts= oracletx.vout.size()) <= 0 )
|
||||
if ( myGetTransaction(oracletxid,oracletx,hashBlock) == 0 || (numvouts= oracletx.vout.size()) <= 0 )
|
||||
{
|
||||
CCerror = strprintf("cant find oracletxid %s",uint256_str(str,oracletxid));
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -581,7 +581,7 @@ std::string ImportGatewayDeposit(uint64_t txfee,uint256 bindtxid,int32_t height,
|
||||
return std::string("");
|
||||
}
|
||||
LOGSTREAM("importgateway",CCLOG_DEBUG1, stream << "ImportGatewayDeposit ht." << height << " " << refcoin << " " << (double)amount/COIN << " numpks." << (int32_t)pubkeys.size() << std::endl);
|
||||
if ( GetTransaction(bindtxid,bindtx,hashBlock,false) == 0 || (numvouts= bindtx.vout.size()) <= 0 )
|
||||
if ( myGetTransaction(bindtxid,bindtx,hashBlock) == 0 || (numvouts= bindtx.vout.size()) <= 0 )
|
||||
{
|
||||
CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -651,7 +651,7 @@ std::string ImportGatewayWithdraw(uint64_t txfee,uint256 bindtxid,std::string re
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
importgatewaypk = GetUnspendable(cp, 0);
|
||||
|
||||
if( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
if( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
{
|
||||
CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -677,7 +677,7 @@ std::string ImportGatewayWithdraw(uint64_t txfee,uint256 bindtxid,std::string re
|
||||
vout = (int32_t)it->first.index;
|
||||
nValue = (int64_t)it->second.satoshis;
|
||||
K=0;
|
||||
if ( vout == 0 && nValue == 10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size())>0 &&
|
||||
if ( vout == 0 && nValue == 10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size())>0 &&
|
||||
(funcid=DecodeImportGatewayOpRet(tx.vout[numvouts-1].scriptPubKey))!=0 && (funcid=='W' || funcid=='P'))
|
||||
{
|
||||
if (funcid=='W' && DecodeImportGatewayWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmpbindtxid,coin,withdrawpub,tmpamount)=='W'
|
||||
@@ -689,7 +689,7 @@ std::string ImportGatewayWithdraw(uint64_t txfee,uint256 bindtxid,std::string re
|
||||
}
|
||||
|
||||
else if (funcid=='P' && DecodeImportGatewayPartialOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,signerpk,hex)=='P' &&
|
||||
GetTransaction(withdrawtxid,tx,hashBlock,false)!=0 && (numvouts=tx.vout.size())>0 && DecodeImportGatewayWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmpbindtxid,coin,withdrawpub,tmpamount)=='W'
|
||||
myGetTransaction(withdrawtxid,tx,hashBlock)!=0 && (numvouts=tx.vout.size())>0 && DecodeImportGatewayWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmpbindtxid,coin,withdrawpub,tmpamount)=='W'
|
||||
&& refcoin==coin && tmpbindtxid==bindtxid)
|
||||
{
|
||||
CCerror = strprintf("unable to create withdraw, another withdraw pending");
|
||||
@@ -722,7 +722,7 @@ std::string ImportGatewayPartialSign(uint64_t txfee,uint256 lasttxid,std::string
|
||||
txfee = 10000;
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
importgatewaypk = GetUnspendable(cp,0);
|
||||
if (GetTransaction(lasttxid,tx,hashBlock,false)==0 || (numvouts= tx.vout.size())<=0
|
||||
if (myGetTransaction(lasttxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())<=0
|
||||
|| (funcid=DecodeImportGatewayOpRet(tx.vout[numvouts-1].scriptPubKey))==0 || (funcid!='W' && funcid!='P'))
|
||||
{
|
||||
CCerror = strprintf("can't find last tx %s",uint256_str(str,lasttxid));
|
||||
@@ -744,7 +744,7 @@ std::string ImportGatewayPartialSign(uint64_t txfee,uint256 lasttxid,std::string
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (GetTransaction(bindtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())<=0)
|
||||
else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -766,7 +766,7 @@ std::string ImportGatewayPartialSign(uint64_t txfee,uint256 lasttxid,std::string
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (GetTransaction(withdrawtxid,tmptx,hashBlock,false)==0 || (numvouts= tmptx.vout.size())<=0)
|
||||
else if (myGetTransaction(withdrawtxid,tmptx,hashBlock)==0 || (numvouts= tmptx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("can't find withdraw tx %s",uint256_str(str,withdrawtxid));
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -785,7 +785,7 @@ std::string ImportGatewayPartialSign(uint64_t txfee,uint256 lasttxid,std::string
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (GetTransaction(bindtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())<=0)
|
||||
else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -822,7 +822,7 @@ std::string ImportGatewayCompleteSigning(uint64_t txfee,uint256 lasttxid,std::st
|
||||
importgatewaypk = GetUnspendable(cp,0);
|
||||
if ( txfee == 0 )
|
||||
txfee = 10000;
|
||||
if (GetTransaction(lasttxid,tx,hashBlock,false)==0 || (numvouts= tx.vout.size())<=0
|
||||
if (myGetTransaction(lasttxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())<=0
|
||||
|| (funcid=DecodeImportGatewayOpRet(tx.vout[numvouts-1].scriptPubKey))==0 || (funcid!='W' && funcid!='P'))
|
||||
{
|
||||
CCerror = strprintf("invalid last txid %s",uint256_str(str,lasttxid));
|
||||
@@ -838,7 +838,7 @@ std::string ImportGatewayCompleteSigning(uint64_t txfee,uint256 lasttxid,std::st
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (GetTransaction(bindtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())<=0)
|
||||
else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -866,7 +866,7 @@ std::string ImportGatewayCompleteSigning(uint64_t txfee,uint256 lasttxid,std::st
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (GetTransaction(withdrawtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())==0)
|
||||
else if (myGetTransaction(withdrawtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())==0)
|
||||
{
|
||||
CCerror = strprintf("invalid withdraw txid %s",uint256_str(str,withdrawtxid));
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -884,7 +884,7 @@ std::string ImportGatewayCompleteSigning(uint64_t txfee,uint256 lasttxid,std::st
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (GetTransaction(bindtxid,tmptx,hashBlock,false)==0 || (numvouts=tmptx.vout.size())<=0)
|
||||
else if (myGetTransaction(bindtxid,tmptx,hashBlock)==0 || (numvouts=tmptx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -920,7 +920,7 @@ std::string ImportGatewayMarkDone(uint64_t txfee,uint256 completetxid,std::strin
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
if ( txfee == 0 )
|
||||
txfee = 10000;
|
||||
if (GetTransaction(completetxid,tx,hashBlock,false)==0 || (numvouts= tx.vout.size())<=0)
|
||||
if (myGetTransaction(completetxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("invalid completesigning txid %s",uint256_str(str,completetxid));
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -938,7 +938,7 @@ std::string ImportGatewayMarkDone(uint64_t txfee,uint256 completetxid,std::strin
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (GetTransaction(withdrawtxid,tx,hashBlock,false)==0 || (numvouts= tx.vout.size())==0)
|
||||
else if (myGetTransaction(withdrawtxid,tx,hashBlock)==0 || (numvouts= tx.vout.size())==0)
|
||||
{
|
||||
CCerror = strprintf("invalid withdraw txid %s",uint256_str(str,withdrawtxid));
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -950,7 +950,7 @@ std::string ImportGatewayMarkDone(uint64_t txfee,uint256 completetxid,std::strin
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
else if (GetTransaction(bindtxid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0)
|
||||
else if (myGetTransaction(bindtxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("can't find bind tx %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -987,7 +987,7 @@ UniValue ImportGatewayPendingDeposits(uint256 bindtxid,std::string refcoin)
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
importgatewaypk = GetUnspendable(cp,0);
|
||||
_GetCCaddress(coinaddr,EVAL_IMPORTGATEWAY,mypk);
|
||||
if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
{
|
||||
CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1005,7 +1005,7 @@ UniValue ImportGatewayPendingDeposits(uint256 bindtxid,std::string refcoin)
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
nValue = (int64_t)it->second.satoshis;
|
||||
if ( vout == 0 && nValue == 10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 &&
|
||||
if ( vout == 0 && nValue == 10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 &&
|
||||
DecodeImportGatewayDepositOpRet(tx.vout[numvouts-1].scriptPubKey,tmpbindtxid,coin,publishers,txids,height,burntxid,claimvout,hex,proof,destpub,amount) == 'D'
|
||||
&& tmpbindtxid==bindtxid && refcoin == coin && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0)
|
||||
{
|
||||
@@ -1041,7 +1041,7 @@ UniValue ImportGatewayPendingWithdraws(uint256 bindtxid,std::string refcoin)
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
importgatewaypk = GetUnspendable(cp,0);
|
||||
_GetCCaddress(coinaddr,EVAL_IMPORTGATEWAY,importgatewaypk);
|
||||
if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
{
|
||||
CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1068,7 +1068,7 @@ UniValue ImportGatewayPendingWithdraws(uint256 bindtxid,std::string refcoin)
|
||||
vout = (int32_t)it->first.index;
|
||||
nValue = (int64_t)it->second.satoshis;
|
||||
K=0;
|
||||
if ( vout == 0 && nValue == 10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size())>0 &&
|
||||
if ( vout == 0 && nValue == 10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size())>0 &&
|
||||
(funcid=DecodeImportGatewayOpRet(tx.vout[numvouts-1].scriptPubKey))!=0 && (funcid=='W' || funcid=='P') && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0)
|
||||
{
|
||||
if (funcid=='W')
|
||||
@@ -1077,7 +1077,7 @@ UniValue ImportGatewayPendingWithdraws(uint256 bindtxid,std::string refcoin)
|
||||
}
|
||||
else if (funcid=='P')
|
||||
{
|
||||
if (DecodeImportGatewayPartialOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,signerpk,hex)!='P' || GetTransaction(withdrawtxid,tx,hashBlock,false)==0
|
||||
if (DecodeImportGatewayPartialOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,signerpk,hex)!='P' || myGetTransaction(withdrawtxid,tx,hashBlock)==0
|
||||
|| (numvouts=tx.vout.size())<=0 || DecodeImportGatewayWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,tmpbindtxid,coin,withdrawpub,amount)!='W'
|
||||
|| refcoin!=coin || tmpbindtxid!=bindtxid)
|
||||
continue;
|
||||
@@ -1129,7 +1129,7 @@ UniValue ImportGatewayProcessedWithdraws(uint256 bindtxid,std::string refcoin)
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
importgatewaypk = GetUnspendable(cp,0);
|
||||
_GetCCaddress(coinaddr,EVAL_IMPORTGATEWAY,importgatewaypk);
|
||||
if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
{
|
||||
CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1155,10 +1155,10 @@ UniValue ImportGatewayProcessedWithdraws(uint256 bindtxid,std::string refcoin)
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
nValue = (int64_t)it->second.satoshis;
|
||||
if ( vout == 0 && nValue == 10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size())>0 &&
|
||||
if ( vout == 0 && nValue == 10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size())>0 &&
|
||||
DecodeImportGatewayCompleteSigningOpRet(tx.vout[numvouts-1].scriptPubKey,withdrawtxid,coin,K,hex) == 'S' && refcoin == coin && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0)
|
||||
{
|
||||
if (GetTransaction(withdrawtxid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size())>0
|
||||
if (myGetTransaction(withdrawtxid,tx,hashBlock) != 0 && (numvouts= tx.vout.size())>0
|
||||
&& DecodeImportGatewayWithdrawOpRet(tx.vout[numvouts-1].scriptPubKey,bindtxid,coin,withdrawpub,amount) == 'W' || refcoin!=coin)
|
||||
{
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
@@ -1192,7 +1192,7 @@ UniValue ImportGatewayList()
|
||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||
{
|
||||
txid = it->first.txhash;
|
||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
|
||||
{
|
||||
if ( vintx.vout.size() > 0 && DecodeImportGatewayBindOpRet(burnaddr,vintx.vout[vintx.vout.size()-1].scriptPubKey,coin,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) != 0 )
|
||||
{
|
||||
@@ -1209,7 +1209,7 @@ UniValue ImportGatewayExternalAddress(uint256 bindtxid,CPubKey pubkey)
|
||||
std::string coin; int64_t numvouts; char str[65],addr[65],burnaddr[65]; uint8_t M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> msigpubkeys;
|
||||
|
||||
cp = CCinit(&C,EVAL_IMPORTGATEWAY);
|
||||
if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
{
|
||||
CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1233,7 +1233,7 @@ UniValue ImportGatewayDumpPrivKey(uint256 bindtxid,CKey key)
|
||||
std::string coin,priv; int64_t numvouts; char str[65],addr[65],burnaddr[65]; uint8_t M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> msigpubkeys;
|
||||
|
||||
cp = CCinit(&C,EVAL_IMPORTGATEWAY);
|
||||
if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
{
|
||||
CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1262,7 +1262,7 @@ UniValue ImportGatewayInfo(uint256 bindtxid)
|
||||
cp = CCinit(&C,EVAL_IMPORTGATEWAY);
|
||||
ImportGatewaypk = GetUnspendable(cp,0);
|
||||
GetTokensCCaddress(cp,gatewaystokens,ImportGatewaypk);
|
||||
if ( GetTransaction(bindtxid,tx,hashBlock,false) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
if ( myGetTransaction(bindtxid,tx,hashBlock) == 0 || (numvouts= tx.vout.size()) <= 0 )
|
||||
{
|
||||
CCerror = strprintf("cant find bindtxid %s",uint256_str(str,bindtxid));
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1274,7 +1274,7 @@ UniValue ImportGatewayInfo(uint256 bindtxid)
|
||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
if ( GetTransaction(bindtxid,tx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(bindtxid,tx,hashBlock) != 0 )
|
||||
{
|
||||
result.push_back(Pair("result","success"));
|
||||
result.push_back(Pair("name","ImportGateway"));
|
||||
|
||||
@@ -173,7 +173,7 @@ int64_t AddLottoInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubK
|
||||
// prevent dup
|
||||
if ( it->second.satoshis < COIN )
|
||||
continue;
|
||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
|
||||
{
|
||||
if ( (nValue= IsLottovout(cp,vintx,(int32_t)it->first.index)) > 0 )
|
||||
{
|
||||
@@ -214,7 +214,7 @@ int64_t LottoPlanFunds(uint64_t refsbits,struct CCcontract_info *cp,CPubKey pk,u
|
||||
{
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 )
|
||||
if ( myGetTransaction(txid,tx,hashBlock) != 0 && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 )
|
||||
{
|
||||
// need to implement this! if ( (funcid= DecodeLottoOpRet(txid,tx.vout[tx.vout.size()-1].scriptPubKey,sbits,fundingtxid)) == 'F' || funcid == 'T' )
|
||||
{
|
||||
@@ -233,7 +233,7 @@ int64_t LottoPlanFunds(uint64_t refsbits,struct CCcontract_info *cp,CPubKey pk,u
|
||||
UniValue LottoInfo(uint256 lottoid)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ); uint256 hashBlock,hentropy; CTransaction vintx; uint64_t lockedfunds,sbits; int32_t ticketsize,odds,firstheight,period; CPubKey lottopk; struct CCcontract_info *cp,C; char str[67],numstr[65];
|
||||
if ( GetTransaction(lottoid,vintx,hashBlock,false) == 0 )
|
||||
if ( myGetTransaction(lottoid,vintx,hashBlock) == 0 )
|
||||
{
|
||||
fprintf(stderr,"cant find lottoid\n");
|
||||
result.push_back(Pair("result","error"));
|
||||
@@ -270,7 +270,7 @@ UniValue LottoList()
|
||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||
{
|
||||
txid = it->first.txhash;
|
||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
|
||||
{
|
||||
if ( vintx.vout.size() > 0 && DecodeLottoFundingOpRet(vintx.vout[vintx.vout.size()-1].scriptPubKey,sbits,ticketsize,odds,firstheight,period,hentropy) == 'F' )
|
||||
{
|
||||
|
||||
@@ -360,7 +360,7 @@ int64_t AddMarmaraCoinbases(struct CCcontract_info *cp,CMutableTransaction &mtx,
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
//fprintf(stderr,"txid.%s/v%d\n",txid.GetHex().c_str(),vout);
|
||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
|
||||
{
|
||||
if ( vintx.IsCoinBase() != 0 && vintx.vout.size() == 2 && vintx.vout[1].nValue == 0 )
|
||||
{
|
||||
@@ -399,7 +399,7 @@ int64_t AddMarmarainputs(CMutableTransaction &mtx,std::vector<CPubKey> &pubkeys,
|
||||
vout = (int32_t)it->first.index;
|
||||
if ( it->second.satoshis < threshold )
|
||||
continue;
|
||||
if ( GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 0 && vout < numvouts && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 )
|
||||
if ( myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 && vout < numvouts && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 )
|
||||
{
|
||||
if ( (funcid= DecodeMaramaraCoinbaseOpRet(tx.vout[numvouts-1].scriptPubKey,pk,ht,unlockht)) == 'C' || funcid == 'P' || funcid == 'L' )
|
||||
{
|
||||
@@ -468,7 +468,7 @@ UniValue MarmaraLock(uint64_t txfee,int64_t amount,int32_t height)
|
||||
vout = (int32_t)it->first.index;
|
||||
if ( (nValue= it->second.satoshis) < threshold )
|
||||
continue;
|
||||
if ( GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 0 && vout < numvouts && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 )
|
||||
if ( myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 && vout < numvouts && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 )
|
||||
{
|
||||
if ( (funcid= DecodeMaramaraCoinbaseOpRet(tx.vout[numvouts-1].scriptPubKey,pk,ht,unlockht)) == 'C' || funcid == 'P' || funcid == 'L' )
|
||||
{
|
||||
@@ -516,7 +516,7 @@ int32_t MarmaraSignature(uint8_t *utxosig,CMutableTransaction &mtx)
|
||||
uint256 txid,hashBlock; uint8_t *ptr; int32_t i,siglen,vout,numvouts; CTransaction tx; std::string rawtx; CPubKey mypk; std::vector<CPubKey> pubkeys; struct CCcontract_info *cp,C; uint64_t txfee;
|
||||
txfee = 10000;
|
||||
vout = mtx.vin[0].prevout.n;
|
||||
if ( GetTransaction(mtx.vin[0].prevout.hash,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 1 && vout < numvouts )
|
||||
if ( myGetTransaction(mtx.vin[0].prevout.hash,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 && vout < numvouts )
|
||||
{
|
||||
cp = CCinit(&C,EVAL_MARMARA);
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
@@ -553,7 +553,7 @@ UniValue MarmaraSettlement(uint64_t txfee,uint256 refbatontxid)
|
||||
height = chainActive.LastTip()->GetHeight();
|
||||
if ( (n= MarmaraGetbatontxid(creditloop,batontxid,refbatontxid)) > 0 )
|
||||
{
|
||||
if ( GetTransaction(batontxid,batontx,hashBlock,false) != 0 && (numvouts= batontx.vout.size()) > 1 )
|
||||
if ( myGetTransaction(batontxid,batontx,hashBlock) != 0 && (numvouts= batontx.vout.size()) > 1 )
|
||||
{
|
||||
if ( (funcid= MarmaraDecodeLoopOpret(batontx.vout[numvouts-1].scriptPubKey,refcreatetxid,pk,refamount,refmatures,refcurrency)) != 0 )
|
||||
{
|
||||
@@ -593,7 +593,7 @@ UniValue MarmaraSettlement(uint64_t txfee,uint256 refbatontxid)
|
||||
pubkeys.push_back(mypk);
|
||||
for (i=1; i<n; i++)
|
||||
{
|
||||
if ( GetTransaction(creditloop[i],tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 1 )
|
||||
if ( myGetTransaction(creditloop[i],tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 )
|
||||
{
|
||||
if ( (funcid= MarmaraDecodeLoopOpret(tx.vout[numvouts-1].scriptPubKey,createtxid,pk,amount,matures,currency)) != 0 )
|
||||
{
|
||||
@@ -674,7 +674,7 @@ int32_t MarmaraGetCreditloops(int64_t &totalamount,std::vector<uint256> &issuanc
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
//fprintf(stderr,"txid.%s/v%d\n",txid.GetHex().c_str(),vout);
|
||||
if ( vout == 1 && GetTransaction(txid,tx,hashBlock,false) != 0 )
|
||||
if ( vout == 1 && myGetTransaction(txid,tx,hashBlock) != 0 )
|
||||
{
|
||||
if ( tx.IsCoinBase() == 0 && (numvouts= tx.vout.size()) > 2 && tx.vout[numvouts - 1].nValue == 0 )
|
||||
{
|
||||
@@ -814,7 +814,7 @@ UniValue MarmaraCreditloop(uint256 txid)
|
||||
cp = CCinit(&C,EVAL_MARMARA);
|
||||
if ( (n= MarmaraGetbatontxid(creditloop,batontxid,txid)) > 0 )
|
||||
{
|
||||
if ( GetTransaction(batontxid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 1 )
|
||||
if ( myGetTransaction(batontxid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 )
|
||||
{
|
||||
result.push_back(Pair("result",(char *)"success"));
|
||||
Getscriptaddress(coinaddr,CScript() << ParseHex(HexStr(Mypubkey())) << OP_CHECKSIG);
|
||||
@@ -886,7 +886,7 @@ UniValue MarmaraCreditloop(uint256 txid)
|
||||
}
|
||||
for (i=0; i<n; i++)
|
||||
{
|
||||
if ( GetTransaction(creditloop[i],tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 1 )
|
||||
if ( myGetTransaction(creditloop[i],tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 )
|
||||
{
|
||||
if ( (funcid= MarmaraDecodeLoopOpret(tx.vout[numvouts-1].scriptPubKey,createtxid,pk,amount,matures,currency)) != 0 )
|
||||
{
|
||||
|
||||
@@ -759,7 +759,7 @@ int64_t AddOracleInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,uint
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
//char str[65]; fprintf(stderr,"oracle check %s/v%d\n",uint256_str(str,txid),vout);
|
||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 && (numvouts=vintx.vout.size()-1)>0)
|
||||
if ( myGetTransaction(txid,vintx,hashBlock) != 0 && (numvouts=vintx.vout.size()-1)>0)
|
||||
{
|
||||
if ((funcid=DecodeOraclesOpRet(vintx.vout[numvouts].scriptPubKey,tmporacletxid,tmppk,tmpnum))!=0 && (funcid=='S' || funcid=='D'))
|
||||
{
|
||||
@@ -795,7 +795,7 @@ int64_t LifetimeOraclesFunds(struct CCcontract_info *cp,uint256 oracletxid,CPubK
|
||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||
{
|
||||
txid = it->first.txhash;
|
||||
if ( GetTransaction(txid,subtx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(txid,subtx,hashBlock) != 0 )
|
||||
{
|
||||
if ( subtx.vout.size() > 0 && DecodeOraclesOpRet(subtx.vout[subtx.vout.size()-1].scriptPubKey,subtxid,pk,num) == 'S' && subtxid == oracletxid && pk == publisher )
|
||||
{
|
||||
@@ -818,7 +818,7 @@ int64_t AddMyOraclesFunds(struct CCcontract_info *cp,CMutableTransaction &mtx,CP
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
nValue = it->second.satoshis;
|
||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 && (numvouts=vintx.vout.size())>0)
|
||||
if ( myGetTransaction(txid,vintx,hashBlock) != 0 && (numvouts=vintx.vout.size())>0)
|
||||
{
|
||||
if ((funcid=DecodeOraclesOpRet(vintx.vout[numvouts-1].scriptPubKey,tmporacletxid,tmppk,tmpamount))!=0 && funcid=='F' && tmppk==pk
|
||||
&& tmporacletxid==oracletxid && tmpamount==nValue && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout)==0)
|
||||
@@ -986,7 +986,7 @@ std::string OracleData(int64_t txfee,uint256 oracletxid,std::vector <uint8_t> da
|
||||
fprintf(stderr,"%s\n", CCerror.c_str() );
|
||||
return("");
|
||||
}
|
||||
if ( GetTransaction(oracletxid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size()) > 0 )
|
||||
if ( myGetTransaction(oracletxid,tx,hashBlock) != 0 && (numvouts=tx.vout.size()) > 0 )
|
||||
{
|
||||
if ( DecodeOraclesCreateOpRet(tx.vout[numvouts-1].scriptPubKey,name,description,format) == 'C' )
|
||||
{
|
||||
@@ -1061,11 +1061,11 @@ UniValue OracleDataSample(uint256 reforacletxid,uint256 txid)
|
||||
CPubKey pk; std::string name,description,format; int32_t numvouts; std::vector<uint8_t> data; char str[67], *formatstr = 0;
|
||||
|
||||
result.push_back(Pair("result","success"));
|
||||
if ( GetTransaction(reforacletxid,oracletx,hashBlock,false) != 0 && (numvouts=oracletx.vout.size()) > 0 )
|
||||
if ( myGetTransaction(reforacletxid,oracletx,hashBlock) != 0 && (numvouts=oracletx.vout.size()) > 0 )
|
||||
{
|
||||
if ( DecodeOraclesCreateOpRet(oracletx.vout[numvouts-1].scriptPubKey,name,description,format) == 'C' )
|
||||
{
|
||||
if ( GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size()) > 0 )
|
||||
if ( myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size()) > 0 )
|
||||
{
|
||||
if ( DecodeOraclesData(tx.vout[numvouts-1].scriptPubKey,oracletxid,btxid,pk,data) == 'D' && reforacletxid == oracletxid )
|
||||
{
|
||||
@@ -1094,7 +1094,7 @@ UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num)
|
||||
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; int64_t nValue;
|
||||
|
||||
result.push_back(Pair("result","success"));
|
||||
if ( GetTransaction(reforacletxid,oracletx,hashBlock,false) != 0 && (numvouts=oracletx.vout.size()) > 0 )
|
||||
if ( myGetTransaction(reforacletxid,oracletx,hashBlock) != 0 && (numvouts=oracletx.vout.size()) > 0 )
|
||||
{
|
||||
if ( DecodeOraclesCreateOpRet(oracletx.vout[numvouts-1].scriptPubKey,name,description,format) == 'C' )
|
||||
{
|
||||
@@ -1122,7 +1122,7 @@ UniValue OracleDataSamples(uint256 reforacletxid,char* batonaddr,int32_t num)
|
||||
txid=it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
nValue = (int64_t)it->second;
|
||||
if (vout==1 && nValue==10000 && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size()) > 0 )
|
||||
if (vout==1 && nValue==10000 && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size()) > 0 )
|
||||
{
|
||||
if ( DecodeOraclesData(tx.vout[numvouts-1].scriptPubKey,oracletxid,btxid,pk,data) == 'D' && reforacletxid == oracletxid )
|
||||
{
|
||||
@@ -1155,14 +1155,14 @@ UniValue OracleInfo(uint256 origtxid)
|
||||
|
||||
cp = CCinit(&C,EVAL_ORACLES);
|
||||
CCtxidaddr(markeraddr,origtxid);
|
||||
if ( GetTransaction(origtxid,tx,hashBlock,false) == 0 )
|
||||
if ( myGetTransaction(origtxid,tx,hashBlock) == 0 )
|
||||
{
|
||||
fprintf(stderr,"cant find oracleid\n");
|
||||
result.push_back(Pair("result","error"));
|
||||
result.push_back(Pair("error","cant find oracleid"));
|
||||
return(result);
|
||||
}
|
||||
if ( GetTransaction(origtxid,tx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(origtxid,tx,hashBlock) != 0 )
|
||||
{
|
||||
if ( tx.vout.size() > 0 && DecodeOraclesCreateOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,name,description,format) == 'C' )
|
||||
{
|
||||
@@ -1177,7 +1177,7 @@ UniValue OracleInfo(uint256 origtxid)
|
||||
{
|
||||
txid = it->first.txhash;
|
||||
height = (int32_t)it->second.blockHeight;
|
||||
if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.vout.size() > 0 &&
|
||||
if ( myGetTransaction(txid,tx,hashBlock) != 0 && tx.vout.size() > 0 &&
|
||||
DecodeOraclesOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,oracletxid,pk,datafee) == 'R' && oracletxid == origtxid )
|
||||
{
|
||||
if (publishers.find(pk)==publishers.end() || height>publishers[pk].second)
|
||||
@@ -1189,7 +1189,7 @@ UniValue OracleInfo(uint256 origtxid)
|
||||
}
|
||||
for (std::map<CPubKey,std::pair<uint256,int32_t>>::iterator it = publishers.begin(); it != publishers.end(); ++it)
|
||||
{
|
||||
if ( GetTransaction(it->second.first,tx,hashBlock,false) != 0 && DecodeOraclesOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,oracletxid,pk,datafee) == 'R')
|
||||
if ( myGetTransaction(it->second.first,tx,hashBlock) != 0 && DecodeOraclesOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,oracletxid,pk,datafee) == 'R')
|
||||
{
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("publisher",pubkey33_str(str,(uint8_t *)pk.begin())));
|
||||
@@ -1222,7 +1222,7 @@ UniValue OraclesList()
|
||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||
{
|
||||
txid = it->first.txhash;
|
||||
if ( GetTransaction(txid,createtx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(txid,createtx,hashBlock) != 0 )
|
||||
{
|
||||
if ( createtx.vout.size() > 0 && DecodeOraclesCreateOpRet(createtx.vout[createtx.vout.size()-1].scriptPubKey,name,description,format) == 'C' )
|
||||
{
|
||||
|
||||
@@ -559,7 +559,7 @@ int64_t AddPaymentsInputs(bool fLockedBlocks,int8_t GetBalance,struct CCcontract
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
//fprintf(stderr,"iter.%d %s/v%d %s\n",iter,txid.GetHex().c_str(),vout,coinaddr);
|
||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
|
||||
{
|
||||
if ( (nValue= IsPaymentsvout(cp,vintx,vout,coinaddr,ccopret)) > PAYMENTS_TXFEE && nValue >= threshold && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 )
|
||||
{
|
||||
|
||||
@@ -382,7 +382,7 @@ int64_t AddPegsInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKe
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
// no need to prevent dup
|
||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
|
||||
{
|
||||
if (myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 )
|
||||
{
|
||||
@@ -413,7 +413,7 @@ int64_t AddPegsTokenInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,u
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
// no need to prevent dup
|
||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
|
||||
{
|
||||
if (myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 && DecodePegsOpRet(vintx,tmppegstxid,tmptokenid)!=0 && tmppegstxid==pegstxid && tmptokenid==tokenid)
|
||||
{
|
||||
@@ -521,7 +521,7 @@ double PegsGetTokenPrice(uint256 tokenid)
|
||||
int64_t *tokensyn,*btcusd; double price; CTransaction tokentx; uint256 hashBlock;
|
||||
std::string name,desc; std::vector<uint8_t> vorigpubkey; int32_t numvouts;
|
||||
|
||||
if (GetTransaction(tokenid,tokentx,hashBlock,false)!=0 && (numvouts=tokentx.vout.size())>0 && DecodeTokenCreateOpRet(tokentx.vout[numvouts-1].scriptPubKey,vorigpubkey,name,desc)=='c')
|
||||
if (myGetTransaction(tokenid,tokentx,hashBlock)!=0 && (numvouts=tokentx.vout.size())>0 && DecodeTokenCreateOpRet(tokentx.vout[numvouts-1].scriptPubKey,vorigpubkey,name,desc)=='c')
|
||||
{
|
||||
tokensyn = (int64_t *)calloc(sizeof(*tokensyn) * 3, 1 + PRICES_DAYWINDOW * 2 + PRICES_SMOOTHWIDTH);
|
||||
btcusd = (int64_t *)calloc(sizeof(*btcusd) * 3, 1 + PRICES_DAYWINDOW * 2 + PRICES_SMOOTHWIDTH);
|
||||
@@ -539,7 +539,7 @@ std::string PegsGetTokenName(uint256 tokenid)
|
||||
{
|
||||
CTransaction tokentx; uint256 hashBlock; std::string name,desc; std::vector<uint8_t> vorigpubkey; int32_t numvouts;
|
||||
|
||||
if (GetTransaction(tokenid,tokentx,hashBlock,false)!=0 && (numvouts=tokentx.vout.size())>0 && DecodeTokenCreateOpRet(tokentx.vout[numvouts-1].scriptPubKey,vorigpubkey,name,desc)=='c')
|
||||
if (myGetTransaction(tokenid,tokentx,hashBlock)!=0 && (numvouts=tokentx.vout.size())>0 && DecodeTokenCreateOpRet(tokentx.vout[numvouts-1].scriptPubKey,vorigpubkey,name,desc)=='c')
|
||||
{
|
||||
return (name);
|
||||
}
|
||||
@@ -555,7 +555,7 @@ double PegsGetAccountRatio(uint256 pegstxid,uint256 tokenid,uint256 accounttxid)
|
||||
std::pair<int64_t,int64_t> account; struct CCcontract_info *cp,C;
|
||||
|
||||
cp = CCinit(&C,EVAL_PEGS);
|
||||
if (GetTransaction(accounttxid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 &&
|
||||
if (myGetTransaction(accounttxid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 &&
|
||||
(funcid=DecodePegsOpRet(tx,tmppegstxid,tmptokenid))!=0 && pegstxid==tmppegstxid && tokenid==tmptokenid)
|
||||
{
|
||||
PegsDecodeAccountTx(tx,pk,amount,account);
|
||||
@@ -581,7 +581,7 @@ double PegsGetGlobalRatio(uint256 pegstxid)
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
nValue = (int64_t)it->second.satoshis;
|
||||
if (vout == 0 && nValue == CC_MARKER_VALUE && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 &&
|
||||
if (vout == 0 && nValue == CC_MARKER_VALUE && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 &&
|
||||
(funcid=DecodePegsOpRet(tx,tmppegstxid,tokenid))!=0 && pegstxid==tmppegstxid && (funcid=='F' || funcid=='G' || funcid=='E'))
|
||||
{
|
||||
PegsDecodeAccountTx(tx,pk,amount,account);
|
||||
@@ -597,7 +597,7 @@ double PegsGetGlobalRatio(uint256 pegstxid)
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
nValue = (int64_t)it->second.satoshis;
|
||||
if (GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 && DecodePegsOpRet(tx,tmppegstxid,tokenid)!=0 && pegstxid==tmppegstxid)
|
||||
if (myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 && DecodePegsOpRet(tx,tmppegstxid,tokenid)!=0 && pegstxid==tmppegstxid)
|
||||
{
|
||||
globalaccounts[tokenid].first+=nValue;
|
||||
}
|
||||
@@ -660,7 +660,7 @@ std::string PegsCreate(uint64_t txfee,int64_t amount, std::vector<uint256> bindt
|
||||
pegspk = GetUnspendable(cp,0);
|
||||
for(auto txid : bindtxids)
|
||||
{
|
||||
if (GetTransaction(txid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0)
|
||||
if (myGetTransaction(txid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("cant find bindtxid %s",txid.GetHex());
|
||||
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -697,7 +697,7 @@ std::string PegsFund(uint64_t txfee,uint256 pegstxid, uint256 tokenid,int64_t am
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
|
||||
pegspk = GetUnspendable(cp,0);
|
||||
if (GetTransaction(pegstxid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0)
|
||||
if (myGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("cant find pegstxid %s",pegstxid.GetHex());
|
||||
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -711,7 +711,7 @@ std::string PegsFund(uint64_t txfee,uint256 pegstxid, uint256 tokenid,int64_t am
|
||||
}
|
||||
for(auto txid : bindtxids)
|
||||
{
|
||||
if (GetTransaction(txid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0)
|
||||
if (myGetTransaction(txid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("cant find bindtxid %s",txid.GetHex());
|
||||
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -794,7 +794,7 @@ std::string PegsGet(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64_t am
|
||||
txfee = 10000;
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
pegspk = GetUnspendable(cp,0);
|
||||
if (GetTransaction(pegstxid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0)
|
||||
if (myGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("cant find pegstxid %s",pegstxid.GetHex());
|
||||
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -855,7 +855,7 @@ std::string PegsRedeem(uint64_t txfee,uint256 pegstxid, uint256 tokenid)
|
||||
txfee = 10000;
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
pegspk = GetUnspendable(cp,0);
|
||||
if (GetTransaction(pegstxid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0)
|
||||
if (myGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("cant find pegstxid %s",pegstxid.GetHex());
|
||||
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -869,7 +869,7 @@ std::string PegsRedeem(uint64_t txfee,uint256 pegstxid, uint256 tokenid)
|
||||
}
|
||||
for(auto txid : bindtxids)
|
||||
{
|
||||
if (GetTransaction(txid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0)
|
||||
if (myGetTransaction(txid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("cant find bindtxid %s",txid.GetHex());
|
||||
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -968,7 +968,7 @@ std::string PegsExchange(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64
|
||||
txfee = 10000;
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
pegspk = GetUnspendable(cp,0);
|
||||
if (GetTransaction(pegstxid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0)
|
||||
if (myGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("cant find pegstxid %s",pegstxid.GetHex());
|
||||
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -982,7 +982,7 @@ std::string PegsExchange(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64
|
||||
}
|
||||
for(auto txid : bindtxids)
|
||||
{
|
||||
if (GetTransaction(txid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0)
|
||||
if (myGetTransaction(txid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("cant find bindtxid %s",txid.GetHex());
|
||||
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1026,7 +1026,7 @@ std::string PegsExchange(uint64_t txfee,uint256 pegstxid, uint256 tokenid, int64
|
||||
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
if (accounttxid!=zeroid && GetTransaction(accounttxid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0 || PegsDecodeAccountTx(tx,tmppk,tmpamount,account).empty())
|
||||
if (accounttxid!=zeroid && myGetTransaction(accounttxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0 || PegsDecodeAccountTx(tx,tmppk,tmpamount,account).empty())
|
||||
{
|
||||
CCerror = strprintf("invalid account tx from which to exchange coins to tokens %s!",accounttxid.GetHex());
|
||||
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1104,7 +1104,7 @@ std::string PegsLiquidate(uint64_t txfee,uint256 pegstxid, uint256 tokenid, uint
|
||||
txfee = 10000;
|
||||
mypk = pubkey2pk(Mypubkey());
|
||||
pegspk = GetUnspendable(cp,0);
|
||||
if (GetTransaction(pegstxid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0)
|
||||
if (myGetTransaction(pegstxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("cant find pegstxid %s",pegstxid.GetHex());
|
||||
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1118,7 +1118,7 @@ std::string PegsLiquidate(uint64_t txfee,uint256 pegstxid, uint256 tokenid, uint
|
||||
}
|
||||
for(auto txid : bindtxids)
|
||||
{
|
||||
if (GetTransaction(txid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0)
|
||||
if (myGetTransaction(txid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0)
|
||||
{
|
||||
CCerror = strprintf("cant find bindtxid %s",txid.GetHex());
|
||||
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1160,7 +1160,7 @@ std::string PegsLiquidate(uint64_t txfee,uint256 pegstxid, uint256 tokenid, uint
|
||||
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
return("");
|
||||
}
|
||||
if (liquidatetxid!=zeroid && GetTransaction(liquidatetxid,tx,hashBlock,false)==0 || (numvouts=tx.vout.size())<=0 || PegsDecodeAccountTx(tx,tmppk,amount,account).empty())
|
||||
if (liquidatetxid!=zeroid && myGetTransaction(liquidatetxid,tx,hashBlock)==0 || (numvouts=tx.vout.size())<=0 || PegsDecodeAccountTx(tx,tmppk,amount,account).empty())
|
||||
{
|
||||
CCerror = strprintf("cannot find account to liquidate or invalid tx %s!",liquidatetxid.GetHex());
|
||||
LOGSTREAM("pegscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||
@@ -1235,7 +1235,7 @@ UniValue PegsAccountHistory(uint256 pegstxid)
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
nValue = (int64_t)it->second;
|
||||
if (vout == 1 && nValue == CC_MARKER_VALUE && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 &&
|
||||
if (vout == 1 && nValue == CC_MARKER_VALUE && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 &&
|
||||
(funcid=DecodePegsOpRet(tx,tmppegstxid,tmptokenid))!=0 && pegstxid==tmppegstxid)
|
||||
{
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
@@ -1272,7 +1272,7 @@ UniValue PegsAccountInfo(uint256 pegstxid)
|
||||
vout = (int32_t)it->first.index;
|
||||
nValue = (int64_t)it->second.satoshis;
|
||||
//LOGSTREAM("pegscc",CCLOG_DEBUG2, stream << "txid=" << txid.GetHex() << ", vout=" << vout << ", nValue=" << nValue << std::endl);
|
||||
if (vout == 1 && nValue == CC_MARKER_VALUE && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 &&
|
||||
if (vout == 1 && nValue == CC_MARKER_VALUE && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 &&
|
||||
(funcid=DecodePegsOpRet(tx,tmppegstxid,tmptokenid))!=0 && pegstxid==tmppegstxid)
|
||||
{
|
||||
//LOGSTREAM("pegscc",CCLOG_DEBUG2, stream << "txid=" << txid.GetHex() << ", vout=" << vout << ", nValue=" << nValue << ", tokenid=" << tmptokenid.GetHex() << std::endl);
|
||||
@@ -1314,7 +1314,7 @@ UniValue PegsWorstAccounts(uint256 pegstxid)
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
nValue = (int64_t)it->second.satoshis;
|
||||
if (vout == 0 && nValue == CC_MARKER_VALUE && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 &&
|
||||
if (vout == 0 && nValue == CC_MARKER_VALUE && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 &&
|
||||
(funcid=DecodePegsOpRet(tx,tmppegstxid,tokenid))!=0 && pegstxid==tmppegstxid)
|
||||
{
|
||||
PegsDecodeAccountTx(tx,pk,amount,account);
|
||||
@@ -1366,7 +1366,7 @@ UniValue PegsInfo(uint256 pegstxid)
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
nValue = (int64_t)it->second.satoshis;
|
||||
if (vout == 0 && nValue == CC_MARKER_VALUE && GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 &&
|
||||
if (vout == 0 && nValue == CC_MARKER_VALUE && myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 &&
|
||||
(funcid=DecodePegsOpRet(tx,tmppegstxid,tokenid))!=0 && pegstxid==tmppegstxid)
|
||||
{
|
||||
PegsDecodeAccountTx(tx,pk,amount,account);
|
||||
@@ -1382,7 +1382,7 @@ UniValue PegsInfo(uint256 pegstxid)
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
nValue = (int64_t)it->second.satoshis;
|
||||
if (GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size())>0 && DecodePegsOpRet(tx,tmppegstxid,tokenid)!=0 && pegstxid==tmppegstxid)
|
||||
if (myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts=tx.vout.size())>0 && DecodePegsOpRet(tx,tmppegstxid,tokenid)!=0 && pegstxid==tmppegstxid)
|
||||
{
|
||||
globalaccounts[tokenid].first+=nValue;
|
||||
}
|
||||
|
||||
@@ -590,7 +590,7 @@ int64_t AddPricesInputs(struct CCcontract_info *cp, CMutableTransaction &mtx, ch
|
||||
vout = (int32_t)it->first.index;
|
||||
//if (vout == exclvout && txid == excltxid) // exclude vout which is added directly to vins outside this function
|
||||
// continue;
|
||||
if (GetTransaction(txid, vintx, hashBlock, false) != 0 && vout < vintx.vout.size())
|
||||
if (myGetTransaction(txid, vintx, hashBlock) != 0 && vout < vintx.vout.size())
|
||||
{
|
||||
vscript_t vopret;
|
||||
uint8_t funcId = PricesCheckOpret(vintx, vopret);
|
||||
@@ -2161,7 +2161,7 @@ UniValue PricesList(uint32_t filter, CPubKey mypk)
|
||||
std::vector<uint16_t> vec;
|
||||
CTransaction vintx;
|
||||
|
||||
if (GetTransaction(txid, vintx, hashBlock, false) != 0)
|
||||
if (myGetTransaction(txid, vintx, hashBlock) != 0)
|
||||
{
|
||||
|
||||
// TODO: forget old tx
|
||||
|
||||
@@ -357,7 +357,7 @@ int64_t AddRewardsInputs(CScript &scriptPubKey,uint64_t maxseconds,struct CCcont
|
||||
break;
|
||||
if ( j != mtx.vin.size() )
|
||||
continue;
|
||||
if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.vout.size() > 0 && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 )
|
||||
if ( myGetTransaction(txid,tx,hashBlock) != 0 && tx.vout.size() > 0 && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 )
|
||||
{
|
||||
if ( (funcid= DecodeRewardsOpRet(txid,tx.vout[tx.vout.size()-1].scriptPubKey,sbits,fundingtxid)) != 0 )
|
||||
{
|
||||
@@ -409,7 +409,7 @@ int64_t RewardsPlanFunds(uint64_t &lockedfunds,uint64_t refsbits,struct CCcontra
|
||||
{
|
||||
txid = it->first.txhash;
|
||||
vout = (int32_t)it->first.index;
|
||||
if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 )
|
||||
if ( myGetTransaction(txid,tx,hashBlock) != 0 && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 )
|
||||
{
|
||||
if ( (funcid= DecodeRewardsOpRet(txid,tx.vout[tx.vout.size()-1].scriptPubKey,sbits,fundingtxid)) == 'F' || funcid == 'A' || funcid == 'U' || funcid == 'L' )
|
||||
{
|
||||
@@ -439,7 +439,7 @@ bool RewardsPlanExists(struct CCcontract_info *cp,uint64_t refsbits,CPubKey rewa
|
||||
{
|
||||
//int height = it->first.blockHeight;
|
||||
txid = it->first.txhash;
|
||||
if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.vout.size() > 0 && ConstrainVout(tx.vout[0],1,CCaddr,0) != 0 )
|
||||
if ( myGetTransaction(txid,tx,hashBlock) != 0 && tx.vout.size() > 0 && ConstrainVout(tx.vout[0],1,CCaddr,0) != 0 )
|
||||
{
|
||||
//char str[65]; fprintf(stderr,"rewards plan %s\n",uint256_str(str,txid));
|
||||
if ( DecodeRewardsFundingOpRet(tx.vout[tx.vout.size()-1].scriptPubKey,sbits,APR,minseconds,maxseconds,mindeposit) == 'F' )
|
||||
@@ -455,7 +455,7 @@ bool RewardsPlanExists(struct CCcontract_info *cp,uint64_t refsbits,CPubKey rewa
|
||||
UniValue RewardsInfo(uint256 rewardsid)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ); uint256 hashBlock; CTransaction vintx; uint64_t lockedfunds,APR,minseconds,maxseconds,mindeposit,sbits,funding; CPubKey rewardspk; struct CCcontract_info *cp,C; char str[67],numstr[65];
|
||||
if ( GetTransaction(rewardsid,vintx,hashBlock,false) == 0 )
|
||||
if ( myGetTransaction(rewardsid,vintx,hashBlock) == 0 )
|
||||
{
|
||||
fprintf(stderr,"cant find fundingtxid\n");
|
||||
result.push_back(Pair("result","error"));
|
||||
@@ -498,7 +498,7 @@ UniValue RewardsList()
|
||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||
{
|
||||
txid = it->first.txhash;
|
||||
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
|
||||
if ( myGetTransaction(txid,vintx,hashBlock) != 0 )
|
||||
{
|
||||
if ( vintx.vout.size() > 0 && DecodeRewardsFundingOpRet(vintx.vout[vintx.vout.size()-1].scriptPubKey,sbits,APR,minseconds,maxseconds,mindeposit) != 0 )
|
||||
{
|
||||
@@ -657,7 +657,7 @@ std::string RewardsUnlock(uint64_t txfee,char *planstr,uint256 fundingtxid,uint2
|
||||
CCerror = "locktxid/v0 is spent";
|
||||
return("");
|
||||
}
|
||||
if ( GetTransaction(locktxid,tx,hashBlock,false) != 0 && tx.vout.size() > 0 && tx.vout[1].scriptPubKey.IsPayToCryptoCondition() == 0 )
|
||||
if ( myGetTransaction(locktxid,tx,hashBlock) != 0 && tx.vout.size() > 0 && tx.vout[1].scriptPubKey.IsPayToCryptoCondition() == 0 )
|
||||
{
|
||||
scriptPubKey = tx.vout[1].scriptPubKey;
|
||||
mtx.vin.push_back(CTxIn(locktxid,0,CScript()));
|
||||
|
||||
@@ -2730,7 +2730,7 @@ UniValue sudoku_txidinfo(uint64_t txfee,struct CCcontract_info *cp,cJSON *params
|
||||
decode_hex((uint8_t *)&txid,32,txidstr);
|
||||
txid = revuint256(txid);
|
||||
result.push_back(Pair("txid",txid.GetHex()));
|
||||
if ( GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 1 )
|
||||
if ( myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 )
|
||||
{
|
||||
if ( sudoku_genopreturndecode(unsolved,tx.vout[numvouts-1].scriptPubKey) == 'G' )
|
||||
{
|
||||
@@ -2780,7 +2780,7 @@ UniValue sudoku_pending(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
//char str[65]; fprintf(stderr,"%s check %s/v%d %.8f\n",coinaddr,uint256_str(str,txid),vout,(double)it->second.satoshis/COIN);
|
||||
if ( it->second.satoshis != txfee || vout != 0 )
|
||||
continue;
|
||||
if ( GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 1 )
|
||||
if ( myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 )
|
||||
{
|
||||
if ( (nValue= IsCClibvout(cp,tx,vout,coinaddr)) == txfee && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 )
|
||||
{
|
||||
@@ -2861,7 +2861,7 @@ UniValue sudoku_solution(uint64_t txfee,struct CCcontract_info *cp,cJSON *params
|
||||
result.push_back(Pair("txid",txid.GetHex()));
|
||||
if ( CCgettxout(txid,0,1,0) < 0 )
|
||||
result.push_back(Pair("error","already solved"));
|
||||
else if ( GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 1 )
|
||||
else if ( myGetTransaction(txid,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 1 )
|
||||
{
|
||||
Getscriptaddress(checkaddr,tx.vout[1].scriptPubKey);
|
||||
if ( strcmp(checkaddr,CCaddr) != 0 )
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
******************************************************************************/
|
||||
|
||||
#include "consensus/upgrades.h"
|
||||
extern int32_t KOMODO_NSPV;
|
||||
#define NSPV_BRANCHID 0x76b809bb
|
||||
|
||||
/**
|
||||
* General information about each network upgrade.
|
||||
@@ -97,7 +99,10 @@ int CurrentEpoch(int nHeight, const Consensus::Params& params) {
|
||||
return Consensus::BASE_SPROUT;
|
||||
}
|
||||
|
||||
uint32_t CurrentEpochBranchId(int nHeight, const Consensus::Params& params) {
|
||||
uint32_t CurrentEpochBranchId(int nHeight, const Consensus::Params& params)
|
||||
{
|
||||
if ( KOMODO_NSPV != 0 )
|
||||
return(NSPV_BRANCHID);
|
||||
return NetworkUpgradeInfo[CurrentEpoch(nHeight, params)].nBranchId;
|
||||
}
|
||||
|
||||
|
||||
@@ -272,9 +272,13 @@ int cc_verify(const struct CC *cond, const unsigned char *msg, size_t msgLength,
|
||||
unsigned char msgHash[32];
|
||||
if (doHashMsg) sha256(msg, msgLength, msgHash);
|
||||
else memcpy(msgHash, msg, 32);
|
||||
int32_t z;
|
||||
for (z=0; z<32; z++)
|
||||
fprintf(stderr,"%02x",msgHash[z]);
|
||||
fprintf(stderr," msgHash msglen.%d\n",msgLength);
|
||||
|
||||
if (!cc_secp256k1VerifyTreeMsg32(cond, msgHash)) {
|
||||
fprintf(stderr,"cc_verify error C\n");
|
||||
fprintf(stderr," cc_verify error C\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,11 @@ static int secp256k1Sign(CC *cond, CCVisitor visitor) {
|
||||
int rc = secp256k1_ecdsa_sign(ec_ctx_sign, &sig, visitor.msg, signing->sk, NULL, NULL);
|
||||
unlockSign();
|
||||
|
||||
if (rc != 1) return 0;
|
||||
if (rc != 1)
|
||||
{
|
||||
fprintf(stderr,"secp256k1Sign rc.%d\n",rc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!cond->signature) cond->signature = calloc(1, SECP256K1_SIG_SIZE);
|
||||
secp256k1_ecdsa_signature_serialize_compact(ec_ctx_verify, cond->signature, &sig);
|
||||
@@ -188,16 +192,22 @@ int cc_signTreeSecp256k1Msg32(CC *cond, const unsigned char *privateKey, const u
|
||||
}
|
||||
|
||||
// serialize pubkey
|
||||
unsigned char *publicKey = calloc(1, SECP256K1_PK_SIZE);
|
||||
//unsigned char *publicKey = calloc(1, SECP256K1_PK_SIZE);
|
||||
unsigned char publicKey[SECP256K1_PK_SIZE];
|
||||
size_t ol = SECP256K1_PK_SIZE;
|
||||
secp256k1_ec_pubkey_serialize(ec_ctx_verify, publicKey, &ol, &spk, SECP256K1_EC_COMPRESSED);
|
||||
|
||||
{
|
||||
int32_t z;
|
||||
for (z=0; z<33; z++)
|
||||
fprintf(stderr,"%02x",publicKey[z]);
|
||||
fprintf(stderr," pubkey\n");
|
||||
}
|
||||
// sign
|
||||
CCSecp256k1SigningData signing = {publicKey, privateKey, 0};
|
||||
CCVisitor visitor = {&secp256k1Sign, msg32, 32, &signing};
|
||||
cc_visit(cond, visitor);
|
||||
|
||||
free(publicKey);
|
||||
//free(publicKey);
|
||||
return signing.nSigned;
|
||||
}
|
||||
|
||||
|
||||
7
src/fiat/hush
Executable file
7
src/fiat/hush
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
#set working directory to the location of this script
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
cd $DIR
|
||||
|
||||
../komodo-cli -ac_name=HUSH3 "$@"
|
||||
11
src/hush-cli
Executable file
11
src/hush-cli
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2019 Hush developers
|
||||
|
||||
# set working directory to the location of this script
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
cd $DIR
|
||||
|
||||
NAME=HUSH3
|
||||
|
||||
CLI=${KOMODOCLI:-./komodo-cli}
|
||||
$CLI -ac_name=$NAME "$@"
|
||||
52
src/hushd
Executable file
52
src/hushd
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2019 Hush developers
|
||||
|
||||
# set working directory to the location of this script
|
||||
DIR="$( cd "$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )" )" && pwd )"
|
||||
cd $DIR
|
||||
|
||||
NAME=HUSH3
|
||||
# this corresponds to FR address RHushEyeDm7XwtaTWtyCbjGQumYyV8vMjn
|
||||
SCRIPT=76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac
|
||||
|
||||
# Chain parameters
|
||||
ERAS=3
|
||||
BLOCKTIME=150
|
||||
# 6250000 - (sprout pool at block 500,000)
|
||||
SUPPLY=6178674
|
||||
FOUNDERS=1
|
||||
REWARD=0,1125000000,562500000
|
||||
PERC=11111111
|
||||
HALVING=129,340000,840000
|
||||
# NOTE: keep in sync with komodo_bitcoind.h
|
||||
END=128,340000,5422111
|
||||
CLIENTNAME=GoldenSandtrout
|
||||
SEEDNODE1=188.165.212.101
|
||||
SEEDNODE2=136.243.227.142
|
||||
SEEDNODE3=5.9.224.250
|
||||
CCLIB=hush3
|
||||
|
||||
# CryptoConditions/Custom Consensus params
|
||||
FAUCET=228
|
||||
HEIR=234
|
||||
CHANNEL=235
|
||||
ORACLE=236
|
||||
GATEWAY=241
|
||||
CCENABLE=$FAUCET,$HEIR,$CHANNEL,$ORACLE,$GATEWAY
|
||||
|
||||
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=$SEEDNODE1 \
|
||||
-addnode=$SEEDNODE2 \
|
||||
-addnode=$SEEDNODE3 \
|
||||
-ac_cclib=$CCLIB \
|
||||
-ac_script=$SCRIPT "$@"
|
||||
@@ -1496,6 +1496,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
InitBlockIndex();
|
||||
SetRPCWarmupFinished();
|
||||
uiInterface.InitMessage(_("Done loading"));
|
||||
pwalletMain = new CWallet("tmptmp.wallet");
|
||||
return !fRequestShutdown;
|
||||
}
|
||||
// ********************************************************* Step 7: load block chain
|
||||
|
||||
@@ -47,6 +47,8 @@ using namespace std;
|
||||
|
||||
#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);
|
||||
|
||||
@@ -1256,16 +1256,53 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams);
|
||||
|
||||
uint64_t komodo_commission(const CBlock *pblock,int32_t height)
|
||||
{
|
||||
static bool didinit = false,ishush3 = false;
|
||||
// LABS fungible chains, cannot have any block reward!
|
||||
if ( is_STAKED(ASSETCHAINS_SYMBOL) == 2 )
|
||||
return(0);
|
||||
|
||||
if (!didinit) {
|
||||
ishush3 = strncmp(ASSETCHAINS_SYMBOL, "HUSH3",5) == 0 ? true : false;
|
||||
didinit = true;
|
||||
}
|
||||
|
||||
int32_t i,j,n=0,txn_count; int64_t nSubsidy; uint64_t commission,total = 0;
|
||||
if ( ASSETCHAINS_FOUNDERS != 0 )
|
||||
{
|
||||
nSubsidy = GetBlockSubsidy(height,Params().GetConsensus());
|
||||
//fprintf(stderr,"ht.%d nSubsidy %.8f prod %llu\n",height,(double)nSubsidy/COIN,(long long)(nSubsidy * ASSETCHAINS_COMMISSION));
|
||||
commission = ((nSubsidy * ASSETCHAINS_COMMISSION) / COIN);
|
||||
|
||||
if (ishush3) {
|
||||
int32_t starting_commission = 125000000, HALVING1 = 340000, INTERVAL = 840000, TRANSITION = 129, BR_END = 5422111;
|
||||
// HUSH supply curve cannot be exactly represented via KMD AC CLI args, so we do it ourselves.
|
||||
// You specify the BR, and the FR % gets added so 10% of 12.5 is 1.25
|
||||
// but to tell the AC params, I need to say "11% of 11.25" is 1.25
|
||||
// 11% ie. 1/9th cannot be exactly represented and so the FR has tiny amounts of error unless done manually
|
||||
// Transition period of 128 blocks has BR=FR=0
|
||||
if (height < TRANSITION) {
|
||||
commission = 0;
|
||||
} else if (height < HALVING1) {
|
||||
commission = starting_commission;
|
||||
} else if (height < HALVING1+1*INTERVAL) {
|
||||
commission = starting_commission / 2;
|
||||
} else if (height < HALVING1+2*INTERVAL) {
|
||||
commission = starting_commission / 4;
|
||||
} else if (height < HALVING1+3*INTERVAL) {
|
||||
commission = starting_commission / 8;
|
||||
} else if (height < HALVING1+4*INTERVAL) {
|
||||
commission = starting_commission / 16;
|
||||
} else if (height < HALVING1+5*INTERVAL) {
|
||||
commission = starting_commission / 32;
|
||||
} else if (height < HALVING1+6*INTERVAL) { // Block 5380000
|
||||
// Block reward will go to zero between 7th+8th halvings, ac_end may need adjusting
|
||||
commission = starting_commission / 64;
|
||||
} else if (height < HALVING1+7*INTERVAL) {
|
||||
// Block reward will be zero before this is ever reached
|
||||
commission = starting_commission / 128; // Block 6220000
|
||||
}
|
||||
}
|
||||
|
||||
if ( ASSETCHAINS_FOUNDERS > 1 )
|
||||
{
|
||||
if ( (height % ASSETCHAINS_FOUNDERS) == 0 )
|
||||
@@ -2072,7 +2109,7 @@ bool komodo_appendACscriptpub()
|
||||
{
|
||||
CTransaction tx; uint256 blockhash;
|
||||
// get transaction and check that it occured before height 100.
|
||||
if ( myGetTransaction(KOMODO_EARLYTXID,tx,blockhash) && mapBlockIndex[blockhash]->GetHeight() < 100 )
|
||||
if ( myGetTransaction(KOMODO_EARLYTXID,tx,blockhash) && mapBlockIndex[blockhash]->GetHeight() < KOMODO_EARLYTXID_HEIGHT )
|
||||
{
|
||||
for (int i = 0; i < tx.vout.size(); i++)
|
||||
{
|
||||
@@ -2107,15 +2144,15 @@ void GetKomodoEarlytxidScriptPub()
|
||||
StartShutdown();
|
||||
return;
|
||||
}
|
||||
if ( chainActive.Height() < 100 )
|
||||
if ( chainActive.Height() < KOMODO_EARLYTXID_HEIGHT )
|
||||
{
|
||||
fprintf(stderr, "Cannot fetch -earlytxid before block 100.\n");
|
||||
fprintf(stderr, "Cannot fetch -earlytxid before block %d.\n",KOMODO_EARLYTXID_HEIGHT);
|
||||
StartShutdown();
|
||||
return;
|
||||
}
|
||||
CTransaction tx; uint256 blockhash; int32_t i;
|
||||
// get transaction and check that it occured before height 100.
|
||||
if ( myGetTransaction(KOMODO_EARLYTXID,tx,blockhash) && mapBlockIndex[blockhash]->GetHeight() < 100 )
|
||||
if ( myGetTransaction(KOMODO_EARLYTXID,tx,blockhash) && mapBlockIndex[blockhash]->GetHeight() < KOMODO_EARLYTXID_HEIGHT )
|
||||
{
|
||||
for (i = 0; i < tx.vout.size(); i++)
|
||||
if ( tx.vout[i].scriptPubKey[0] == OP_RETURN )
|
||||
@@ -2156,7 +2193,7 @@ int64_t komodo_checkcommission(CBlock *pblock,int32_t height)
|
||||
if ( ASSETCHAINS_SCRIPTPUB.size() > 1 )
|
||||
{
|
||||
static bool didinit = false;
|
||||
if ( !didinit && height > 100 && KOMODO_EARLYTXID != zeroid && komodo_appendACscriptpub() )
|
||||
if ( !didinit && height > KOMODO_EARLYTXID_HEIGHT && KOMODO_EARLYTXID != zeroid && komodo_appendACscriptpub() )
|
||||
{
|
||||
fprintf(stderr, "appended CC_op_return to ASSETCHAINS_SCRIPTPUB.%s\n", ASSETCHAINS_SCRIPTPUB.c_str());
|
||||
didinit = true;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#define KOMODO_DEFS_H
|
||||
#include "komodo_nk.h"
|
||||
|
||||
#define KOMODO_EARLYTXID_HEIGHT 200
|
||||
#define KOMODO_EARLYTXID_HEIGHT 100
|
||||
#define ASSETCHAINS_MINHEIGHT 128
|
||||
#define ASSETCHAINS_MAX_ERAS 7
|
||||
#define KOMODO_ELECTION_GAP 2000
|
||||
@@ -275,7 +275,7 @@ extern uint32_t ASSETCHAINS_ALGO, ASSETCHAINS_VERUSHASH,ASSETCHAINS_EQUIHASH,KOM
|
||||
extern int32_t KOMODO_MININGTHREADS,KOMODO_LONGESTCHAIN,ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,KOMODO_ON_DEMAND,KOMODO_PASSPORT_INITDONE,ASSETCHAINS_STAKED,KOMODO_NSPV;
|
||||
extern uint64_t ASSETCHAINS_COMMISSION, ASSETCHAINS_LASTERA,ASSETCHAINS_CBOPRET;
|
||||
extern bool VERUS_MINTBLOCKS;
|
||||
extern uint64_t ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_TIMELOCKGTE, ASSETCHAINS_NONCEMASK[],ASSETCHAINS_NK[2];
|
||||
extern uint64_t ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_TIMELOCKGTE, ASSETCHAINS_NONCEMASK[],ASSETCHAINS_NK[2];
|
||||
extern const char *ASSETCHAINS_ALGORITHMS[];
|
||||
extern int32_t VERUS_MIN_STAKEAGE;
|
||||
extern uint32_t ASSETCHAINS_VERUSHASH, ASSETCHAINS_VERUSHASHV1_1, ASSETCHAINS_NONCESHIFT[], ASSETCHAINS_HASHESPERROUND[];
|
||||
|
||||
@@ -652,7 +652,8 @@ const char *banned_txids[] =
|
||||
//"01d8c839463bda2f2f6400ede4611357913684927a767422a8560ead1b22557c",
|
||||
//"6e4980a9e1bd669f4df04732dc6f11b7773b6de88d1abcf89a6b9007d72ef9ac",
|
||||
//"6cc1d0495170bc0e11fd3925297623562e529ea1336b66ea61f8a1159041aed2",
|
||||
//"250875424cece9bcd98cb226b09da7671625633d6958589e3a462bad89ad87cc", // missed
|
||||
//"250875424cece9bcd98cb226b09da7671625633d6958589e3a462bad89ad87cc", // missed
|
||||
//"ea8659011de52f4dac42cda12326064b7b5013b8492f88e33159884ca299aa05", // missed
|
||||
};
|
||||
|
||||
int32_t komodo_checkvout(int32_t vout,int32_t k,int32_t indallvouts)
|
||||
|
||||
@@ -46,6 +46,7 @@ struct komodo_state KOMODO_STATES[34];
|
||||
int COINBASE_MATURITY = _COINBASE_MATURITY;//100;
|
||||
unsigned int WITNESS_CACHE_SIZE = _COINBASE_MATURITY+10;
|
||||
uint256 KOMODO_EARLYTXID;
|
||||
|
||||
int32_t KOMODO_MININGTHREADS = -1,IS_KOMODO_NOTARY,IS_STAKED_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND,STAKED_ERA,KOMODO_CONNECTING = -1,KOMODO_DEALERNODE,KOMODO_EXTRASATOSHI,ASSETCHAINS_FOUNDERS,ASSETCHAINS_CBMATURITY,KOMODO_NSPV;
|
||||
int32_t KOMODO_INSYNC,KOMODO_LASTMINED,prevKOMODO_LASTMINED,KOMODO_CCACTIVATE,JUMBLR_PAUSE = 1;
|
||||
std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY,ASSETCHAINS_SCRIPTPUB,NOTARY_ADDRESS,ASSETCHAINS_SELFIMPORT,ASSETCHAINS_CCLIB;
|
||||
@@ -74,7 +75,7 @@ uint64_t ASSETCHAINS_TIMELOCKGTE = _ASSETCHAINS_TIMELOCKOFF;
|
||||
uint64_t ASSETCHAINS_TIMEUNLOCKFROM = 0, ASSETCHAINS_TIMEUNLOCKTO = 0,ASSETCHAINS_CBOPRET=0;
|
||||
|
||||
uint64_t ASSETCHAINS_LASTERA = 1;
|
||||
uint64_t ASSETCHAINS_ENDSUBSIDY[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_HALVING[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_DECAY[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS],ASSETCHAINS_PEGSCCPARAMS[3];
|
||||
uint64_t ASSETCHAINS_ENDSUBSIDY[ASSETCHAINS_MAX_ERAS+1],ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS+1],ASSETCHAINS_HALVING[ASSETCHAINS_MAX_ERAS+1],ASSETCHAINS_DECAY[ASSETCHAINS_MAX_ERAS+1],ASSETCHAINS_NOTARY_PAY[ASSETCHAINS_MAX_ERAS+1],ASSETCHAINS_PEGSCCPARAMS[3];
|
||||
uint8_t ASSETCHAINS_CCDISABLES[256];
|
||||
std::vector<std::string> ASSETCHAINS_PRICES,ASSETCHAINS_STOCKS;
|
||||
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
|
||||
// todo:
|
||||
|
||||
// myprivkey, scrub all destination buffers
|
||||
// oversized tx
|
||||
|
||||
// headers "sync" make sure it connects to prior blocks to notarization. use getinfo hdrht to get missing hdrs
|
||||
|
||||
// interest calculations are currently just using what is returned, it should calculate it from scratch
|
||||
|
||||
// CC signing
|
||||
// make sure to sanity check all vector lengths on receipt
|
||||
// make sure no files are updated (this is to allow nSPV=1 and later nSPV=0 without affecting database)
|
||||
// bug: under load, fullnode was returning all 0 nServices
|
||||
@@ -28,34 +29,7 @@
|
||||
#ifndef KOMODO_NSPV_H
|
||||
#define KOMODO_NSPV_H
|
||||
|
||||
#define NSPV_POLLITERS 15
|
||||
#define NSPV_POLLMICROS 100000
|
||||
#define NSPV_MAXVINS 64
|
||||
#define NSPV_AUTOLOGOUT 777
|
||||
#define NSPV_BRANCHID 0x76b809bb
|
||||
|
||||
// nSPV defines and struct definitions with serialization and purge functions
|
||||
|
||||
#define NSPV_INFO 0x00
|
||||
#define NSPV_INFORESP 0x01
|
||||
#define NSPV_UTXOS 0x02
|
||||
#define NSPV_UTXOSRESP 0x03
|
||||
#define NSPV_NTZS 0x04
|
||||
#define NSPV_NTZSRESP 0x05
|
||||
#define NSPV_NTZSPROOF 0x06
|
||||
#define NSPV_NTZSPROOFRESP 0x07
|
||||
#define NSPV_TXPROOF 0x08
|
||||
#define NSPV_TXPROOFRESP 0x09
|
||||
#define NSPV_SPENTINFO 0x0a
|
||||
#define NSPV_SPENTINFORESP 0x0b
|
||||
#define NSPV_BROADCAST 0x0c
|
||||
#define NSPV_BROADCASTRESP 0x0d
|
||||
|
||||
int32_t NSPV_gettransaction(int32_t skipvalidation,int32_t vout,uint256 txid,int32_t height,CTransaction &tx,int64_t extradata,uint32_t tiptime,int64_t &rewardsum);
|
||||
extern uint256 SIG_TXHASH;
|
||||
uint32_t NSPV_blocktime(int32_t hdrheight);
|
||||
|
||||
int32_t iguana_rwbuf(int32_t rwflag,uint8_t *serialized,uint16_t len,uint8_t *buf)
|
||||
int32_t iguana_rwbuf(int32_t rwflag,uint8_t *serialized,int32_t len,uint8_t *buf)
|
||||
{
|
||||
if ( rwflag != 0 )
|
||||
memcpy(serialized,buf,len);
|
||||
@@ -63,18 +37,6 @@ int32_t iguana_rwbuf(int32_t rwflag,uint8_t *serialized,uint16_t len,uint8_t *bu
|
||||
return(len);
|
||||
}
|
||||
|
||||
struct NSPV_equihdr
|
||||
{
|
||||
int32_t nVersion;
|
||||
uint256 hashPrevBlock;
|
||||
uint256 hashMerkleRoot;
|
||||
uint256 hashFinalSaplingRoot;
|
||||
uint32_t nTime;
|
||||
uint32_t nBits;
|
||||
uint256 nNonce;
|
||||
uint8_t nSolution[1344];
|
||||
};
|
||||
|
||||
int32_t NSPV_rwequihdr(int32_t rwflag,uint8_t *serialized,struct NSPV_equihdr *ptr)
|
||||
{
|
||||
int32_t len = 0;
|
||||
@@ -104,26 +66,19 @@ int32_t iguana_rwequihdrvec(int32_t rwflag,uint8_t *serialized,uint16_t *vecsize
|
||||
return(len);
|
||||
}
|
||||
|
||||
int32_t iguana_rwuint8vec(int32_t rwflag,uint8_t *serialized,uint16_t *vecsizep,uint8_t **ptrp)
|
||||
int32_t iguana_rwuint8vec(int32_t rwflag,uint8_t *serialized,int32_t *biglenp,uint8_t **ptrp)
|
||||
{
|
||||
int32_t vsize,len = 0;
|
||||
len += iguana_rwnum(rwflag,&serialized[len],sizeof(*vecsizep),vecsizep);
|
||||
if ( (vsize= *vecsizep) != 0 )
|
||||
len += iguana_rwnum(rwflag,&serialized[len],sizeof(*biglenp),biglenp);
|
||||
if ( (vsize= *biglenp) > 0 && vsize < MAX_TX_SIZE_AFTER_SAPLING )
|
||||
{
|
||||
if ( *ptrp == 0 )
|
||||
*ptrp = (uint8_t *)calloc(1,vsize); // relies on uint16_t being "small" to prevent mem exhaustion
|
||||
*ptrp = (uint8_t *)calloc(1,vsize);
|
||||
len += iguana_rwbuf(rwflag,&serialized[len],vsize,*ptrp);
|
||||
}
|
||||
return(len);
|
||||
}
|
||||
|
||||
struct NSPV_utxoresp
|
||||
{
|
||||
uint256 txid;
|
||||
int64_t satoshis,extradata;
|
||||
int32_t vout,height;
|
||||
};
|
||||
|
||||
int32_t NSPV_rwutxoresp(int32_t rwflag,uint8_t *serialized,struct NSPV_utxoresp *ptr)
|
||||
{
|
||||
int32_t len = 0;
|
||||
@@ -135,15 +90,6 @@ int32_t NSPV_rwutxoresp(int32_t rwflag,uint8_t *serialized,struct NSPV_utxoresp
|
||||
return(len);
|
||||
}
|
||||
|
||||
struct NSPV_utxosresp
|
||||
{
|
||||
struct NSPV_utxoresp *utxos;
|
||||
char coinaddr[64];
|
||||
int64_t total,interest;
|
||||
int32_t nodeheight;
|
||||
uint16_t numutxos; uint8_t CCflag,pad8;
|
||||
};
|
||||
|
||||
int32_t NSPV_rwutxosresp(int32_t rwflag,uint8_t *serialized,struct NSPV_utxosresp *ptr) // check mempool
|
||||
{
|
||||
int32_t i,len = 0;
|
||||
@@ -183,11 +129,15 @@ void NSPV_utxosresp_purge(struct NSPV_utxosresp *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
struct NSPV_ntz
|
||||
void NSPV_utxosresp_copy(struct NSPV_utxosresp *dest,struct NSPV_utxosresp *ptr)
|
||||
{
|
||||
uint256 blockhash,txid,othertxid;
|
||||
int32_t height,txidheight;
|
||||
};
|
||||
*dest = *ptr;
|
||||
if ( ptr->utxos != 0 )
|
||||
{
|
||||
dest->utxos = (struct NSPV_utxoresp *)malloc(ptr->numutxos * sizeof(*ptr->utxos));
|
||||
memcpy(dest->utxos,ptr->utxos,ptr->numutxos * sizeof(*ptr->utxos));
|
||||
}
|
||||
}
|
||||
|
||||
int32_t NSPV_rwntz(int32_t rwflag,uint8_t *serialized,struct NSPV_ntz *ptr)
|
||||
{
|
||||
@@ -200,12 +150,6 @@ int32_t NSPV_rwntz(int32_t rwflag,uint8_t *serialized,struct NSPV_ntz *ptr)
|
||||
return(len);
|
||||
}
|
||||
|
||||
struct NSPV_ntzsresp
|
||||
{
|
||||
struct NSPV_ntz prevntz,nextntz;
|
||||
int32_t reqheight;
|
||||
};
|
||||
|
||||
int32_t NSPV_rwntzsresp(int32_t rwflag,uint8_t *serialized,struct NSPV_ntzsresp *ptr)
|
||||
{
|
||||
int32_t len = 0;
|
||||
@@ -226,14 +170,6 @@ void NSPV_ntzsresp_purge(struct NSPV_ntzsresp *ptr)
|
||||
memset(ptr,0,sizeof(*ptr));
|
||||
}
|
||||
|
||||
struct NSPV_inforesp
|
||||
{
|
||||
struct NSPV_ntz notarization;
|
||||
uint256 blockhash;
|
||||
int32_t height,hdrheight;
|
||||
struct NSPV_equihdr H;
|
||||
};
|
||||
|
||||
int32_t NSPV_rwinforesp(int32_t rwflag,uint8_t *serialized,struct NSPV_inforesp *ptr)
|
||||
{
|
||||
int32_t len = 0;
|
||||
@@ -252,15 +188,6 @@ void NSPV_inforesp_purge(struct NSPV_inforesp *ptr)
|
||||
memset(ptr,0,sizeof(*ptr));
|
||||
}
|
||||
|
||||
struct NSPV_txproof
|
||||
{
|
||||
uint256 txid;
|
||||
int64_t unspentvalue;
|
||||
int32_t height,vout,pad;
|
||||
uint16_t txlen,txprooflen;
|
||||
uint8_t *tx,*txproof;
|
||||
};
|
||||
|
||||
int32_t NSPV_rwtxproof(int32_t rwflag,uint8_t *serialized,struct NSPV_txproof *ptr)
|
||||
{
|
||||
int32_t len = 0;
|
||||
@@ -268,7 +195,6 @@ int32_t NSPV_rwtxproof(int32_t rwflag,uint8_t *serialized,struct NSPV_txproof *p
|
||||
len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->unspentvalue),&ptr->unspentvalue);
|
||||
len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->height),&ptr->height);
|
||||
len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->vout),&ptr->vout);
|
||||
len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->pad),&ptr->pad);
|
||||
len += iguana_rwuint8vec(rwflag,&serialized[len],&ptr->txlen,&ptr->tx);
|
||||
len += iguana_rwuint8vec(rwflag,&serialized[len],&ptr->txprooflen,&ptr->txproof);
|
||||
return(len);
|
||||
@@ -277,7 +203,7 @@ int32_t NSPV_rwtxproof(int32_t rwflag,uint8_t *serialized,struct NSPV_txproof *p
|
||||
void NSPV_txproof_copy(struct NSPV_txproof *dest,struct NSPV_txproof *ptr)
|
||||
{
|
||||
*dest = *ptr;
|
||||
if ( ptr->tx != 0 )
|
||||
if ( ptr->tx != 0 && ptr->txlen < MAX_TX_SIZE_AFTER_SAPLING )
|
||||
{
|
||||
dest->tx = (uint8_t *)malloc(ptr->txlen);
|
||||
memcpy(dest->tx,ptr->tx,ptr->txlen);
|
||||
@@ -301,13 +227,6 @@ void NSPV_txproof_purge(struct NSPV_txproof *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
struct NSPV_ntzproofshared
|
||||
{
|
||||
struct NSPV_equihdr *hdrs;
|
||||
int32_t prevht,nextht,pad32;
|
||||
uint16_t numhdrs,pad16;
|
||||
};
|
||||
|
||||
int32_t NSPV_rwntzproofshared(int32_t rwflag,uint8_t *serialized,struct NSPV_ntzproofshared *ptr)
|
||||
{
|
||||
int32_t len = 0;
|
||||
@@ -320,26 +239,17 @@ int32_t NSPV_rwntzproofshared(int32_t rwflag,uint8_t *serialized,struct NSPV_ntz
|
||||
return(len);
|
||||
}
|
||||
|
||||
struct NSPV_ntzsproofresp
|
||||
{
|
||||
struct NSPV_ntzproofshared common;
|
||||
uint256 prevtxid,nexttxid;
|
||||
int32_t pad32,prevtxidht,nexttxidht;
|
||||
uint16_t prevtxlen,nexttxlen;
|
||||
uint8_t *prevntz,*nextntz;
|
||||
};
|
||||
|
||||
int32_t NSPV_rwntzsproofresp(int32_t rwflag,uint8_t *serialized,struct NSPV_ntzsproofresp *ptr)
|
||||
{
|
||||
int32_t len = 0;
|
||||
len += NSPV_rwntzproofshared(rwflag,&serialized[len],&ptr->common);
|
||||
len += iguana_rwbignum(rwflag,&serialized[len],sizeof(ptr->prevtxid),(uint8_t *)&ptr->prevtxid);
|
||||
len += iguana_rwbignum(rwflag,&serialized[len],sizeof(ptr->nexttxid),(uint8_t *)&ptr->nexttxid);
|
||||
len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->pad32),&ptr->pad32);
|
||||
len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->prevtxidht),&ptr->prevtxidht);
|
||||
len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->nexttxidht),&ptr->nexttxidht);
|
||||
len += iguana_rwuint8vec(rwflag,&serialized[len],&ptr->prevtxlen,&ptr->prevntz);
|
||||
len += iguana_rwuint8vec(rwflag,&serialized[len],&ptr->nexttxlen,&ptr->nextntz);
|
||||
//fprintf(stderr,"retlen.%d\n",len);
|
||||
return(len);
|
||||
}
|
||||
|
||||
@@ -377,19 +287,6 @@ void NSPV_ntzsproofresp_purge(struct NSPV_ntzsproofresp *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
struct NSPV_MMRproof
|
||||
{
|
||||
struct NSPV_ntzproofshared common;
|
||||
// tbd
|
||||
};
|
||||
|
||||
struct NSPV_spentinfo
|
||||
{
|
||||
struct NSPV_txproof spent;
|
||||
uint256 txid;
|
||||
int32_t vout,spentvini;
|
||||
};
|
||||
|
||||
int32_t NSPV_rwspentinfo(int32_t rwflag,uint8_t *serialized,struct NSPV_spentinfo *ptr) // check mempool
|
||||
{
|
||||
int32_t len = 0;
|
||||
@@ -409,12 +306,6 @@ void NSPV_spentinfo_purge(struct NSPV_spentinfo *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
struct NSPV_broadcastresp
|
||||
{
|
||||
uint256 txid;
|
||||
int32_t retcode;
|
||||
};
|
||||
|
||||
int32_t NSPV_rwbroadcastresp(int32_t rwflag,uint8_t *serialized,struct NSPV_broadcastresp *ptr)
|
||||
{
|
||||
int32_t len = 0;
|
||||
@@ -458,11 +349,14 @@ uint256 NSPV_hdrhash(struct NSPV_equihdr *hdr)
|
||||
int32_t NSPV_txextract(CTransaction &tx,uint8_t *data,int32_t datalen)
|
||||
{
|
||||
std::vector<uint8_t> rawdata;
|
||||
rawdata.resize(datalen);
|
||||
memcpy(&rawdata[0],data,datalen);
|
||||
if ( DecodeHexTx(tx,HexStr(rawdata)) != 0 )
|
||||
return(0);
|
||||
else return(-1);
|
||||
if ( datalen < MAX_TX_SIZE_AFTER_SAPLING )
|
||||
{
|
||||
rawdata.resize(datalen);
|
||||
memcpy(&rawdata[0],data,datalen);
|
||||
if ( DecodeHexTx(tx,HexStr(rawdata)) != 0 )
|
||||
return(0);
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
bool NSPV_SignTx(CMutableTransaction &mtx,int32_t vini,int64_t utxovalue,const CScript scriptPubKey,uint32_t nTime);
|
||||
|
||||
144
src/komodo_nSPV_defs.h
Normal file
144
src/komodo_nSPV_defs.h
Normal file
@@ -0,0 +1,144 @@
|
||||
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
|
||||
* the top-level directory of this distribution for the individual copyright *
|
||||
* holder information and the developer policies on copyright and licensing. *
|
||||
* *
|
||||
* Unless otherwise agreed in a custom licensing agreement, no part of the *
|
||||
* SuperNET software, including this file may be copied, modified, propagated *
|
||||
* or distributed except according to the terms contained in the LICENSE file *
|
||||
* *
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef KOMODO_NSPV_DEFSH
|
||||
#define KOMODO_NSPV_DEFSH
|
||||
|
||||
#define NSPV_POLLITERS 100
|
||||
#define NSPV_POLLMICROS 50000
|
||||
#define NSPV_MAXVINS 64
|
||||
#define NSPV_AUTOLOGOUT 777
|
||||
#define NSPV_BRANCHID 0x76b809bb
|
||||
|
||||
// nSPV defines and struct definitions with serialization and purge functions
|
||||
|
||||
#define NSPV_INFO 0x00
|
||||
#define NSPV_INFORESP 0x01
|
||||
#define NSPV_UTXOS 0x02
|
||||
#define NSPV_UTXOSRESP 0x03
|
||||
#define NSPV_NTZS 0x04
|
||||
#define NSPV_NTZSRESP 0x05
|
||||
#define NSPV_NTZSPROOF 0x06
|
||||
#define NSPV_NTZSPROOFRESP 0x07
|
||||
#define NSPV_TXPROOF 0x08
|
||||
#define NSPV_TXPROOFRESP 0x09
|
||||
#define NSPV_SPENTINFO 0x0a
|
||||
#define NSPV_SPENTINFORESP 0x0b
|
||||
#define NSPV_BROADCAST 0x0c
|
||||
#define NSPV_BROADCASTRESP 0x0d
|
||||
|
||||
int32_t NSPV_gettransaction(int32_t skipvalidation,int32_t vout,uint256 txid,int32_t height,CTransaction &tx,int64_t extradata,uint32_t tiptime,int64_t &rewardsum);
|
||||
UniValue NSPV_spend(char *srcaddr,char *destaddr,int64_t satoshis);
|
||||
extern uint256 SIG_TXHASH;
|
||||
uint32_t NSPV_blocktime(int32_t hdrheight);
|
||||
|
||||
struct NSPV_equihdr
|
||||
{
|
||||
int32_t nVersion;
|
||||
uint256 hashPrevBlock;
|
||||
uint256 hashMerkleRoot;
|
||||
uint256 hashFinalSaplingRoot;
|
||||
uint32_t nTime;
|
||||
uint32_t nBits;
|
||||
uint256 nNonce;
|
||||
uint8_t nSolution[1344];
|
||||
};
|
||||
|
||||
struct NSPV_utxoresp
|
||||
{
|
||||
uint256 txid;
|
||||
int64_t satoshis,extradata;
|
||||
int32_t vout,height;
|
||||
};
|
||||
|
||||
struct NSPV_utxosresp
|
||||
{
|
||||
struct NSPV_utxoresp *utxos;
|
||||
char coinaddr[64];
|
||||
int64_t total,interest;
|
||||
int32_t nodeheight;
|
||||
uint16_t numutxos; uint8_t CCflag,pad8;
|
||||
};
|
||||
|
||||
struct NSPV_ntz
|
||||
{
|
||||
uint256 blockhash,txid,othertxid;
|
||||
int32_t height,txidheight;
|
||||
};
|
||||
|
||||
struct NSPV_ntzsresp
|
||||
{
|
||||
struct NSPV_ntz prevntz,nextntz;
|
||||
int32_t reqheight;
|
||||
};
|
||||
|
||||
struct NSPV_inforesp
|
||||
{
|
||||
struct NSPV_ntz notarization;
|
||||
uint256 blockhash;
|
||||
int32_t height,hdrheight;
|
||||
struct NSPV_equihdr H;
|
||||
};
|
||||
|
||||
struct NSPV_txproof
|
||||
{
|
||||
uint256 txid;
|
||||
int64_t unspentvalue;
|
||||
int32_t height,vout,txlen,txprooflen;
|
||||
uint8_t *tx,*txproof;
|
||||
};
|
||||
|
||||
struct NSPV_ntzproofshared
|
||||
{
|
||||
struct NSPV_equihdr *hdrs;
|
||||
int32_t prevht,nextht,pad32;
|
||||
uint16_t numhdrs,pad16;
|
||||
};
|
||||
|
||||
struct NSPV_ntzsproofresp
|
||||
{
|
||||
struct NSPV_ntzproofshared common;
|
||||
uint256 prevtxid,nexttxid;
|
||||
int32_t prevtxidht,nexttxidht,prevtxlen,nexttxlen;
|
||||
uint8_t *prevntz,*nextntz;
|
||||
};
|
||||
|
||||
struct NSPV_MMRproof
|
||||
{
|
||||
struct NSPV_ntzproofshared common;
|
||||
// tbd
|
||||
};
|
||||
|
||||
struct NSPV_spentinfo
|
||||
{
|
||||
struct NSPV_txproof spent;
|
||||
uint256 txid;
|
||||
int32_t vout,spentvini;
|
||||
};
|
||||
|
||||
struct NSPV_broadcastresp
|
||||
{
|
||||
uint256 txid;
|
||||
int32_t retcode;
|
||||
};
|
||||
|
||||
struct NSPV_CCmtxinfo
|
||||
{
|
||||
struct NSPV_utxosresp U;
|
||||
struct NSPV_utxoresp used[NSPV_MAXVINS];
|
||||
};
|
||||
|
||||
#endif // KOMODO_NSPV_DEFSH
|
||||
@@ -126,6 +126,7 @@ int32_t NSPV_getinfo(struct NSPV_inforesp *ptr,int32_t reqheight)
|
||||
{
|
||||
ptr->height = pindex->GetHeight();
|
||||
ptr->blockhash = pindex->GetBlockHash();
|
||||
memset(&pair,0,sizeof(pair));
|
||||
if ( NSPV_getntzsresp(&pair,ptr->height-1) < 0 )
|
||||
return(-1);
|
||||
ptr->notarization = pair.prevntz;
|
||||
@@ -184,12 +185,11 @@ int32_t NSPV_getaddressutxos(struct NSPV_utxosresp *ptr,char *coinaddr,bool isCC
|
||||
return(0);
|
||||
}
|
||||
|
||||
uint8_t *NSPV_getrawtx(CTransaction &tx,uint256 &hashBlock,uint16_t *txlenp,uint256 txid)
|
||||
uint8_t *NSPV_getrawtx(CTransaction &tx,uint256 &hashBlock,int32_t *txlenp,uint256 txid)
|
||||
{
|
||||
uint8_t *rawtx = 0;
|
||||
*txlenp = 0;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
if (!GetTransaction(txid, tx, hashBlock, false))
|
||||
return(0);
|
||||
string strHex = EncodeHexTx(tx);
|
||||
@@ -209,7 +209,7 @@ int32_t NSPV_sendrawtransaction(struct NSPV_broadcastresp *ptr,uint8_t *data,int
|
||||
ptr->retcode = 0;
|
||||
if ( NSPV_txextract(tx,data,n) == 0 )
|
||||
{
|
||||
LOCK(cs_main);
|
||||
//LOCK(cs_main);
|
||||
ptr->txid = tx.GetHash();
|
||||
//fprintf(stderr,"try to addmempool transaction %s\n",ptr->txid.GetHex().c_str());
|
||||
if ( myAddtomempool(tx) != 0 )
|
||||
@@ -306,6 +306,7 @@ int32_t NSPV_getntzsproofresp(struct NSPV_ntzsproofresp *ptr,uint256 prevntztxid
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
//fprintf(stderr,"sizeof ptr %ld, common.%ld lens.%d %d\n",sizeof(*ptr),sizeof(ptr->common),ptr->prevtxlen,ptr->nexttxlen);
|
||||
return(sizeof(*ptr) + sizeof(*ptr->common.hdrs)*ptr->common.numhdrs - sizeof(ptr->common.hdrs) - sizeof(ptr->prevntz) - sizeof(ptr->nextntz) + ptr->prevtxlen + ptr->nexttxlen);
|
||||
}
|
||||
|
||||
@@ -426,9 +427,9 @@ void komodo_nSPVreq(CNode *pfrom,std::vector<uint8_t> request) // received a req
|
||||
iguana_rwbignum(0,&request[1],sizeof(prevntz),(uint8_t *)&prevntz);
|
||||
iguana_rwbignum(0,&request[1+sizeof(prevntz)],sizeof(nextntz),(uint8_t *)&nextntz);
|
||||
memset(&P,0,sizeof(P));
|
||||
//fprintf(stderr,"msg prev.%s next.%s\n",prevntz.GetHex().c_str(),nextntz.GetHex().c_str());
|
||||
if ( (slen= NSPV_getntzsproofresp(&P,prevntz,nextntz)) > 0 )
|
||||
{
|
||||
// fprintf(stderr,"slen.%d msg prev.%s next.%s\n",slen,prevntz.GetHex().c_str(),nextntz.GetHex().c_str());
|
||||
response.resize(1 + slen);
|
||||
response[0] = NSPV_NTZSPROOFRESP;
|
||||
if ( NSPV_rwntzsproofresp(1,&response[1],&P) == slen )
|
||||
@@ -437,7 +438,7 @@ void komodo_nSPVreq(CNode *pfrom,std::vector<uint8_t> request) // received a req
|
||||
pfrom->prevtimes[ind] = timestamp;
|
||||
}
|
||||
NSPV_ntzsproofresp_purge(&P);
|
||||
}
|
||||
} else fprintf(stderr,"err.%d\n",slen);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -495,14 +496,14 @@ void komodo_nSPVreq(CNode *pfrom,std::vector<uint8_t> request) // received a req
|
||||
{
|
||||
if ( timestamp > pfrom->prevtimes[ind] )
|
||||
{
|
||||
struct NSPV_broadcastresp B; uint16_t n,offset; uint256 txid;
|
||||
struct NSPV_broadcastresp B; uint32_t n,offset; uint256 txid;
|
||||
if ( len > 1+sizeof(txid)+sizeof(n) )
|
||||
{
|
||||
iguana_rwbignum(0,&request[1],sizeof(txid),(uint8_t *)&txid);
|
||||
iguana_rwnum(0,&request[1+sizeof(txid)],sizeof(n),&n);
|
||||
memset(&B,0,sizeof(B));
|
||||
offset = 1 + sizeof(txid) + sizeof(n);
|
||||
if ( request.size() == offset+n && (slen= NSPV_sendrawtransaction(&B,&request[offset],n)) > 0 )
|
||||
if ( n < MAX_TX_SIZE_AFTER_SAPLING && request.size() == offset+n && (slen= NSPV_sendrawtransaction(&B,&request[offset],n)) > 0 )
|
||||
{
|
||||
response.resize(1 + slen);
|
||||
response[0] = NSPV_BROADCASTRESP;
|
||||
|
||||
@@ -66,16 +66,32 @@ struct NSPV_ntzsresp *NSPV_ntzsresp_add(struct NSPV_ntzsresp *ptr)
|
||||
|
||||
struct NSPV_txproof *NSPV_txproof_find(uint256 txid)
|
||||
{
|
||||
int32_t i;
|
||||
int32_t i; struct NSPV_txproof *backup = 0;
|
||||
for (i=0; i<sizeof(NSPV_txproof_cache)/sizeof(*NSPV_txproof_cache); i++)
|
||||
if ( NSPV_txproof_cache[i].txid == txid )
|
||||
return(&NSPV_txproof_cache[i]);
|
||||
return(0);
|
||||
{
|
||||
if ( NSPV_txproof_cache[i].txprooflen != 0 )
|
||||
return(&NSPV_txproof_cache[i]);
|
||||
else backup = &NSPV_txproof_cache[i];
|
||||
}
|
||||
return(backup);
|
||||
}
|
||||
|
||||
struct NSPV_txproof *NSPV_txproof_add(struct NSPV_txproof *ptr)
|
||||
{
|
||||
int32_t i;
|
||||
for (i=0; i<sizeof(NSPV_txproof_cache)/sizeof(*NSPV_txproof_cache); i++)
|
||||
if ( NSPV_txproof_cache[i].txid == ptr->txid )
|
||||
{
|
||||
if ( NSPV_txproof_cache[i].txprooflen == 0 && ptr->txprooflen != 0 )
|
||||
{
|
||||
NSPV_txproof_purge(&NSPV_txproof_cache[i]);
|
||||
NSPV_txproof_copy(&NSPV_txproof_cache[i],ptr);
|
||||
return(&NSPV_txproof_cache[i]);
|
||||
}
|
||||
else if ( NSPV_txproof_cache[i].txprooflen != 0 || ptr->txprooflen == 0 )
|
||||
return(&NSPV_txproof_cache[i]);
|
||||
}
|
||||
for (i=0; i<sizeof(NSPV_txproof_cache)/sizeof(*NSPV_txproof_cache); i++)
|
||||
if ( NSPV_txproof_cache[i].txlen == 0 )
|
||||
break;
|
||||
@@ -191,7 +207,7 @@ CNode *NSPV_req(CNode *pnode,uint8_t *msg,int32_t len,uint64_t mask,int32_t ind)
|
||||
if ( pnode == 0 )
|
||||
{
|
||||
memset(pnodes,0,sizeof(pnodes));
|
||||
LOCK(cs_vNodes);
|
||||
//LOCK(cs_vNodes);
|
||||
n = 0;
|
||||
BOOST_FOREACH(CNode *ptr,vNodes)
|
||||
{
|
||||
@@ -431,6 +447,7 @@ UniValue NSPV_broadcast_json(struct NSPV_broadcastresp *ptr,uint256 txid)
|
||||
UniValue NSPV_login(char *wifstr)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ); char coinaddr[64]; uint8_t data[128]; int32_t len,valid = 0;
|
||||
NSPV_logout();
|
||||
len = bitcoin_base58decode(data,wifstr);
|
||||
if ( strlen(wifstr) < 64 && (len == 38 && data[len-5] == 1) || (len == 37 && data[len-5] != 1) )
|
||||
valid = 1;
|
||||
@@ -576,7 +593,7 @@ UniValue NSPV_txidhdrsproof(uint256 prevtxid,uint256 nexttxid)
|
||||
msg[len++] = NSPV_NTZSPROOF;
|
||||
len += iguana_rwbignum(1,&msg[len],sizeof(prevtxid),(uint8_t *)&prevtxid);
|
||||
len += iguana_rwbignum(1,&msg[len],sizeof(nexttxid),(uint8_t *)&nexttxid);
|
||||
//for (iter=0; iter<3; iter++);
|
||||
for (iter=0; iter<3; iter++);
|
||||
if ( NSPV_req(0,msg,len,NODE_NSPV,msg[0]>>1) != 0 )
|
||||
{
|
||||
for (i=0; i<NSPV_POLLITERS; i++)
|
||||
@@ -585,7 +602,7 @@ UniValue NSPV_txidhdrsproof(uint256 prevtxid,uint256 nexttxid)
|
||||
if ( NSPV_ntzsproofresult.prevtxid == prevtxid && NSPV_ntzsproofresult.nexttxid == nexttxid )
|
||||
return(NSPV_ntzsproof_json(&NSPV_ntzsproofresult));
|
||||
}
|
||||
} //else sleep(1);
|
||||
} else sleep(1);
|
||||
memset(&P,0,sizeof(P));
|
||||
return(NSPV_ntzsproof_json(&P));
|
||||
}
|
||||
@@ -654,7 +671,7 @@ UniValue NSPV_spentinfo(uint256 txid,int32_t vout)
|
||||
|
||||
UniValue NSPV_broadcast(char *hex)
|
||||
{
|
||||
uint8_t *msg,*data; uint256 txid; uint16_t n; int32_t i,iter,len = 0; struct NSPV_broadcastresp B;
|
||||
uint8_t *msg,*data; uint256 txid; int32_t i,n,iter,len = 0; struct NSPV_broadcastresp B;
|
||||
NSPV_broadcast_purge(&NSPV_broadcastresult);
|
||||
n = (int32_t)strlen(hex) >> 1;
|
||||
data = (uint8_t *)malloc(n);
|
||||
@@ -686,5 +703,4 @@ UniValue NSPV_broadcast(char *hex)
|
||||
return(NSPV_broadcast_json(&B,txid));
|
||||
}
|
||||
|
||||
|
||||
#endif // KOMODO_NSPVSUPERLITE_H
|
||||
|
||||
@@ -44,7 +44,7 @@ int32_t NSPV_validatehdrs(struct NSPV_ntzsproofresp *ptr)
|
||||
if ( blockhash != ptr->common.hdrs[i].hashPrevBlock )
|
||||
return(-i-13);
|
||||
}
|
||||
sleep(1);
|
||||
sleep(1); // need this to get past the once per second rate limiter per message
|
||||
if ( NSPV_txextract(tx,ptr->prevntz,ptr->prevtxlen) < 0 )
|
||||
return(-8);
|
||||
else if ( tx.GetHash() != ptr->prevtxid )
|
||||
@@ -61,6 +61,7 @@ int32_t NSPV_validatehdrs(struct NSPV_ntzsproofresp *ptr)
|
||||
int32_t NSPV_gettransaction(int32_t skipvalidation,int32_t vout,uint256 txid,int32_t height,CTransaction &tx,int64_t extradata,uint32_t tiptime,int64_t &rewardsum)
|
||||
{
|
||||
struct NSPV_txproof *ptr; int32_t i,offset,retval = 0; int64_t rewards = 0; uint32_t nLockTime; std::vector<uint8_t> proof;
|
||||
//fprintf(stderr,"NSPV_gettx %s/v%d ht.%d\n",txid.GetHex().c_str(),vout,height);
|
||||
if ( (ptr= NSPV_txproof_find(txid)) == 0 )
|
||||
{
|
||||
NSPV_txproof(vout,txid,height);
|
||||
@@ -73,8 +74,10 @@ int32_t NSPV_gettransaction(int32_t skipvalidation,int32_t vout,uint256 txid,int
|
||||
}
|
||||
else if ( NSPV_txextract(tx,ptr->tx,ptr->txlen) < 0 || ptr->txlen <= 0 )
|
||||
retval = -2000;
|
||||
else if ( skipvalidation == 0 && ptr->unspentvalue <= 0 )
|
||||
else if ( tx.GetHash() != txid )
|
||||
retval = -2001;
|
||||
else if ( skipvalidation == 0 && ptr->unspentvalue <= 0 )
|
||||
retval = -2002;
|
||||
else if ( ASSETCHAINS_SYMBOL[0] == 0 && extradata >= 0 && tiptime != 0 )
|
||||
{
|
||||
rewards = komodo_interestnew(height,tx.vout[vout].nValue,tx.nLockTime,tiptime);
|
||||
@@ -82,6 +85,9 @@ int32_t NSPV_gettransaction(int32_t skipvalidation,int32_t vout,uint256 txid,int
|
||||
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());
|
||||
|
||||
if ( skipvalidation == 0 )
|
||||
{
|
||||
@@ -117,7 +123,7 @@ int32_t NSPV_gettransaction(int32_t skipvalidation,int32_t vout,uint256 txid,int
|
||||
retval = -2003;
|
||||
}
|
||||
}
|
||||
} else retval = -2002;
|
||||
} else retval = -2005;
|
||||
} else retval = -2004;
|
||||
}
|
||||
return(retval);
|
||||
@@ -228,13 +234,6 @@ bool NSPV_SignTx(CMutableTransaction &mtx,int32_t vini,int64_t utxovalue,const C
|
||||
{
|
||||
CTransaction txNewConst(mtx); SignatureData sigdata; CBasicKeyStore keystore; int64_t branchid = NSPV_BRANCHID;
|
||||
keystore.AddKey(NSPV_key);
|
||||
if ( 0 )
|
||||
{
|
||||
int32_t i;
|
||||
for (i=0; i<scriptPubKey.size()+4; i++)
|
||||
fprintf(stderr,"%02x",((uint8_t *)&scriptPubKey)[i]);
|
||||
fprintf(stderr," scriptPubKey\n");
|
||||
}
|
||||
if ( nTime != 0 && nTime < KOMODO_SAPLING_ACTIVATION )
|
||||
{
|
||||
fprintf(stderr,"use legacy sig validation\n");
|
||||
@@ -243,9 +242,9 @@ bool NSPV_SignTx(CMutableTransaction &mtx,int32_t vini,int64_t utxovalue,const C
|
||||
if ( ProduceSignature(TransactionSignatureCreator(&keystore,&txNewConst,vini,utxovalue,SIGHASH_ALL),scriptPubKey,sigdata,branchid) != 0 )
|
||||
{
|
||||
UpdateTransaction(mtx,vini,sigdata);
|
||||
// fprintf(stderr,"SIG_TXHASH %s vini.%d %.8f\n",SIG_TXHASH.GetHex().c_str(),vini,(double)utxovalue/COIN);
|
||||
//fprintf(stderr,"SIG_TXHASH %s vini.%d %.8f\n",SIG_TXHASH.GetHex().c_str(),vini,(double)utxovalue/COIN);
|
||||
return(true);
|
||||
} // else fprintf(stderr,"sigerr SIG_TXHASH %s vini.%d %.8f\n",SIG_TXHASH.GetHex().c_str(),vini,(double)utxovalue/COIN);
|
||||
} //else fprintf(stderr,"sigerr SIG_TXHASH %s vini.%d %.8f\n",SIG_TXHASH.GetHex().c_str(),vini,(double)utxovalue/COIN);
|
||||
return(false);
|
||||
}
|
||||
|
||||
@@ -301,7 +300,7 @@ std::string NSPV_signtx(int64_t &rewardsum,int64_t &interestsum,UniValue &retcod
|
||||
|
||||
UniValue NSPV_spend(char *srcaddr,char *destaddr,int64_t satoshis) // what its all about!
|
||||
{
|
||||
UniValue result(UniValue::VOBJ),retcodes(UniValue::VARR); uint8_t rmd160[128]; int64_t txfee = 10000;
|
||||
UniValue result(UniValue::VOBJ),retcodes(UniValue::VARR); std::vector<uint8_t> data; CScript scriptPubKey; uint8_t *ptr,rmd160[128]; int32_t len; int64_t txfee = 10000;
|
||||
if ( NSPV_logintime == 0 || time(NULL) > NSPV_logintime+NSPV_AUTOLOGOUT )
|
||||
{
|
||||
result.push_back(Pair("result","error"));
|
||||
@@ -317,9 +316,25 @@ UniValue NSPV_spend(char *srcaddr,char *destaddr,int64_t satoshis) // what its a
|
||||
}
|
||||
else if ( bitcoin_base58decode(rmd160,destaddr) != 25 )
|
||||
{
|
||||
result.push_back(Pair("result","error"));
|
||||
result.push_back(Pair("error","invalid destaddr"));
|
||||
return(result);
|
||||
if ( (len= is_hexstr(destaddr,0)) > 0 )
|
||||
{
|
||||
len >>= 1;
|
||||
data.resize(len);
|
||||
decode_hex(&data[0],len,destaddr);
|
||||
scriptPubKey = CScript() << data << OP_CHECKCRYPTOCONDITION;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.push_back(Pair("result","error"));
|
||||
result.push_back(Pair("error","invalid destaddr"));
|
||||
return(result);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
data.resize(20);
|
||||
memcpy(&data[0],&rmd160[1],20);
|
||||
scriptPubKey = (CScript() << OP_DUP << OP_HASH160 << ParseHex(HexStr(data)) << OP_EQUALVERIFY << OP_CHECKSIG);
|
||||
}
|
||||
if ( NSPV_inforesult.height == 0 )
|
||||
{
|
||||
@@ -348,7 +363,7 @@ UniValue NSPV_spend(char *srcaddr,char *destaddr,int64_t satoshis) // what its a
|
||||
return(result);
|
||||
}
|
||||
printf("%s numutxos.%d balance %.8f\n",NSPV_utxosresult.coinaddr,NSPV_utxosresult.numutxos,(double)NSPV_utxosresult.total/COIN);
|
||||
std::vector<uint8_t> data; CScript opret; std::string hex; struct NSPV_utxoresp used[NSPV_MAXVINS]; CMutableTransaction mtx; CTransaction tx; int64_t rewardsum=0,interestsum=0;
|
||||
CScript opret; std::string hex; struct NSPV_utxoresp used[NSPV_MAXVINS]; CMutableTransaction mtx; CTransaction tx; int64_t rewardsum=0,interestsum=0;
|
||||
mtx.fOverwintered = true;
|
||||
mtx.nExpiryHeight = 0;
|
||||
mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID;
|
||||
@@ -356,12 +371,10 @@ UniValue NSPV_spend(char *srcaddr,char *destaddr,int64_t satoshis) // what its a
|
||||
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
||||
mtx.nLockTime = (uint32_t)time(NULL) - 777;
|
||||
memset(used,0,sizeof(used));
|
||||
data.resize(20);
|
||||
memcpy(&data[0],&rmd160[1],20);
|
||||
|
||||
if ( NSPV_addinputs(used,mtx,satoshis+txfee,64,NSPV_utxosresult.utxos,NSPV_utxosresult.numutxos) > 0 )
|
||||
{
|
||||
mtx.vout.push_back(CTxOut(satoshis,CScript() << OP_DUP << OP_HASH160 << ParseHex(HexStr(data)) << OP_EQUALVERIFY << OP_CHECKSIG));
|
||||
mtx.vout.push_back(CTxOut(satoshis,scriptPubKey));
|
||||
if ( NSPV_logintime == 0 || time(NULL) > NSPV_logintime+NSPV_AUTOLOGOUT )
|
||||
{
|
||||
result.push_back(Pair("result","error"));
|
||||
@@ -409,4 +422,56 @@ UniValue NSPV_spend(char *srcaddr,char *destaddr,int64_t satoshis) // what its a
|
||||
}
|
||||
}
|
||||
|
||||
int64_t NSPV_AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int32_t maxinputs,struct NSPV_CCmtxinfo *ptr)
|
||||
{
|
||||
char coinaddr[64]; int32_t CCflag = 0;
|
||||
if ( ptr != 0 )
|
||||
{
|
||||
mtx.fOverwintered = true;
|
||||
mtx.nExpiryHeight = 0;
|
||||
mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID;
|
||||
mtx.nVersion = SAPLING_TX_VERSION;
|
||||
Getscriptaddress(coinaddr,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG);
|
||||
if ( strcmp(ptr->U.coinaddr,coinaddr) != 0 )
|
||||
{
|
||||
NSPV_addressutxos(coinaddr,CCflag);
|
||||
NSPV_utxosresp_purge(&ptr->U);
|
||||
NSPV_utxosresp_copy(&ptr->U,&NSPV_utxosresult);
|
||||
}
|
||||
fprintf(stderr,"%s numutxos.%d\n",ptr->U.coinaddr,ptr->U.numutxos);
|
||||
memset(ptr->used,0,sizeof(ptr->used));
|
||||
return(NSPV_addinputs(ptr->used,mtx,total,maxinputs,ptr->U.utxos,ptr->U.numutxos));
|
||||
} else return(0);
|
||||
}
|
||||
|
||||
void NSPV_utxos2CCunspents(struct NSPV_utxosresp *ptr,std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &outputs)
|
||||
{
|
||||
CAddressUnspentKey key; CAddressUnspentValue value; int32_t i,type; uint160 hashBytes; std::string addrstr(ptr->coinaddr);
|
||||
if ( ptr->utxos != NULL && ptr->numutxos > 0 )
|
||||
{
|
||||
CBitcoinAddress address(addrstr);
|
||||
if ( address.GetIndexKey(hashBytes, type, ptr->CCflag) == 0 )
|
||||
{
|
||||
fprintf(stderr,"couldnt get indexkey\n");
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < ptr->numutxos; i ++)
|
||||
{
|
||||
key.type = type;
|
||||
key.hashBytes = hashBytes;
|
||||
key.txhash = ptr->utxos[i].txid;
|
||||
key.index = ptr->utxos[i].vout;
|
||||
value.satoshis = ptr->utxos[i].satoshis;
|
||||
value.blockHeight = ptr->utxos[i].height;
|
||||
outputs.push_back(std::make_pair(key, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NSPV_CCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &outputs,char *coinaddr,bool ccflag)
|
||||
{
|
||||
NSPV_addressutxos(coinaddr,ccflag);
|
||||
NSPV_utxos2CCunspents(&NSPV_utxosresult,outputs);
|
||||
}
|
||||
|
||||
#endif // KOMODO_NSPVWALLET_H
|
||||
|
||||
@@ -1761,10 +1761,10 @@ void komodo_args(char *argv0)
|
||||
ASSETCHAINS_PUBLIC = GetArg("-ac_public",0);
|
||||
ASSETCHAINS_PRIVATE = GetArg("-ac_private",0);
|
||||
KOMODO_SNAPSHOT_INTERVAL = GetArg("-ac_snapshot",0);
|
||||
Split(GetArg("-ac_nk",""), ASSETCHAINS_NK, 0);
|
||||
Split(GetArg("-ac_nk",""), sizeof(ASSETCHAINS_NK)/sizeof(*ASSETCHAINS_NK), ASSETCHAINS_NK, 0);
|
||||
|
||||
// -ac_ccactivateht=evalcode,height,evalcode,height,evalcode,height....
|
||||
Split(GetArg("-ac_ccactivateht",""), ccEnablesHeight, 0);
|
||||
Split(GetArg("-ac_ccactivateht",""), sizeof(ccEnablesHeight)/sizeof(*ccEnablesHeight), ccEnablesHeight, 0);
|
||||
// fill map with all eval codes and activation height of 0.
|
||||
for ( int i = 0; i < 256; i++ )
|
||||
mapHeightEvalActivate[i] = 0;
|
||||
@@ -1836,11 +1836,11 @@ void komodo_args(char *argv0)
|
||||
ASSETCHAINS_TIMEUNLOCKFROM = ASSETCHAINS_TIMEUNLOCKTO = 0;
|
||||
}
|
||||
|
||||
Split(GetArg("-ac_end",""), ASSETCHAINS_ENDSUBSIDY, 0);
|
||||
Split(GetArg("-ac_reward",""), ASSETCHAINS_REWARD, 0);
|
||||
Split(GetArg("-ac_halving",""), ASSETCHAINS_HALVING, 0);
|
||||
Split(GetArg("-ac_decay",""), ASSETCHAINS_DECAY, 0);
|
||||
Split(GetArg("-ac_notarypay",""), ASSETCHAINS_NOTARY_PAY, 0);
|
||||
Split(GetArg("-ac_end",""), sizeof(ASSETCHAINS_ENDSUBSIDY)/sizeof(*ASSETCHAINS_ENDSUBSIDY), ASSETCHAINS_ENDSUBSIDY, 0);
|
||||
Split(GetArg("-ac_reward",""), sizeof(ASSETCHAINS_REWARD)/sizeof(*ASSETCHAINS_REWARD), ASSETCHAINS_REWARD, 0);
|
||||
Split(GetArg("-ac_halving",""), sizeof(ASSETCHAINS_HALVING)/sizeof(*ASSETCHAINS_HALVING), ASSETCHAINS_HALVING, 0);
|
||||
Split(GetArg("-ac_decay",""), sizeof(ASSETCHAINS_DECAY)/sizeof(*ASSETCHAINS_DECAY), ASSETCHAINS_DECAY, 0);
|
||||
Split(GetArg("-ac_notarypay",""), sizeof(ASSETCHAINS_NOTARY_PAY)/sizeof(*ASSETCHAINS_NOTARY_PAY), ASSETCHAINS_NOTARY_PAY, 0);
|
||||
|
||||
for ( int i = 0; i < ASSETCHAINS_MAX_ERAS; i++ )
|
||||
{
|
||||
@@ -1908,13 +1908,15 @@ void komodo_args(char *argv0)
|
||||
}
|
||||
if ( ASSETCHAINS_CC != 0 )
|
||||
{
|
||||
uint8_t prevCCi = 0;
|
||||
ASSETCHAINS_CCLIB = GetArg("-ac_cclib","");
|
||||
Split(GetArg("-ac_ccenable",""), ccenables, 0);
|
||||
Split(GetArg("-ac_ccenable",""), sizeof(ccenables)/sizeof(*ccenables), ccenables, 0);
|
||||
for (i=nonz=0; i<0x100; i++)
|
||||
{
|
||||
if ( ccenables[i] != 0 )
|
||||
if ( ccenables[i] != prevCCi && ccenables[i] != 0 )
|
||||
{
|
||||
nonz++;
|
||||
prevCCi = ccenables[i];
|
||||
fprintf(stderr,"%d ",(uint8_t)(ccenables[i] & 0xff));
|
||||
}
|
||||
}
|
||||
@@ -1926,11 +1928,12 @@ void komodo_args(char *argv0)
|
||||
ASSETCHAINS_CCDISABLES[i] = 1;
|
||||
SETBIT(disablebits,i);
|
||||
}
|
||||
for (i=0; i<256; i++)
|
||||
for (i=0; i<nonz; i++)
|
||||
{
|
||||
CLEARBIT(disablebits,(ccenables[i] & 0xff));
|
||||
ASSETCHAINS_CCDISABLES[ccenables[i] & 0xff] = 0;
|
||||
}
|
||||
CLEARBIT(disablebits,0);
|
||||
}
|
||||
/*if ( ASSETCHAINS_CCLIB.size() > 0 )
|
||||
{
|
||||
@@ -1973,7 +1976,7 @@ void komodo_args(char *argv0)
|
||||
}
|
||||
else if ( ASSETCHAINS_SELFIMPORT == "PEGSCC")
|
||||
{
|
||||
Split(GetArg("-ac_pegsccparams",""), ASSETCHAINS_PEGSCCPARAMS, 0);
|
||||
Split(GetArg("-ac_pegsccparams",""), sizeof(ASSETCHAINS_PEGSCCPARAMS)/sizeof(*ASSETCHAINS_PEGSCCPARAMS), ASSETCHAINS_PEGSCCPARAMS, 0);
|
||||
if (ASSETCHAINS_ENDSUBSIDY[0]!=1 || ASSETCHAINS_COMMISSION!=0)
|
||||
{
|
||||
fprintf(stderr,"when using import for pegsCC these must be set: -ac_end=1 -ac_perc=0\n");
|
||||
|
||||
66
src/main.cpp
66
src/main.cpp
@@ -147,7 +147,7 @@ namespace {
|
||||
|
||||
struct CBlockIndexWorkComparator
|
||||
{
|
||||
bool operator()(const CBlockIndex *pa, const CBlockIndex *pb) const {
|
||||
bool operator()(CBlockIndex *pa, const CBlockIndex *pb) const {
|
||||
// First sort by most total work, ...
|
||||
|
||||
if (ASSETCHAINS_LWMAPOS) {
|
||||
@@ -1780,7 +1780,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
//fprintf(stderr,"already in mempool\n");
|
||||
return state.Invalid(false, REJECT_DUPLICATE, "already in mempool");
|
||||
}
|
||||
|
||||
//fprintf(stderr,"addmempool 0\n");
|
||||
// Node operator can choose to reject tx by number of transparent inputs
|
||||
static_assert(std::numeric_limits<size_t>::max() >= std::numeric_limits<int64_t>::max(), "size_t too small");
|
||||
size_t limit = (size_t) GetArg("-mempooltxinputlimit", 0);
|
||||
@@ -1794,6 +1794,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//fprintf(stderr,"addmempool 1\n");
|
||||
|
||||
auto verifier = libzcash::ProofVerifier::Strict();
|
||||
if ( ASSETCHAINS_SYMBOL[0] == 0 && komodo_validate_interest(tx,chainActive.LastTip()->GetHeight()+1,chainActive.LastTip()->GetMedianTimePast() + 777,0) < 0 )
|
||||
@@ -1811,7 +1812,8 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
{
|
||||
return error("AcceptToMemoryPool: ContextualCheckTransaction failed");
|
||||
}
|
||||
// Coinbase is only valid in a block, not as a loose transaction
|
||||
//fprintf(stderr,"addmempool 2\n");
|
||||
// Coinbase is only valid in a block, not as a loose transaction
|
||||
if (tx.IsCoinBase())
|
||||
{
|
||||
fprintf(stderr,"AcceptToMemoryPool coinbase as individual tx\n");
|
||||
@@ -1833,6 +1835,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
//fprintf(stderr,"AcceptToMemoryPool reject non-final\n");
|
||||
return state.DoS(0, false, REJECT_NONSTANDARD, "non-final");
|
||||
}
|
||||
//fprintf(stderr,"addmempool 3\n");
|
||||
|
||||
// Check for conflicts with in-memory transactions
|
||||
if (!fSkipExpiry)
|
||||
@@ -1861,6 +1864,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
}
|
||||
}
|
||||
}
|
||||
//fprintf(stderr,"addmempool 4\n");
|
||||
|
||||
{
|
||||
CCoinsView dummy;
|
||||
@@ -1960,6 +1964,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
}
|
||||
}
|
||||
}
|
||||
//fprintf(stderr,"addmempool 5\n");
|
||||
|
||||
// Grab the branch ID we expect this transaction to commit to. We don't
|
||||
// yet know if it does, but if the entry gets added to the mempool, then
|
||||
@@ -2022,6 +2027,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
LogPrint("mempool", errmsg.c_str());
|
||||
return state.Error("AcceptToMemoryPool: " + errmsg);
|
||||
}
|
||||
//fprintf(stderr,"addmempool 6\n");
|
||||
|
||||
// Check against previous transactions
|
||||
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
|
||||
@@ -2047,6 +2053,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
flag = 1;
|
||||
KOMODO_CONNECTING = (1<<30) + (int32_t)chainActive.LastTip()->GetHeight() + 1;
|
||||
}
|
||||
//fprintf(stderr,"addmempool 7\n");
|
||||
if (!fSkipExpiry && !ContextualCheckInputs(tx, state, view, true, MANDATORY_SCRIPT_VERIFY_FLAGS, true, txdata, Params().GetConsensus(), consensusBranchId))
|
||||
{
|
||||
if ( flag != 0 )
|
||||
@@ -2220,6 +2227,18 @@ bool myAddtomempool(CTransaction &tx, CValidationState *pstate, bool fSkipExpiry
|
||||
bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock)
|
||||
{
|
||||
memset(&hashBlock,0,sizeof(hashBlock));
|
||||
if ( KOMODO_NSPV != 0 )
|
||||
{
|
||||
int64_t rewardsum = 0; int32_t i,retval,txheight = 0,vout = 0;
|
||||
for (i=0; i<NSPV_U.U.numutxos; i++)
|
||||
if ( NSPV_U.U.utxos[i].txid == hash )
|
||||
{
|
||||
txheight = NSPV_U.U.utxos[i].height;
|
||||
break;
|
||||
}
|
||||
retval = NSPV_gettransaction(1,vout,hash,txheight,txOut,0,0,rewardsum);
|
||||
return(retval != -1);
|
||||
}
|
||||
// need a GetTransaction without lock so the validation code for assets can run without deadlock
|
||||
{
|
||||
//fprintf(stderr,"check mempool %s\n",hash.GetHex().c_str());
|
||||
@@ -2413,7 +2432,7 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex,bool checkPOW)
|
||||
|
||||
//uint64_t komodo_moneysupply(int32_t height);
|
||||
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
||||
extern uint64_t ASSETCHAINS_ENDSUBSIDY[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS], ASSETCHAINS_HALVING[ASSETCHAINS_MAX_ERAS];
|
||||
extern uint64_t ASSETCHAINS_ENDSUBSIDY[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_REWARD[ASSETCHAINS_MAX_ERAS+1], ASSETCHAINS_HALVING[ASSETCHAINS_MAX_ERAS+1];
|
||||
extern uint32_t ASSETCHAINS_MAGIC;
|
||||
extern uint64_t ASSETCHAINS_LINEAR,ASSETCHAINS_COMMISSION,ASSETCHAINS_SUPPLY;
|
||||
extern uint8_t ASSETCHAINS_PUBLIC,ASSETCHAINS_PRIVATE;
|
||||
@@ -7060,6 +7079,7 @@ void static ProcessGetData(CNode* pfrom)
|
||||
}
|
||||
}
|
||||
|
||||
#include "komodo_nSPV_defs.h"
|
||||
#include "komodo_nSPV.h" // shared defines, structs, serdes, purge functions
|
||||
#include "komodo_nSPV_fullnode.h" // nSPV fullnode handling of the getnSPV request messages
|
||||
#include "komodo_nSPV_superlite.h" // nSPV superlite client, issuing requests and handling nSPV responses
|
||||
@@ -8459,21 +8479,31 @@ extern "C" const char* getDataDir()
|
||||
CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Params& consensusParams, int nHeight)
|
||||
{
|
||||
CMutableTransaction mtx;
|
||||
|
||||
bool isOverwintered = NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_OVERWINTER);
|
||||
if (isOverwintered) {
|
||||
if ( KOMODO_NSPV != 0 )
|
||||
{
|
||||
mtx.fOverwintered = true;
|
||||
mtx.nExpiryHeight = nHeight + expiryDelta;
|
||||
|
||||
if (NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_SAPLING)) {
|
||||
mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID;
|
||||
mtx.nVersion = SAPLING_TX_VERSION;
|
||||
} else {
|
||||
mtx.nVersionGroupId = OVERWINTER_VERSION_GROUP_ID;
|
||||
mtx.nVersion = OVERWINTER_TX_VERSION;
|
||||
mtx.nExpiryHeight = std::min(
|
||||
mtx.nExpiryHeight,
|
||||
static_cast<uint32_t>(consensusParams.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight - 1));
|
||||
mtx.nExpiryHeight = 0;
|
||||
mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID;
|
||||
mtx.nVersion = SAPLING_TX_VERSION;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isOverwintered = NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_OVERWINTER);
|
||||
if (isOverwintered)
|
||||
{
|
||||
mtx.fOverwintered = true;
|
||||
mtx.nExpiryHeight = nHeight + expiryDelta;
|
||||
if (NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_SAPLING))
|
||||
{
|
||||
mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID;
|
||||
mtx.nVersion = SAPLING_TX_VERSION;
|
||||
}
|
||||
else
|
||||
{
|
||||
mtx.nVersionGroupId = OVERWINTER_VERSION_GROUP_ID;
|
||||
mtx.nVersion = OVERWINTER_TX_VERSION;
|
||||
mtx.nExpiryHeight = std::min(mtx.nExpiryHeight,static_cast<uint32_t>(consensusParams.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
return mtx;
|
||||
|
||||
@@ -665,7 +665,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
||||
if ( ASSETCHAINS_SCRIPTPUB.size() > 1 )
|
||||
{
|
||||
static bool didinit = false;
|
||||
if ( !didinit && nHeight > 100 && KOMODO_EARLYTXID != zeroid && komodo_appendACscriptpub() )
|
||||
if ( !didinit && nHeight > KOMODO_EARLYTXID_HEIGHT && KOMODO_EARLYTXID != zeroid && komodo_appendACscriptpub() )
|
||||
{
|
||||
fprintf(stderr, "appended ccopreturn to ASSETCHAINS_SCRIPTPUB.%s\n", ASSETCHAINS_SCRIPTPUB.c_str());
|
||||
didinit = true;
|
||||
@@ -1758,7 +1758,7 @@ void static BitcoinMiner()
|
||||
if ( (Mining_height >= 235300 && Mining_height < 236000) || (Mining_height % KOMODO_ELECTION_GAP) > 64 || (Mining_height % KOMODO_ELECTION_GAP) == 0 || Mining_height > 1000000 )
|
||||
{
|
||||
int32_t dispflag = 0;
|
||||
if ( notaryid <= 3 || notaryid == 32 || (notaryid >= 43 && notaryid <= 45) &¬aryid == 51 || notaryid == 52 || notaryid == 56 || notaryid == 57 )
|
||||
if ( notaryid <= 3 || notaryid == 32 || (notaryid >= 43 && notaryid <= 45) || notaryid == 51 || notaryid == 52 || notaryid == 56 || notaryid == 57 )
|
||||
dispflag = 1;
|
||||
komodo_eligiblenotary(pubkeys,mids,blocktimes,&nonzpkeys,pindexPrev->GetHeight());
|
||||
if ( nonzpkeys > 0 )
|
||||
@@ -1781,8 +1781,12 @@ void static BitcoinMiner()
|
||||
if ( dispflag != 0 )
|
||||
{
|
||||
if ( mids[j] >= 0 )
|
||||
fprintf(stderr,"%d ",mids[j]);
|
||||
else fprintf(stderr,"GPU ");
|
||||
{
|
||||
if ( mids[j] == notaryid )
|
||||
fprintf(stderr,"--<%d>-- ",mids[j]);
|
||||
else
|
||||
fprintf(stderr,"%d ",mids[j]);
|
||||
} else fprintf(stderr,"GPU ");
|
||||
}
|
||||
if ( mids[j] == -1 )
|
||||
gpucount++;
|
||||
|
||||
@@ -430,7 +430,7 @@ void CheckBurnTxSource(uint256 burntxid, UniValue &info) {
|
||||
CTransaction burnTx;
|
||||
uint256 blockHash;
|
||||
|
||||
if (!GetTransaction(burntxid, burnTx, blockHash, true))
|
||||
if (!myGetTransaction(burntxid, burnTx, blockHash))
|
||||
throw std::runtime_error("Cannot find burn transaction");
|
||||
|
||||
if (blockHash.IsNull())
|
||||
@@ -854,6 +854,7 @@ UniValue importgatewayinfo(const UniValue& params, bool fHelp)
|
||||
return(ImportGatewayInfo(txid));
|
||||
}
|
||||
|
||||
|
||||
UniValue importgatewaybind(const UniValue& params, bool fHelp)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ);
|
||||
@@ -866,7 +867,7 @@ UniValue importgatewaybind(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 8)
|
||||
throw runtime_error("use \'importgatewaybind coin orcletxid M N pubkeys pubtype p2shtype wiftype [taddr]\' to bind an import gateway\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 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(CC_REQUIREMENTS_MSG);
|
||||
CCerror = "";
|
||||
coin = params[0].get_str();
|
||||
oracletxid = Parseuint256(params[1].get_str().c_str());
|
||||
@@ -919,7 +920,7 @@ UniValue importgatewaydeposit(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 9)
|
||||
throw runtime_error("use \'importgatewaydeposit bindtxid height coin burntxid nvout rawburntx rawproof destpub amount\' to import deposited coins\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 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(CC_REQUIREMENTS_MSG);
|
||||
CCerror = "";
|
||||
bindtxid = Parseuint256(params[0].get_str().c_str());
|
||||
height = atoi(params[1].get_str().c_str());
|
||||
@@ -962,7 +963,7 @@ UniValue importgatewaywithdraw(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 4)
|
||||
throw runtime_error("use \'importgatewaywithdraw bindtxid coin withdrawpub amount\' to burn imported coins and withdraw them on external chain\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 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(CC_REQUIREMENTS_MSG);
|
||||
CCerror = "";
|
||||
bindtxid = Parseuint256(params[0].get_str().c_str());
|
||||
coin = params[1].get_str();
|
||||
@@ -997,7 +998,7 @@ UniValue importgatewaypartialsign(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("importgatewayspartialsign txidaddr refcoin hex\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 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(CC_REQUIREMENTS_MSG);
|
||||
txid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
coin = params[1].get_str();
|
||||
parthex = params[2].get_str();
|
||||
@@ -1020,7 +1021,7 @@ UniValue importgatewaycompletesigning(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("importgatewaycompletesigning withdrawtxid coin hex\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 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(CC_REQUIREMENTS_MSG);
|
||||
withdrawtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
coin = params[1].get_str();
|
||||
txhex = params[2].get_str();
|
||||
@@ -1040,7 +1041,7 @@ UniValue importgatewaymarkdone(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("importgatewaymarkdone completesigningtx coin\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 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(CC_REQUIREMENTS_MSG);
|
||||
completetxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
coin = params[1].get_str();
|
||||
hex = ImportGatewayMarkDone(0,completetxid,coin);
|
||||
@@ -1059,7 +1060,7 @@ UniValue importgatewaypendingdeposits(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("importgatewaypendingdeposits bindtxid coin\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 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(CC_REQUIREMENTS_MSG);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
coin = params[1].get_str();
|
||||
return(ImportGatewayPendingDeposits(bindtxid,coin));
|
||||
@@ -1071,7 +1072,7 @@ UniValue importgatewaypendingwithdraws(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("importgatewaypendingwithdraws bindtxid coin\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 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(CC_REQUIREMENTS_MSG);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
coin = params[1].get_str();
|
||||
return(ImportGatewayPendingWithdraws(bindtxid,coin));
|
||||
@@ -1083,7 +1084,7 @@ UniValue importgatewayprocessed(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("importgatewayprocessed bindtxid coin\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 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(CC_REQUIREMENTS_MSG);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
coin = params[1].get_str();
|
||||
return(ImportGatewayProcessedWithdraws(bindtxid,coin));
|
||||
@@ -1096,7 +1097,7 @@ UniValue importgatewayexternaladdress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2)
|
||||
throw runtime_error("importgatewayexternaladdress bindtxid pubkey\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 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(CC_REQUIREMENTS_MSG);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
pubkey = ParseHex(params[1].get_str().c_str());
|
||||
return(ImportGatewayExternalAddress(bindtxid,pubkey));
|
||||
@@ -1109,7 +1110,7 @@ UniValue importgatewaydumpprivkey(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2)
|
||||
throw runtime_error("importgatewaydumpprivkey bindtxid address\n");
|
||||
if ( ensure_CCrequirements(EVAL_IMPORTGATEWAY) < 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(CC_REQUIREMENTS_MSG);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
std::string strAddress = params[1].get_str();
|
||||
CTxDestination dest = DecodeDestination(strAddress);
|
||||
@@ -1156,7 +1157,7 @@ UniValue getNotarisationsForBlock(const UniValue& params, bool fHelp)
|
||||
{
|
||||
UniValue item(UniValue::VOBJ); UniValue notaryarr(UniValue::VARR); std::vector<int8_t> NotarisationNotaries;
|
||||
uint256 hash; CTransaction tx;
|
||||
if ( GetTransaction(n.first,tx,hash,false) )
|
||||
if ( myGetTransaction(n.first,tx,hash) )
|
||||
{
|
||||
if ( is_STAKED(n.second.symbol) != 0 )
|
||||
{
|
||||
|
||||
@@ -222,17 +222,17 @@ UniValue getinfo(const UniValue& params, bool fHelp)
|
||||
+ HelpExampleCli("getinfo", "")
|
||||
+ HelpExampleRpc("getinfo", "")
|
||||
);
|
||||
//#ifdef ENABLE_WALLET
|
||||
// LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL);
|
||||
//#else
|
||||
//#ifdef ENABLE_WALLET
|
||||
// LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL);
|
||||
//#else
|
||||
LOCK(cs_main);
|
||||
//#endif
|
||||
|
||||
//#endif
|
||||
|
||||
proxyType proxy;
|
||||
GetProxy(NET_IPV4, proxy);
|
||||
notarized_height = komodo_notarized_height(&prevMoMheight,¬arized_hash,¬arized_desttxid);
|
||||
//fprintf(stderr,"after notarized_height %u\n",(uint32_t)time(NULL));
|
||||
|
||||
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("version", CLIENT_VERSION));
|
||||
obj.push_back(Pair("protocolversion", PROTOCOL_VERSION));
|
||||
@@ -243,50 +243,54 @@ UniValue getinfo(const UniValue& params, bool fHelp)
|
||||
obj.push_back(Pair("prevMoMheight", prevMoMheight));
|
||||
obj.push_back(Pair("notarizedhash", notarized_hash.ToString()));
|
||||
obj.push_back(Pair("notarizedtxid", notarized_desttxid.ToString()));
|
||||
txid_height = notarizedtxid_height(ASSETCHAINS_SYMBOL[0] != 0 ? (char *)"KMD" : (char *)"BTC",(char *)notarized_desttxid.ToString().c_str(),&kmdnotarized_height);
|
||||
if ( txid_height > 0 )
|
||||
obj.push_back(Pair("notarizedtxid_height", txid_height));
|
||||
else obj.push_back(Pair("notarizedtxid_height", "mempool"));
|
||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||
obj.push_back(Pair("KMDnotarized_height", kmdnotarized_height));
|
||||
obj.push_back(Pair("notarized_confirms", txid_height < kmdnotarized_height ? (kmdnotarized_height - txid_height + 1) : 0));
|
||||
//fprintf(stderr,"after notarized_confirms %u\n",(uint32_t)time(NULL));
|
||||
if ( KOMODO_NSPV == 0 )
|
||||
{
|
||||
txid_height = notarizedtxid_height(ASSETCHAINS_SYMBOL[0] != 0 ? (char *)"KMD" : (char *)"BTC",(char *)notarized_desttxid.ToString().c_str(),&kmdnotarized_height);
|
||||
if ( txid_height > 0 )
|
||||
obj.push_back(Pair("notarizedtxid_height", txid_height));
|
||||
else obj.push_back(Pair("notarizedtxid_height", "mempool"));
|
||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||
obj.push_back(Pair("KMDnotarized_height", kmdnotarized_height));
|
||||
obj.push_back(Pair("notarized_confirms", txid_height < kmdnotarized_height ? (kmdnotarized_height - txid_height + 1) : 0));
|
||||
//fprintf(stderr,"after notarized_confirms %u\n",(uint32_t)time(NULL));
|
||||
#ifdef ENABLE_WALLET
|
||||
if (pwalletMain) {
|
||||
obj.push_back(Pair("walletversion", pwalletMain->GetVersion()));
|
||||
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
||||
{
|
||||
obj.push_back(Pair("interest", ValueFromAmount(KOMODO_INTERESTSUM)));
|
||||
obj.push_back(Pair("balance", ValueFromAmount(KOMODO_WALLETBALANCE))); //pwalletMain->GetBalance()
|
||||
if (pwalletMain) {
|
||||
obj.push_back(Pair("walletversion", pwalletMain->GetVersion()));
|
||||
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
||||
{
|
||||
obj.push_back(Pair("interest", ValueFromAmount(KOMODO_INTERESTSUM)));
|
||||
obj.push_back(Pair("balance", ValueFromAmount(KOMODO_WALLETBALANCE))); //pwalletMain->GetBalance()
|
||||
}
|
||||
else
|
||||
{
|
||||
obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance()))); //
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance()))); //
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//fprintf(stderr,"after wallet %u\n",(uint32_t)time(NULL));
|
||||
obj.push_back(Pair("blocks", (int)chainActive.Height()));
|
||||
if ( (longestchain= KOMODO_LONGESTCHAIN) != 0 && chainActive.Height() > longestchain )
|
||||
longestchain = chainActive.Height();
|
||||
//fprintf(stderr,"after longestchain %u\n",(uint32_t)time(NULL));
|
||||
obj.push_back(Pair("longestchain", longestchain));
|
||||
//fprintf(stderr,"after wallet %u\n",(uint32_t)time(NULL));
|
||||
obj.push_back(Pair("blocks", (int)chainActive.Height()));
|
||||
if ( (longestchain= KOMODO_LONGESTCHAIN) != 0 && chainActive.Height() > longestchain )
|
||||
longestchain = chainActive.Height();
|
||||
//fprintf(stderr,"after longestchain %u\n",(uint32_t)time(NULL));
|
||||
obj.push_back(Pair("longestchain", longestchain));
|
||||
if ( chainActive.LastTip() != 0 )
|
||||
obj.push_back(Pair("tiptime", (int)chainActive.LastTip()->nTime));
|
||||
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
|
||||
#ifdef ENABLE_WALLET
|
||||
if (pwalletMain) {
|
||||
obj.push_back(Pair("keypoololdest", pwalletMain->GetOldestKeyPoolTime()));
|
||||
obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize()));
|
||||
}
|
||||
if (pwalletMain && pwalletMain->IsCrypted())
|
||||
obj.push_back(Pair("unlocked_until", nWalletUnlockTime));
|
||||
obj.push_back(Pair("paytxfee", ValueFromAmount(payTxFee.GetFeePerK())));
|
||||
#endif
|
||||
obj.push_back(Pair("sapling", ASSETCHAINS_SAPLING));
|
||||
}
|
||||
obj.push_back(Pair("timeoffset", GetTimeOffset()));
|
||||
if ( chainActive.LastTip() != 0 )
|
||||
obj.push_back(Pair("tiptime", (int)chainActive.LastTip()->nTime));
|
||||
obj.push_back(Pair("connections", (int)vNodes.size()));
|
||||
obj.push_back(Pair("proxy", (proxy.IsValid() ? proxy.proxy.ToStringIPPort() : string())));
|
||||
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
|
||||
obj.push_back(Pair("testnet", Params().TestnetToBeDeprecatedFieldRPC()));
|
||||
#ifdef ENABLE_WALLET
|
||||
if (pwalletMain) {
|
||||
obj.push_back(Pair("keypoololdest", pwalletMain->GetOldestKeyPoolTime()));
|
||||
obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize()));
|
||||
}
|
||||
if (pwalletMain && pwalletMain->IsCrypted())
|
||||
obj.push_back(Pair("unlocked_until", nWalletUnlockTime));
|
||||
obj.push_back(Pair("paytxfee", ValueFromAmount(payTxFee.GetFeePerK())));
|
||||
#endif
|
||||
obj.push_back(Pair("relayfee", ValueFromAmount(::minRelayTxFee.GetFeePerK())));
|
||||
obj.push_back(Pair("errors", GetWarnings("statusbar")));
|
||||
if ( NOTARY_PUBKEY33[0] != 0 ) {
|
||||
@@ -304,7 +308,6 @@ UniValue getinfo(const UniValue& params, bool fHelp)
|
||||
if ( ASSETCHAINS_CC != 0 )
|
||||
obj.push_back(Pair("CCid", (int)ASSETCHAINS_CC));
|
||||
obj.push_back(Pair("name", ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL));
|
||||
obj.push_back(Pair("sapling", ASSETCHAINS_SAPLING));
|
||||
|
||||
obj.push_back(Pair("p2pport", ASSETCHAINS_P2PPORT));
|
||||
obj.push_back(Pair("rpcport", ASSETCHAINS_RPCPORT));
|
||||
|
||||
@@ -727,27 +727,31 @@ UniValue verifytxoutproof(const UniValue& params, bool fHelp)
|
||||
|
||||
UniValue createrawtransaction(const UniValue& params, bool fHelp)
|
||||
{
|
||||
string examplescriptPubKey = "21021ce1eac70455c3e6c52d67c133549b8aed4a588fba594372e8048e65c4f0fcb6ac";
|
||||
|
||||
if (fHelp || params.size() < 2 || params.size() > 4)
|
||||
throw runtime_error(
|
||||
"createrawtransaction [{\"txid\":\"id\",\"vout\":n},...] {\"address\":amount,...} ( locktime ) ( expiryheight )\n"
|
||||
"\nCreate a transaction spending the given inputs and sending to the given addresses.\n"
|
||||
"\nCreate a transaction spending the given inputs and creating new outputs.\n"
|
||||
"Outputs can be addresses or standart scripts (in hex) or data.\n"
|
||||
"Returns hex-encoded raw transaction.\n"
|
||||
"Note that the transaction's inputs are not signed, and\n"
|
||||
"it is not stored in the wallet or transmitted to the network.\n"
|
||||
|
||||
"\nArguments:\n"
|
||||
"1. \"transactions\" (string, required) A json array of json objects\n"
|
||||
"1. \"inputs\" (array, required) A json array of json objects\n"
|
||||
" [\n"
|
||||
" {\n"
|
||||
" \"txid\":\"id\", (string, required) The transaction id\n"
|
||||
" \"vout\":n (numeric, required) The output number\n"
|
||||
" \"sequence\":n (numeric, optional) The sequence number\n"
|
||||
" }\n"
|
||||
" \"vout\":n, (numeric, required) The output number\n"
|
||||
" \"sequence\":n (numeric, optional) The sequence number\n"
|
||||
" } \n"
|
||||
" ,...\n"
|
||||
" ]\n"
|
||||
"2. \"addresses\" (string, required) a json object with addresses as keys and amounts as values\n"
|
||||
"2. \"outputs\" (object, required) a json object with outputs\n"
|
||||
" {\n"
|
||||
" \"address\": x.xxx (numeric, required) The key is the Komodo address, the value is the " + CURRENCY_UNIT + " amount\n"
|
||||
" \"address\": x.xxx, (numeric or string, required) The key is the komodo address or script (in hex), the numeric value (can be string) is the " + CURRENCY_UNIT + " amount\n"
|
||||
" \"data\": \"hex\" (string, required) The key is \"data\", the value is hex encoded data\n"
|
||||
" ,...\n"
|
||||
" }\n"
|
||||
"3. locktime (numeric, optional, default=0) Raw locktime. Non-0 value also locktime-activates inputs\n"
|
||||
@@ -757,7 +761,11 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp)
|
||||
|
||||
"\nExamples\n"
|
||||
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\"address\\\":0.01}\"")
|
||||
+ HelpExampleRpc("createrawtransaction", "[{\"txid\":\"myid\",\"vout\":0}], {\"address\":0.01}")
|
||||
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\""+examplescriptPubKey+"\\\":0.01}\"")
|
||||
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\"data\\\":\\\"00010203\\\"}\"")
|
||||
+ HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"address\\\":0.01}\"")
|
||||
+ HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\""+examplescriptPubKey+"\\\":0.01}\"")
|
||||
+ HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"data\\\":\\\"00010203\\\"}\"")
|
||||
);
|
||||
|
||||
LOCK(cs_main);
|
||||
@@ -817,22 +825,61 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp)
|
||||
}
|
||||
|
||||
std::set<CTxDestination> destinations;
|
||||
//std::set<std::string> destinations;
|
||||
|
||||
vector<string> addrList = sendTo.getKeys();
|
||||
for (const std::string& name_ : addrList) {
|
||||
CTxDestination destination = DecodeDestination(name_);
|
||||
if (!IsValidDestination(destination)) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Komodo address: ") + name_);
|
||||
|
||||
if (addrList.size() != sendTo.size()) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid outputs")); // for checking edge case, should never happened ...
|
||||
}
|
||||
|
||||
//for (const std::string& name_ : addrList) {
|
||||
for (size_t idx = 0; idx < sendTo.size(); idx++) {
|
||||
|
||||
const std::string& name_ = addrList[idx];
|
||||
|
||||
CScript scriptPubKey;
|
||||
CTxDestination destination;
|
||||
|
||||
if (name_ == "data") {
|
||||
std::vector<unsigned char> data = ParseHexV(sendTo[name_].getValStr(),"Data");
|
||||
CTxOut out(0, CScript() << OP_RETURN << data);
|
||||
rawTx.vout.push_back(out);
|
||||
} else {
|
||||
destination = DecodeDestination(name_);
|
||||
if (IsValidDestination(destination)) {
|
||||
scriptPubKey = GetScriptForDestination(destination);
|
||||
} else if (IsHex(name_)) {
|
||||
std::vector<unsigned char> data(ParseHex(name_));
|
||||
scriptPubKey = CScript(data.begin(), data.end());
|
||||
// destination is not valid, but we should convert it to valid anyway, to be able to check duplicates,
|
||||
// so we need to get destination from existing scriptPubKey via ExtractDestination
|
||||
if (!(ExtractDestination(scriptPubKey, destination) &&
|
||||
(scriptPubKey.IsPayToPublicKeyHash() || scriptPubKey.IsPayToPublicKey() || scriptPubKey.IsPayToScriptHash())
|
||||
)) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid script: ") + name_ + std::string(" (only P2PKH, P2PK and P2SH scripts are allowed)"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Komodo address or script: ") + name_);
|
||||
}
|
||||
|
||||
if (!(fExperimentalMode && IS_KOMODO_NOTARY)) {
|
||||
// support of sending duplicates in createrawtransaction requires experimental features enabled and
|
||||
// notary flag, to prevent common users to get messed up with duplicates
|
||||
|
||||
//if (!destinations.insert(EncodeDestination(destination)).second) {
|
||||
if (!destinations.insert(destination).second) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, std::string("Invalid parameter, duplicated destination: ") + name_);
|
||||
}
|
||||
}
|
||||
|
||||
// CAmount nAmount = AmountFromValue(sendTo[name_]); // operator[](const std::string& key) const;
|
||||
CAmount nAmount = AmountFromValue(sendTo[idx]); // operator[](size_t index) const;
|
||||
|
||||
CTxOut out(nAmount, scriptPubKey);
|
||||
rawTx.vout.push_back(out);
|
||||
}
|
||||
|
||||
if (!destinations.insert(destination).second) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, std::string("Invalid parameter, duplicated address: ") + name_);
|
||||
}
|
||||
|
||||
CScript scriptPubKey = GetScriptForDestination(destination);
|
||||
CAmount nAmount = AmountFromValue(sendTo[name_]);
|
||||
|
||||
CTxOut out(nAmount, scriptPubKey);
|
||||
rawTx.vout.push_back(out);
|
||||
}
|
||||
|
||||
return EncodeHexTx(rawTx);
|
||||
|
||||
@@ -61,7 +61,7 @@ UniValue test_ac(const UniValue& params, bool fHelp)
|
||||
if (fHelp || (params.size() != 4))
|
||||
throw runtime_error("incorrect params\n");
|
||||
if (ensure_CCrequirements(EVAL_HEIR) < 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(CC_REQUIREMENTS_MSG);
|
||||
|
||||
std::vector<unsigned char> pubkey1;
|
||||
std::vector<unsigned char> pubkey2;
|
||||
@@ -106,7 +106,7 @@ UniValue test_heirmarker(const UniValue& params, bool fHelp)
|
||||
if (fHelp || (params.size() != 1))
|
||||
throw runtime_error("incorrect params\n");
|
||||
if (ensure_CCrequirements(EVAL_HEIR) < 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(CC_REQUIREMENTS_MSG);
|
||||
|
||||
uint256 fundingtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
|
||||
@@ -137,7 +137,7 @@ UniValue test_burntx(const UniValue& params, bool fHelp)
|
||||
if (fHelp || (params.size() != 1))
|
||||
throw runtime_error("incorrect params\n");
|
||||
if (ensure_CCrequirements(EVAL_TOKENS) < 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(CC_REQUIREMENTS_MSG);
|
||||
|
||||
uint256 tokenid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
|
||||
@@ -230,7 +230,7 @@ UniValue test_pricesmarker(const UniValue& params, bool fHelp)
|
||||
if (fHelp || (params.size() != 1))
|
||||
throw runtime_error("incorrect params\n");
|
||||
if (ensure_CCrequirements(EVAL_PRICES) < 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(CC_REQUIREMENTS_MSG);
|
||||
|
||||
uint256 bettxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
|
||||
@@ -265,4 +265,4 @@ void RegisterTesttransactionsRPCCommands(CRPCTable &tableRPC)
|
||||
{
|
||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
|
||||
tableRPC.appendCommand(commands[vcidx].name, &commands[vcidx]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,7 +385,9 @@ bool CScript::IsPayToCryptoCondition(CScript *pCCSubScript, std::vector<std::vec
|
||||
bool CScript::IsPayToCryptoCondition(CScript *pCCSubScript) const
|
||||
{
|
||||
std::vector<std::vector<unsigned char>> vParams;
|
||||
return IsPayToCryptoCondition(pCCSubScript, vParams);
|
||||
if ( pCCSubScript != 0 )
|
||||
return IsPayToCryptoCondition(pCCSubScript, vParams);
|
||||
else return(false);
|
||||
}
|
||||
|
||||
bool CScript::IsPayToCryptoCondition() const
|
||||
|
||||
@@ -35,6 +35,8 @@ using namespace std;
|
||||
|
||||
typedef vector<unsigned char> valtype;
|
||||
extern uint8_t ASSETCHAINS_TXPOW;
|
||||
extern char NSPV_wifstr[],NSPV_pubkeystr[];
|
||||
extern int32_t KOMODO_NSPV;
|
||||
uint256 SIG_TXHASH;
|
||||
|
||||
TransactionSignatureCreator::TransactionSignatureCreator(const CKeyStore* keystoreIn, const CTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, int nHashTypeIn) : BaseSignatureCreator(keystoreIn), txTo(txToIn), nIn(nInIn), nHashType(nHashTypeIn), amount(amountIn), checker(txTo, nIn, amountIn) {}
|
||||
@@ -45,21 +47,35 @@ bool TransactionSignatureCreator::CreateSig(std::vector<unsigned char>& vchSig,
|
||||
try {
|
||||
hash = SignatureHash(scriptCode, *txTo, nIn, nHashType, amount, consensusBranchId);
|
||||
} catch (logic_error ex) {
|
||||
{
|
||||
fprintf(stderr,"logic error\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
SIG_TXHASH = hash;
|
||||
if (pprivKey)
|
||||
if ( KOMODO_NSPV != 0 )
|
||||
key = DecodeSecret(NSPV_wifstr);
|
||||
else if (pprivKey)
|
||||
key = *pprivKey;
|
||||
else if (!keystore || !keystore->GetKey(address, key))
|
||||
{
|
||||
fprintf(stderr,"keystore.%p error\n",keystore);
|
||||
return false;
|
||||
}
|
||||
//fprintf(stderr,"privkey (%s) for %s\n",NSPV_wifstr,EncodeDestination(key.GetPubKey().GetID()).c_str());
|
||||
|
||||
if (scriptCode.IsPayToCryptoCondition())
|
||||
{
|
||||
CC *cc = (CC *)extraData;
|
||||
// assume either 1of1 or 1of2. if the condition created by the
|
||||
if (!cc || cc_signTreeSecp256k1Msg32(cc, key.begin(), hash.begin()) == 0)
|
||||
{
|
||||
fprintf(stderr,"CC tree error\n");
|
||||
return false;
|
||||
}
|
||||
vchSig = CCSigVec(cc);
|
||||
if ( KOMODO_NSPV != 0 )
|
||||
memset((uint8_t *)key.begin(),0,32);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -67,7 +83,14 @@ bool TransactionSignatureCreator::CreateSig(std::vector<unsigned char>& vchSig,
|
||||
if ( ASSETCHAINS_TXPOW == 0 )
|
||||
{
|
||||
if (!key.Sign(hash, vchSig))
|
||||
{
|
||||
fprintf(stderr,"key.Sign error\n");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//fprintf(stderr,"signed success %s\n",(char *)HexStr(vchSig).c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -77,7 +100,8 @@ bool TransactionSignatureCreator::CreateSig(std::vector<unsigned char>& vchSig,
|
||||
}
|
||||
|
||||
vchSig.push_back((unsigned char)nHashType);
|
||||
|
||||
if ( KOMODO_NSPV != 0 )
|
||||
memset((uint8_t *)key.begin(),0,32);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -85,7 +109,10 @@ static bool Sign1(const CKeyID& address, const BaseSignatureCreator& creator, co
|
||||
{
|
||||
vector<unsigned char> vchSig;
|
||||
if (!creator.CreateSig(vchSig, address, scriptCode, consensusBranchId))
|
||||
{
|
||||
fprintf(stderr,"Sign1 creatsig error\n");
|
||||
return false;
|
||||
}
|
||||
ret.push_back(vchSig);
|
||||
return true;
|
||||
}
|
||||
@@ -337,7 +364,6 @@ static bool SignStep(const BaseSignatureCreator& creator, const CScript& scriptP
|
||||
}
|
||||
|
||||
CKeyID keyID;
|
||||
|
||||
switch (whichTypeRet)
|
||||
{
|
||||
case TX_NONSTANDARD:
|
||||
@@ -349,12 +375,18 @@ static bool SignStep(const BaseSignatureCreator& creator, const CScript& scriptP
|
||||
case TX_PUBKEYHASH:
|
||||
keyID = CKeyID(uint160(vSolutions[0]));
|
||||
if (!Sign1(keyID, creator, scriptPubKey, ret, consensusBranchId))
|
||||
{
|
||||
fprintf(stderr,"sign1 error\n");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
CPubKey vch;
|
||||
creator.KeyStore().GetPubKey(keyID, vch);
|
||||
ret.push_back(ToByteVector(vch));
|
||||
if ( KOMODO_NSPV == 0 )
|
||||
{
|
||||
CPubKey vch;
|
||||
creator.KeyStore().GetPubKey(keyID, vch);
|
||||
ret.push_back(ToByteVector(vch));
|
||||
} else ret.push_back(ParseHex(NSPV_pubkeystr));
|
||||
}
|
||||
return true;
|
||||
case TX_SCRIPTHASH:
|
||||
@@ -411,7 +443,6 @@ bool ProduceSignature(const BaseSignatureCreator& creator, const CScript& fromPu
|
||||
}
|
||||
|
||||
sigdata.scriptSig = PushAll(result);
|
||||
|
||||
// Test solution
|
||||
return solved && VerifyScript(sigdata.scriptSig, fromPubKey, STANDARD_SCRIPT_VERIFY_FLAGS, creator.Checker(), consensusBranchId);
|
||||
}
|
||||
|
||||
@@ -414,7 +414,7 @@ void SplitStr(const std::string& strVal, std::vector<std::string> &outVals)
|
||||
}
|
||||
}
|
||||
|
||||
void Split(const std::string& strVal, uint64_t *outVals, const uint64_t nDefault)
|
||||
void Split(const std::string& strVal, int32_t outsize, uint64_t *outVals, const uint64_t nDefault)
|
||||
{
|
||||
stringstream ss(strVal);
|
||||
vector<uint64_t> vec;
|
||||
@@ -442,7 +442,7 @@ void Split(const std::string& strVal, uint64_t *outVals, const uint64_t nDefault
|
||||
else
|
||||
nLast = nDefault;
|
||||
|
||||
for ( i = numVals; i < ASSETCHAINS_MAX_ERAS; i++ )
|
||||
for ( i = numVals; i < outsize; i++ )
|
||||
{
|
||||
outVals[i] = nLast;
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ inline bool IsSwitchChar(char c)
|
||||
* else if the string has fewer than _MAX_ERAS entries, then the last
|
||||
* entry fills remaining entries
|
||||
*/
|
||||
void Split(const std::string& strVal, uint64_t *outVals, uint64_t nDefault);
|
||||
void Split(const std::string& strVal, int32_t outsize, uint64_t *outVals, uint64_t nDefault);
|
||||
|
||||
/**
|
||||
* Return string argument or default value
|
||||
|
||||
@@ -5544,7 +5544,7 @@ UniValue channelsaddress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("channelsaddress pubkey\n");
|
||||
if ( ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
pubkey = ParseHex(params[0].get_str().c_str());
|
||||
return(CCaddress(cp,(char *)"Channels",pubkey));
|
||||
}
|
||||
@@ -5555,7 +5555,7 @@ UniValue cclibaddress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 2 )
|
||||
throw runtime_error("cclibaddress [evalcode] [pubkey]\n");
|
||||
if ( ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
if ( params.size() >= 1 )
|
||||
{
|
||||
evalcode = atoi(params[0].get_str().c_str());
|
||||
@@ -5576,7 +5576,7 @@ UniValue cclibinfo(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 0 )
|
||||
throw runtime_error("cclibinfo\n");
|
||||
if ( ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
cp = CCinit(&C,evalcode);
|
||||
return(CClib_info(cp));
|
||||
}
|
||||
@@ -5591,7 +5591,7 @@ UniValue cclib(const UniValue& params, bool fHelp)
|
||||
if ( ASSETCHAINS_CCLIB.size() == 0 )
|
||||
throw runtime_error("no -ac_cclib= specified\n");
|
||||
if ( ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
method = (char *)params[0].get_str().c_str();
|
||||
@@ -5624,7 +5624,7 @@ UniValue payments_release(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("paymentsrelease \"[%22createtxid%22,amount,(skipminimum)]\"\n");
|
||||
if ( ensure_CCrequirements(EVAL_PAYMENTS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
cp = CCinit(&C,EVAL_PAYMENTS);
|
||||
@@ -5637,7 +5637,7 @@ UniValue payments_fund(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("paymentsfund \"[%22createtxid%22,amount(,useopret)]\"\n");
|
||||
if ( ensure_CCrequirements(EVAL_PAYMENTS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
cp = CCinit(&C,EVAL_PAYMENTS);
|
||||
@@ -5650,7 +5650,7 @@ UniValue payments_merge(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("paymentsmerge \"[%22createtxid%22]\"\n");
|
||||
if ( ensure_CCrequirements(EVAL_PAYMENTS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
cp = CCinit(&C,EVAL_PAYMENTS);
|
||||
@@ -5663,7 +5663,7 @@ UniValue payments_txidopret(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("paymentstxidopret \"[allocation,%22scriptPubKey%22(,%22destopret%22)]\"\n");
|
||||
if ( ensure_CCrequirements(EVAL_PAYMENTS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
cp = CCinit(&C,EVAL_PAYMENTS);
|
||||
@@ -5676,7 +5676,7 @@ UniValue payments_create(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("paymentscreate \"[lockedblocks,minamount,%22paytxid0%22,...,%22paytxidN%22]\"\n");
|
||||
if ( ensure_CCrequirements(EVAL_PAYMENTS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
cp = CCinit(&C,EVAL_PAYMENTS);
|
||||
@@ -5689,7 +5689,7 @@ UniValue payments_airdrop(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("paymentsairdrop \"[lockedblocks,minamount,mintoaddress,top,bottom,fixedFlag,%22excludeAddress%22,...,%22excludeAddressN%22]\"\n");
|
||||
if ( ensure_CCrequirements(EVAL_PAYMENTS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
cp = CCinit(&C,EVAL_PAYMENTS);
|
||||
@@ -5702,7 +5702,7 @@ UniValue payments_airdroptokens(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("payments_airdroptokens \"[%22tokenid%22,lockedblocks,minamount,mintoaddress,top,bottom,fixedFlag,%22excludePubKey%22,...,%22excludePubKeyN%22]\"\n");
|
||||
if ( ensure_CCrequirements(EVAL_PAYMENTS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
cp = CCinit(&C,EVAL_PAYMENTS);
|
||||
@@ -5715,7 +5715,7 @@ UniValue payments_info(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("paymentsinfo \"[%22createtxid%22]\"\n");
|
||||
if ( ensure_CCrequirements(EVAL_PAYMENTS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
cp = CCinit(&C,EVAL_PAYMENTS);
|
||||
@@ -5728,7 +5728,7 @@ UniValue payments_list(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 0 )
|
||||
throw runtime_error("paymentslist\n");
|
||||
if ( ensure_CCrequirements(EVAL_PAYMENTS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
cp = CCinit(&C,EVAL_PAYMENTS);
|
||||
@@ -5742,7 +5742,7 @@ UniValue oraclesaddress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("oraclesaddress [pubkey]\n");
|
||||
if ( ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
if ( params.size() == 1 )
|
||||
pubkey = ParseHex(params[0].get_str().c_str());
|
||||
return(CCaddress(cp,(char *)"Oracles",pubkey));
|
||||
@@ -5756,7 +5756,7 @@ UniValue pricesaddress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("pricesaddress [pubkey]\n");
|
||||
if ( ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
if ( params.size() == 1 )
|
||||
pubkey = ParseHex(params[0].get_str().c_str());
|
||||
result = CCaddress(cp,(char *)"Prices",pubkey);
|
||||
@@ -5778,7 +5778,7 @@ UniValue pegsaddress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("pegssaddress [pubkey]\n");
|
||||
if ( ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
if ( params.size() == 1 )
|
||||
pubkey = ParseHex(params[0].get_str().c_str());
|
||||
return(CCaddress(cp,(char *)"Pegs",pubkey));
|
||||
@@ -5791,7 +5791,7 @@ UniValue marmaraaddress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("Marmaraaddress [pubkey]\n");
|
||||
if ( ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
if ( params.size() == 1 )
|
||||
pubkey = ParseHex(params[0].get_str().c_str());
|
||||
return(CCaddress(cp,(char *)"Marmara",pubkey));
|
||||
@@ -5804,7 +5804,7 @@ UniValue paymentsaddress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("paymentsaddress [pubkey]\n");
|
||||
if ( ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
if ( params.size() == 1 )
|
||||
pubkey = ParseHex(params[0].get_str().c_str());
|
||||
return(CCaddress(cp,(char *)"Payments",pubkey));
|
||||
@@ -5817,7 +5817,7 @@ UniValue gatewaysaddress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("gatewaysaddress [pubkey]\n");
|
||||
if ( ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
if ( params.size() == 1 )
|
||||
pubkey = ParseHex(params[0].get_str().c_str());
|
||||
return(CCaddress(cp,(char *)"Gateways",pubkey));
|
||||
@@ -5830,7 +5830,7 @@ UniValue heiraddress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("heiraddress pubkey\n");
|
||||
if ( ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
pubkey = ParseHex(params[0].get_str().c_str());
|
||||
return(CCaddress(cp,(char *)"Heir",pubkey));
|
||||
}
|
||||
@@ -5842,7 +5842,7 @@ UniValue lottoaddress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("lottoaddress [pubkey]\n");
|
||||
if ( ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
if ( params.size() == 1 )
|
||||
pubkey = ParseHex(params[0].get_str().c_str());
|
||||
return(CCaddress(cp,(char *)"Lotto",pubkey));
|
||||
@@ -5855,7 +5855,7 @@ UniValue FSMaddress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("FSMaddress [pubkey]\n");
|
||||
if ( ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
if ( params.size() == 1 )
|
||||
pubkey = ParseHex(params[0].get_str().c_str());
|
||||
return(CCaddress(cp,(char *)"FSM",pubkey));
|
||||
@@ -5868,7 +5868,7 @@ UniValue auctionaddress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("auctionaddress [pubkey]\n");
|
||||
if ( ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
if ( params.size() == 1 )
|
||||
pubkey = ParseHex(params[0].get_str().c_str());
|
||||
return(CCaddress(cp,(char *)"Auction",pubkey));
|
||||
@@ -5881,7 +5881,7 @@ UniValue diceaddress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("diceaddress [pubkey]\n");
|
||||
if ( ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
if ( params.size() == 1 )
|
||||
pubkey = ParseHex(params[0].get_str().c_str());
|
||||
return(CCaddress(cp,(char *)"Dice",pubkey));
|
||||
@@ -5909,7 +5909,7 @@ UniValue rewardsaddress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("rewardsaddress [pubkey]\n");
|
||||
if ( ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
if ( params.size() == 1 )
|
||||
pubkey = ParseHex(params[0].get_str().c_str());
|
||||
return(CCaddress(cp,(char *)"Rewards",pubkey));
|
||||
@@ -5922,7 +5922,7 @@ UniValue assetsaddress(const UniValue& params, bool fHelp)
|
||||
if (fHelp || params.size() > 1)
|
||||
throw runtime_error("assetsaddress [pubkey]\n");
|
||||
if (ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
if (params.size() == 1)
|
||||
pubkey = ParseHex(params[0].get_str().c_str());
|
||||
return(CCaddress(cp, (char *)"Assets", pubkey));
|
||||
@@ -5935,7 +5935,7 @@ UniValue tokenaddress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("tokenaddress [pubkey]\n");
|
||||
if ( ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
if ( params.size() == 1 )
|
||||
pubkey = ParseHex(params[0].get_str().c_str());
|
||||
return(CCaddress(cp,(char *)"Tokens", pubkey));
|
||||
@@ -5948,7 +5948,7 @@ UniValue importgatewayaddress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("importgatewayddress [pubkey]\n");
|
||||
if ( ensure_CCrequirements(0) < 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(CC_REQUIREMENTS_MSG);
|
||||
if ( params.size() == 1 )
|
||||
pubkey = ParseHex(params[0].get_str().c_str());
|
||||
return(CCaddress(cp,(char *)"ImportGateway", pubkey));
|
||||
@@ -5964,7 +5964,7 @@ UniValue marmara_poolpayout(const UniValue& params, bool fHelp)
|
||||
throw runtime_error("marmarapoolpayout perc firstheight \"[[\\\"pubkey\\\":shares], ...]\"\n");
|
||||
}
|
||||
if ( ensure_CCrequirements(EVAL_MARMARA) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
perc = atof(params[0].get_str().c_str()) / 100.;
|
||||
@@ -5984,7 +5984,7 @@ UniValue marmara_receive(const UniValue& params, bool fHelp)
|
||||
throw runtime_error("marmarareceive senderpk amount currency matures batontxid\n");
|
||||
}
|
||||
if ( ensure_CCrequirements(EVAL_MARMARA) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
memset(&batontxid,0,sizeof(batontxid));
|
||||
@@ -6015,7 +6015,7 @@ UniValue marmara_issue(const UniValue& params, bool fHelp)
|
||||
throw runtime_error("marmaraissue receiverpk amount currency matures approvaltxid\n");
|
||||
}
|
||||
if ( ensure_CCrequirements(EVAL_MARMARA) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
receiverpub = ParseHex(params[0].get_str().c_str());
|
||||
@@ -6040,7 +6040,7 @@ UniValue marmara_transfer(const UniValue& params, bool fHelp)
|
||||
throw runtime_error("marmaratransfer receiverpk amount currency matures approvaltxid\n");
|
||||
}
|
||||
if ( ensure_CCrequirements(EVAL_MARMARA) < 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(CC_REQUIREMENTS_MSG);
|
||||
receiverpub = ParseHex(params[0].get_str().c_str());
|
||||
if (receiverpub.size()!= 33)
|
||||
{
|
||||
@@ -6066,7 +6066,7 @@ UniValue marmara_info(const UniValue& params, bool fHelp)
|
||||
throw runtime_error("marmarainfo firstheight lastheight minamount maxamount [currency issuerpk]\n");
|
||||
}
|
||||
if ( ensure_CCrequirements(EVAL_MARMARA) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
firstheight = atol(params[0].get_str().c_str());
|
||||
@@ -6098,7 +6098,7 @@ UniValue marmara_creditloop(const UniValue& params, bool fHelp)
|
||||
throw runtime_error("marmaracreditloop txid\n");
|
||||
}
|
||||
if ( ensure_CCrequirements(EVAL_MARMARA) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
txid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6116,7 +6116,7 @@ UniValue marmara_settlement(const UniValue& params, bool fHelp)
|
||||
throw runtime_error("marmarasettlement batontxid\n");
|
||||
}
|
||||
if ( ensure_CCrequirements(EVAL_MARMARA) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
batontxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6145,7 +6145,7 @@ UniValue channelslist(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 0 )
|
||||
throw runtime_error("channelsinfo\n");
|
||||
if ( ensure_CCrequirements(EVAL_CHANNELS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
return(ChannelsList());
|
||||
@@ -6157,7 +6157,7 @@ UniValue channelsinfo(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("channelsinfo [opentxid]\n");
|
||||
if ( ensure_CCrequirements(EVAL_CHANNELS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
opentxid=zeroid;
|
||||
@@ -6175,7 +6175,7 @@ UniValue channelsopen(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() < 3 || params.size() > 4)
|
||||
throw runtime_error("channelsopen destpubkey numpayments payment\n");
|
||||
if ( ensure_CCrequirements(EVAL_CHANNELS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
destpub = ParseHex(params[0].get_str().c_str());
|
||||
@@ -6217,7 +6217,7 @@ UniValue channelspayment(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() < 2 || params.size() >3 )
|
||||
throw runtime_error("channelspayment opentxid amount [secret]\n");
|
||||
if ( ensure_CCrequirements(EVAL_CHANNELS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
opentxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6248,7 +6248,7 @@ UniValue channelsclose(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("channelsclose opentxid\n");
|
||||
if ( ensure_CCrequirements(EVAL_CHANNELS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
opentxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6269,7 +6269,7 @@ UniValue channelsrefund(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("channelsrefund opentxid closetxid\n");
|
||||
if ( ensure_CCrequirements(EVAL_CHANNELS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
opentxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6290,7 +6290,7 @@ UniValue rewardscreatefunding(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 6 || params.size() < 2 )
|
||||
throw runtime_error("rewardscreatefunding name amount APR mindays maxdays mindeposit\n");
|
||||
if ( ensure_CCrequirements(EVAL_REWARDS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
// default to OOT params
|
||||
@@ -6359,7 +6359,7 @@ UniValue rewardslock(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("rewardslock name fundingtxid amount\n");
|
||||
if ( ensure_CCrequirements(EVAL_REWARDS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
name = (char *)params[0].get_str().c_str();
|
||||
@@ -6389,7 +6389,7 @@ UniValue rewardsaddfunding(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("rewardsaddfunding name fundingtxid amount\n");
|
||||
if ( ensure_CCrequirements(EVAL_REWARDS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
name = (char *)params[0].get_str().c_str();
|
||||
@@ -6424,7 +6424,7 @@ UniValue rewardsunlock(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 3 || params.size() < 2 )
|
||||
throw runtime_error("rewardsunlock name fundingtxid [txid]\n");
|
||||
if ( ensure_CCrequirements(EVAL_REWARDS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
name = (char *)params[0].get_str().c_str();
|
||||
@@ -6452,7 +6452,7 @@ UniValue rewardslist(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 0 )
|
||||
throw runtime_error("rewardslist\n");
|
||||
if ( ensure_CCrequirements(EVAL_REWARDS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
return(RewardsList());
|
||||
@@ -6464,7 +6464,7 @@ UniValue rewardsinfo(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("rewardsinfo fundingtxid\n");
|
||||
if ( ensure_CCrequirements(EVAL_REWARDS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
fundingtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6476,7 +6476,7 @@ UniValue gatewayslist(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 0 )
|
||||
throw runtime_error("gatewayslist\n");
|
||||
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
return(GatewaysList());
|
||||
@@ -6489,7 +6489,7 @@ UniValue gatewaysexternaladdress(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2)
|
||||
throw runtime_error("gatewaysexternaladdress bindtxid pubkey\n");
|
||||
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6504,7 +6504,7 @@ UniValue gatewaysdumpprivkey(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2)
|
||||
throw runtime_error("gatewaysdumpprivkey bindtxid address\n");
|
||||
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 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(CC_REQUIREMENTS_MSG);
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
std::string strAddress = params[1].get_str();
|
||||
@@ -6529,7 +6529,7 @@ UniValue gatewaysinfo(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("gatewaysinfo bindtxid\n");
|
||||
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
txid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6544,7 +6544,7 @@ UniValue gatewaysbind(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() < 10 )
|
||||
throw runtime_error("gatewaysbind tokenid oracletxid coin tokensupply M N pubkey(s) pubtype p2shtype wiftype [taddr]\n");
|
||||
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
tokenid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6584,7 +6584,7 @@ UniValue gatewaysdeposit(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 9 )
|
||||
throw runtime_error("gatewaysdeposit bindtxid height coin cointxid claimvout deposithex proof destpub amount\n");
|
||||
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6617,7 +6617,7 @@ UniValue gatewaysclaim(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 5 )
|
||||
throw runtime_error("gatewaysclaim bindtxid coin deposittxid destpub amount\n");
|
||||
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6643,7 +6643,7 @@ UniValue gatewayswithdraw(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 4 )
|
||||
throw runtime_error("gatewayswithdraw bindtxid coin withdrawpub amount\n");
|
||||
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6668,7 +6668,7 @@ UniValue gatewayspartialsign(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("gatewayspartialsign txidaddr refcoin hex\n");
|
||||
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
txid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6690,7 +6690,7 @@ UniValue gatewayscompletesigning(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("gatewayscompletesigning withdrawtxid coin hex\n");
|
||||
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
withdrawtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6712,7 +6712,7 @@ UniValue gatewaysmarkdone(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("gatewaysmarkdone completesigningtx coin\n");
|
||||
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
completetxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6733,7 +6733,7 @@ UniValue gatewayspendingdeposits(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("gatewayspendingdeposits bindtxid coin\n");
|
||||
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6747,7 +6747,7 @@ UniValue gatewayspendingwithdraws(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("gatewayspendingwithdraws bindtxid coin\n");
|
||||
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6761,7 +6761,7 @@ UniValue gatewaysprocessed(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("gatewaysprocessed bindtxid coin\n");
|
||||
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
bindtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6774,7 +6774,7 @@ UniValue oracleslist(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 0 )
|
||||
throw runtime_error("oracleslist\n");
|
||||
if ( ensure_CCrequirements(EVAL_ORACLES) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
return(OraclesList());
|
||||
@@ -6786,7 +6786,7 @@ UniValue oraclesinfo(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("oraclesinfo oracletxid\n");
|
||||
if ( ensure_CCrequirements(EVAL_ORACLES) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
txid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6799,7 +6799,7 @@ UniValue oraclesfund(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("oraclesfund oracletxid\n");
|
||||
if ( ensure_CCrequirements(EVAL_ORACLES) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
txid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6819,7 +6819,7 @@ UniValue oraclesregister(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("oraclesregister oracletxid datafee\n");
|
||||
if ( ensure_CCrequirements(EVAL_ORACLES) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
txid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6841,7 +6841,7 @@ UniValue oraclessubscribe(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("oraclessubscribe oracletxid publisher amount\n");
|
||||
if ( ensure_CCrequirements(EVAL_ORACLES) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
txid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6863,7 +6863,7 @@ UniValue oraclessample(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("oraclessample oracletxid txid\n");
|
||||
if ( ensure_CCrequirements(EVAL_ORACLES) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
oracletxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6877,7 +6877,7 @@ UniValue oraclessamples(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("oraclessamples oracletxid batonaddress num\n");
|
||||
if ( ensure_CCrequirements(EVAL_ORACLES) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
txid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6892,7 +6892,7 @@ UniValue oraclesdata(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("oraclesdata oracletxid hexstr\n");
|
||||
if ( ensure_CCrequirements(EVAL_ORACLES) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
txid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -6913,7 +6913,7 @@ UniValue oraclescreate(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("oraclescreate name description format\n");
|
||||
if ( ensure_CCrequirements(EVAL_ORACLES) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
name = params[0].get_str();
|
||||
@@ -6950,7 +6950,7 @@ UniValue FSMcreate(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("FSMcreate name states\n");
|
||||
if ( ensure_CCrequirements(EVAL_FSM) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
name = params[0].get_str();
|
||||
@@ -6970,7 +6970,7 @@ UniValue FSMlist(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 0 )
|
||||
throw runtime_error("FSMlist\n");
|
||||
if ( ensure_CCrequirements(EVAL_FSM) < 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(CC_REQUIREMENTS_MSG);
|
||||
return(FSMList());
|
||||
}
|
||||
|
||||
@@ -6980,7 +6980,7 @@ UniValue FSMinfo(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("FSMinfo fundingtxid\n");
|
||||
if ( ensure_CCrequirements(EVAL_FSM) < 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(CC_REQUIREMENTS_MSG);
|
||||
FSMtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
return(FSMInfo(FSMtxid));
|
||||
}
|
||||
@@ -6991,7 +6991,7 @@ UniValue faucetinfo(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 0 )
|
||||
throw runtime_error("faucetinfo\n");
|
||||
if ( ensure_CCrequirements(EVAL_FAUCET) < 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(CC_REQUIREMENTS_MSG);
|
||||
return(FaucetInfo());
|
||||
}
|
||||
|
||||
@@ -7000,11 +7000,19 @@ UniValue faucetfund(const UniValue& params, bool fHelp)
|
||||
UniValue result(UniValue::VOBJ); int64_t funds; std::string hex;
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("faucetfund amount\n");
|
||||
funds = atof(params[0].get_str().c_str()) * COIN + 0.00000000499999;
|
||||
if ( (0) && KOMODO_NSPV != 0 )
|
||||
{
|
||||
char coinaddr[64]; struct CCcontract_info *cp,C; CTxOut v;
|
||||
cp = CCinit(&C,EVAL_FAUCET);
|
||||
v = MakeCC1vout(EVAL_FAUCET,funds,GetUnspendable(cp,0));
|
||||
Getscriptaddress(coinaddr,CScript() << ParseHex(HexStr(pubkey2pk(Mypubkey()))) << OP_CHECKSIG);
|
||||
return(NSPV_spend(coinaddr,(char *)HexStr(v.scriptPubKey.begin()+1,v.scriptPubKey.end()-1).c_str(),funds));
|
||||
}
|
||||
if ( ensure_CCrequirements(EVAL_FAUCET) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
funds = atof(params[0].get_str().c_str()) * COIN + 0.00000000499999;
|
||||
if (funds > 0) {
|
||||
hex = FaucetFund(0,(uint64_t) funds);
|
||||
if ( hex.size() > 0 )
|
||||
@@ -7022,7 +7030,7 @@ UniValue faucetget(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 0 )
|
||||
throw runtime_error("faucetget\n");
|
||||
if ( ensure_CCrequirements(EVAL_FAUCET) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
hex = FaucetGet(0);
|
||||
@@ -7051,7 +7059,7 @@ UniValue priceslist(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 0 && params.size() != 1)
|
||||
throw runtime_error("priceslist [all|open|closed]\n");
|
||||
if ( ensure_CCrequirements(EVAL_PRICES) < 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(CC_REQUIREMENTS_MSG);
|
||||
uint32_t filter = 0;
|
||||
if (params.size() == 1)
|
||||
filter = pricesGetParam(params[0]);
|
||||
@@ -7066,7 +7074,7 @@ UniValue mypriceslist(const UniValue& params, bool fHelp)
|
||||
if (fHelp || params.size() != 0 && params.size() != 1)
|
||||
throw runtime_error("mypriceslist [all|open|closed]\n");
|
||||
if (ensure_CCrequirements(EVAL_PRICES) < 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(CC_REQUIREMENTS_MSG);
|
||||
|
||||
uint32_t filter = 0;
|
||||
if (params.size() == 1)
|
||||
@@ -7082,7 +7090,7 @@ UniValue pricesinfo(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 && params.size() != 2)
|
||||
throw runtime_error("pricesinfo bettxid [height]\n");
|
||||
if ( ensure_CCrequirements(EVAL_PRICES) < 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(CC_REQUIREMENTS_MSG);
|
||||
bettxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
height = 0;
|
||||
if (params.size() == 2)
|
||||
@@ -7096,7 +7104,7 @@ UniValue dicefund(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 6 )
|
||||
throw runtime_error("dicefund name funds minbet maxbet maxodds timeoutblocks\n");
|
||||
if ( ensure_CCrequirements(EVAL_DICE) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
name = (char *)params[0].get_str().c_str();
|
||||
@@ -7129,7 +7137,7 @@ UniValue diceaddfunds(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("diceaddfunds name fundingtxid amount\n");
|
||||
if ( ensure_CCrequirements(EVAL_DICE) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
name = (char *)params[0].get_str().c_str();
|
||||
@@ -7157,7 +7165,7 @@ UniValue dicebet(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 4 )
|
||||
throw runtime_error("dicebet name fundingtxid amount odds\n");
|
||||
if ( ensure_CCrequirements(EVAL_DICE) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
name = (char *)params[0].get_str().c_str();
|
||||
@@ -7189,7 +7197,7 @@ UniValue dicefinish(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("dicefinish name fundingtxid bettxid\n");
|
||||
if ( ensure_CCrequirements(EVAL_DICE) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
name = (char *)params[0].get_str().c_str();
|
||||
@@ -7224,7 +7232,7 @@ UniValue dicestatus(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || (params.size() != 2 && params.size() != 3) )
|
||||
throw runtime_error("dicestatus name fundingtxid bettxid\n");
|
||||
if ( ensure_CCrequirements(EVAL_DICE) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
name = (char *)params[0].get_str().c_str();
|
||||
@@ -7272,7 +7280,7 @@ UniValue dicelist(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 0 )
|
||||
throw runtime_error("dicelist\n");
|
||||
if ( ensure_CCrequirements(EVAL_DICE) < 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(CC_REQUIREMENTS_MSG);
|
||||
return(DiceList());
|
||||
}
|
||||
|
||||
@@ -7282,7 +7290,7 @@ UniValue diceinfo(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("diceinfo fundingtxid\n");
|
||||
if ( ensure_CCrequirements(EVAL_DICE) < 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(CC_REQUIREMENTS_MSG);
|
||||
fundingtxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
return(DiceInfo(fundingtxid));
|
||||
}
|
||||
@@ -7293,7 +7301,7 @@ UniValue tokenlist(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 0 )
|
||||
throw runtime_error("tokenlist\n");
|
||||
if ( ensure_CCrequirements(EVAL_TOKENS) < 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(CC_REQUIREMENTS_MSG);
|
||||
return(TokenList());
|
||||
}
|
||||
|
||||
@@ -7303,7 +7311,7 @@ UniValue tokeninfo(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("tokeninfo tokenid\n");
|
||||
if ( ensure_CCrequirements(EVAL_TOKENS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
tokenid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -7316,7 +7324,7 @@ UniValue tokenorders(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("tokenorders tokenid\n");
|
||||
if (ensure_CCrequirements(EVAL_ASSETS) < 0 || ensure_CCrequirements(EVAL_TOKENS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
if (params.size() == 1) {
|
||||
@@ -7338,7 +7346,7 @@ UniValue mytokenorders(const UniValue& params, bool fHelp)
|
||||
if (fHelp || params.size() > 2)
|
||||
throw runtime_error("mytokenorders [evalcode]\n");
|
||||
if (ensure_CCrequirements(EVAL_ASSETS) < 0 || ensure_CCrequirements(EVAL_TOKENS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
@@ -7357,7 +7365,7 @@ UniValue tokenbalance(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 2 )
|
||||
throw runtime_error("tokenbalance tokenid [pubkey]\n");
|
||||
if ( ensure_CCrequirements(EVAL_TOKENS) < 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(CC_REQUIREMENTS_MSG);
|
||||
|
||||
LOCK(cs_main);
|
||||
|
||||
@@ -7399,7 +7407,7 @@ UniValue tokencreate(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() > 4 || params.size() < 2 )
|
||||
throw runtime_error("tokencreate name supply [description][data]\n");
|
||||
if ( ensure_CCrequirements(EVAL_TOKENS) < 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(CC_REQUIREMENTS_MSG);
|
||||
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
@@ -7459,7 +7467,7 @@ UniValue tokentransfer(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3)
|
||||
throw runtime_error("tokentransfer tokenid destpubkey amount\n");
|
||||
if ( ensure_CCrequirements(EVAL_TOKENS) < 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(CC_REQUIREMENTS_MSG);
|
||||
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
@@ -7495,7 +7503,7 @@ UniValue tokenconvert(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 4 )
|
||||
throw runtime_error("tokenconvert evalcode tokenid pubkey amount\n");
|
||||
if ( ensure_CCrequirements(EVAL_ASSETS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
evalcode = atoi(params[0].get_str().c_str());
|
||||
@@ -7536,7 +7544,7 @@ UniValue tokenbid(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("tokenbid numtokens tokenid price\n");
|
||||
if (ensure_CCrequirements(EVAL_ASSETS) < 0 || ensure_CCrequirements(EVAL_TOKENS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
//numtokens = atoi(params[0].get_str().c_str());
|
||||
@@ -7578,7 +7586,7 @@ UniValue tokencancelbid(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("tokencancelbid tokenid bidtxid\n");
|
||||
if (ensure_CCrequirements(EVAL_ASSETS) < 0 || ensure_CCrequirements(EVAL_TOKENS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
tokenid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -7603,7 +7611,7 @@ UniValue tokenfillbid(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("tokenfillbid tokenid bidtxid fillamount\n");
|
||||
if (ensure_CCrequirements(EVAL_ASSETS) < 0 || ensure_CCrequirements(EVAL_TOKENS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
tokenid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -7635,7 +7643,7 @@ UniValue tokenask(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("tokenask numtokens tokenid price\n");
|
||||
if (ensure_CCrequirements(EVAL_ASSETS) < 0 || ensure_CCrequirements(EVAL_TOKENS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
//numtokens = atoi(params[0].get_str().c_str());
|
||||
@@ -7669,7 +7677,7 @@ UniValue tokenswapask(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 4 )
|
||||
throw runtime_error("tokenswapask numtokens tokenid otherid price\n");
|
||||
if ( ensure_CCrequirements(EVAL_ASSETS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
//numtokens = atoi(params[0].get_str().c_str());
|
||||
@@ -7697,7 +7705,7 @@ UniValue tokencancelask(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("tokencancelask tokenid asktxid\n");
|
||||
if (ensure_CCrequirements(EVAL_ASSETS) < 0 || ensure_CCrequirements(EVAL_TOKENS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
tokenid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -7722,7 +7730,7 @@ UniValue tokenfillask(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("tokenfillask tokenid asktxid fillunits\n");
|
||||
if (ensure_CCrequirements(EVAL_ASSETS) < 0 || ensure_CCrequirements(EVAL_TOKENS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
tokenid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -7762,7 +7770,7 @@ UniValue tokenfillswap(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 4 )
|
||||
throw runtime_error("tokenfillswap tokenid otherid asktxid fillunits\n");
|
||||
if ( ensure_CCrequirements(EVAL_ASSETS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
tokenid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -7843,7 +7851,7 @@ UniValue heirfund(const UniValue& params, bool fHelp)
|
||||
if (fHelp || params.size() != 6 && params.size() != 7)
|
||||
throw runtime_error("heirfund txfee funds heirname heirpubkey inactivitytime memo [tokenid]\n");
|
||||
if (ensure_CCrequirements(EVAL_HEIR) < 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(CC_REQUIREMENTS_MSG);
|
||||
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
@@ -7917,7 +7925,7 @@ UniValue heiradd(const UniValue& params, bool fHelp)
|
||||
if (fHelp || params.size() != 3)
|
||||
throw runtime_error("heiradd txfee funds fundingtxid\n");
|
||||
if (ensure_CCrequirements(EVAL_HEIR) < 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(CC_REQUIREMENTS_MSG);
|
||||
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
@@ -7951,7 +7959,7 @@ UniValue heirclaim(const UniValue& params, bool fHelp)
|
||||
if (fHelp || params.size() != 3)
|
||||
throw runtime_error("heirclaim txfee funds fundingtxid\n");
|
||||
if (ensure_CCrequirements(EVAL_HEIR) < 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(CC_REQUIREMENTS_MSG);
|
||||
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
@@ -7976,7 +7984,7 @@ UniValue heirinfo(const UniValue& params, bool fHelp)
|
||||
throw runtime_error("heirinfo fundingtxid\n");
|
||||
|
||||
// if ( ensure_CCrequirements(EVAL_HEIR) < 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(CC_REQUIREMENTS_MSG);
|
||||
|
||||
fundingtxid = Parseuint256((char*)params[0].get_str().c_str());
|
||||
return (HeirInfo(fundingtxid));
|
||||
@@ -7988,7 +7996,7 @@ UniValue heirlist(const UniValue& params, bool fHelp)
|
||||
throw runtime_error("heirlist\n");
|
||||
|
||||
// if ( ensure_CCrequirements(EVAL_HEIR) < 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(CC_REQUIREMENTS_MSG);
|
||||
|
||||
return (HeirList());
|
||||
}
|
||||
@@ -8001,7 +8009,7 @@ UniValue pegscreate(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size()<3)
|
||||
throw runtime_error("pegscreate amount N bindtxid1 [bindtxid2 ...]\n");
|
||||
if ( ensure_CCrequirements(EVAL_PEGS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
amount = atof((char *)params[0].get_str().c_str()) * COIN + 0.00000000499999;
|
||||
@@ -8031,7 +8039,7 @@ UniValue pegsfund(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size()!=3)
|
||||
throw runtime_error("pegsfund pegstxid tokenid amount\n");
|
||||
if ( ensure_CCrequirements(EVAL_PEGS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
pegstxid = Parseuint256(params[0].get_str().c_str());
|
||||
@@ -8054,7 +8062,7 @@ UniValue pegsget(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size()!=3)
|
||||
throw runtime_error("pegsget pegstxid tokenid amount\n");
|
||||
if ( ensure_CCrequirements(EVAL_PEGS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
pegstxid = Parseuint256(params[0].get_str().c_str());
|
||||
@@ -8077,7 +8085,7 @@ UniValue pegsredeem(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size()!=2)
|
||||
throw runtime_error("pegsredem pegstxid tokenid\n");
|
||||
if ( ensure_CCrequirements(EVAL_PEGS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
pegstxid = Parseuint256(params[0].get_str().c_str());
|
||||
@@ -8099,7 +8107,7 @@ UniValue pegsliquidate(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size()!=3)
|
||||
throw runtime_error("pegsliquidate pegstxid tokenid accounttxid\n");
|
||||
if ( ensure_CCrequirements(EVAL_PEGS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
pegstxid = Parseuint256(params[0].get_str().c_str());
|
||||
@@ -8122,7 +8130,7 @@ UniValue pegsexchange(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size()!=3)
|
||||
throw runtime_error("pegsliquidate pegstxid tokenid accounttxid\n");
|
||||
if ( ensure_CCrequirements(EVAL_PEGS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
pegstxid = Parseuint256(params[0].get_str().c_str());
|
||||
@@ -8145,7 +8153,7 @@ UniValue pegsaccounthistory(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("pegsaccounthistory pegstxid\n");
|
||||
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
pegstxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -8159,7 +8167,7 @@ UniValue pegsaccountinfo(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("pegsaccountinfo pegstxid\n");
|
||||
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
pegstxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -8173,7 +8181,7 @@ UniValue pegsworstaccounts(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("pegsworstaccounts pegstxid\n");
|
||||
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
pegstxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -8187,7 +8195,7 @@ UniValue pegsinfo(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("pegsinfo pegstxid\n");
|
||||
if ( ensure_CCrequirements(EVAL_GATEWAYS) < 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(CC_REQUIREMENTS_MSG);
|
||||
const CKeyStore& keystore = *pwalletMain;
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
pegstxid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
@@ -8317,7 +8325,7 @@ UniValue opreturn_burn(const UniValue& params, bool fHelp)
|
||||
struct CCcontract_info *cp, C; UniValue ret(UniValue::VOBJ);
|
||||
// this doesnt actually require EVAL_ORACLES and is just used as a dummy for CCFinalizeTx
|
||||
cp = CCinit(&C, EVAL_ORACLES);
|
||||
|
||||
|
||||
CAmount nAmount = AmountFromValue(params[0]);
|
||||
vHexStr = ParseHex(params[1].get_str());
|
||||
if ( vHexStr.size() == 0 )
|
||||
|
||||
Reference in New Issue
Block a user