Merge branch 'duke' into dev
This commit is contained in:
@@ -19,11 +19,6 @@
|
||||
#include "key_io.h"
|
||||
#include "CCinclude.h"
|
||||
|
||||
int32_t CClib_initcp(struct CCcontract_info *cp,uint8_t evalcode)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
struct CCcontract_info *CCinit(struct CCcontract_info *cp, uint8_t evalcode)
|
||||
{
|
||||
return(cp);
|
||||
|
||||
@@ -216,7 +216,6 @@ int32_t CCgetspenttxid(uint256 &spenttxid,int32_t &vini,int32_t &height,uint256
|
||||
|
||||
/// @private
|
||||
UniValue CClib(struct CCcontract_info *cp,char *method,char *jsonstr);
|
||||
UniValue CClib_info(struct CCcontract_info *cp);
|
||||
|
||||
static const uint256 zeroid; //!< null uint256 constant
|
||||
|
||||
@@ -430,67 +429,6 @@ void CCaddr3set(struct CCcontract_info *cp,uint8_t evalcode,CPubKey pk,uint8_t *
|
||||
/// @see GetCCaddress1of2
|
||||
void CCaddr1of2set(struct CCcontract_info *cp, CPubKey pk1, CPubKey pk2,uint8_t *priv,char *coinaddr);
|
||||
|
||||
/// Creates a token transaction output with a cryptocondition that allows to spend it by one key.
|
||||
/// The resulting vout will have two eval codes (EVAL_TOKENS and evalcode parameter value).
|
||||
/// The returned output should be added to a transaction vout array.
|
||||
/// @param evalcode cryptocondition eval code (transactions with this eval code in cc inputs will be forwarded to the contract associated with this eval code)
|
||||
/// @param nValue value of the output in satoshi
|
||||
/// @param pk pubkey to spend the cc
|
||||
/// @returns vout object
|
||||
/// @see CCinit
|
||||
/// @see CCcontract_info
|
||||
CTxOut MakeTokensCC1vout(uint8_t evalcode, CAmount nValue, CPubKey pk);
|
||||
|
||||
/// Another MakeTokensCC1vout overloaded function that creates a token transaction output with a cryptocondition with two eval codes that allows to spend it by one key.
|
||||
/// Resulting vout will have three eval codes (EVAL_TOKENS, evalcode and evalcode2 parameter values).
|
||||
/// The returned output should be added to a transaction vout array.
|
||||
/// @param evalcode cryptocondition eval code (transactions with this eval code in cc inputs will be forwarded to the contract associated with this eval code)
|
||||
/// @param evalcode2 yet another cryptocondition eval code (transactions with this eval code in cc inputs will be forwarded to the contract associated with this eval code)
|
||||
/// @param nValue value of the output in satoshi
|
||||
/// @param pk pubkey to spend the cc
|
||||
/// @returns vout object
|
||||
/// @see CCinit
|
||||
/// @see CCcontract_info
|
||||
CTxOut MakeTokensCC1vout(uint8_t evalcode, uint8_t evalcode2, CAmount nValue, CPubKey pk);
|
||||
|
||||
/// MakeTokensCC1of2vout creates a token transaction output with a 1of2 cryptocondition that allows to spend it by either of two keys.
|
||||
/// The resulting vout will have two eval codes (EVAL_TOKENS and evalcode parameter value).
|
||||
/// The returned output should be added to a transaction vout array.
|
||||
/// @param evalcode cryptocondition eval code (transactions with this eval code in cc inputs will be forwarded to the contract associated with this eval code)
|
||||
/// @param nValue value of the output in satoshi
|
||||
/// @param pk1 one of two pubkeys to spend the cc
|
||||
/// @param pk2 second of two pubkeys to spend the cc
|
||||
/// @returns vout object
|
||||
/// @see CCinit
|
||||
/// @see CCcontract_info
|
||||
CTxOut MakeTokensCC1of2vout(uint8_t evalcode, CAmount nValue, CPubKey pk1, CPubKey pk2);
|
||||
|
||||
/// Another overload of MakeTokensCC1of2vout creates a token transaction output with a 1of2 cryptocondition with two eval codes that allows to spend it by either of two keys.
|
||||
/// The resulting vout will have three eval codes (EVAL_TOKENS, evalcode and evalcode2 parameter values).
|
||||
/// The returned output should be added to a transaction vout array.
|
||||
/// @param evalcode cryptocondition eval code (transactions with this eval code in cc inputs will be forwarded to the contract associated with this eval code)
|
||||
/// @param evalcode2 yet another cryptocondition eval code (transactions with this eval code in cc inputs will be forwarded to the contract associated with this eval code)
|
||||
/// @param nValue value of the output in satoshi
|
||||
/// @param pk1 one of two pubkeys to spend the cc
|
||||
/// @param pk2 second of two pubkeys to spend the cc
|
||||
/// @returns vout object
|
||||
/// @see CCinit
|
||||
/// @see CCcontract_info
|
||||
CTxOut MakeTokensCC1of2vout(uint8_t evalcode, uint8_t evalcode2, CAmount nValue, CPubKey pk1, CPubKey pk2);
|
||||
|
||||
/// Gets adddress for token cryptocondition vout
|
||||
/// @param cp CCcontract_info structure initialized with EVAL_TOKENS eval code
|
||||
/// @param[out] destaddr retrieved address
|
||||
/// @param pk public key to create the cryptocondition
|
||||
bool GetTokensCCaddress(struct CCcontract_info *cp, char *destaddr, CPubKey pk);
|
||||
|
||||
/// Gets adddress for token 1of2 cc vout
|
||||
/// @param cp CCcontract_info structure initialized with EVAL_TOKENS eval code
|
||||
/// @param[out] destaddr retrieved address
|
||||
/// @param pk first public key to create the cryptocondition
|
||||
/// @param pk2 second public key to create the cryptocondition
|
||||
bool GetTokensCCaddress1of2(struct CCcontract_info *cp, char *destaddr, CPubKey pk, CPubKey pk2);
|
||||
|
||||
/// CCaddrTokens1of2set sets pubkeys, private key and cc addr for spending from 1of2 token cryptocondition vout
|
||||
/// @param cp contract info structure where the private key is set
|
||||
/// @param pk1 one of the two public keys of the 1of2 cc
|
||||
@@ -501,9 +439,6 @@ bool GetTokensCCaddress1of2(struct CCcontract_info *cp, char *destaddr, CPubKey
|
||||
/// @see CCcontract_info
|
||||
void CCaddrTokens1of2set(struct CCcontract_info *cp, CPubKey pk1, CPubKey pk2, uint8_t *priv, char *coinaddr);
|
||||
|
||||
/// @private
|
||||
int32_t CClib_initcp(struct CCcontract_info *cp,uint8_t evalcode);
|
||||
|
||||
/// IsCCInput checks if scriptSig object contains a cryptocondition
|
||||
/// @param scriptSig scriptSig object with a cryptocondition
|
||||
/// @returns true if the scriptSig object contains a cryptocondition
|
||||
|
||||
@@ -456,6 +456,4 @@ int64_t TotalPubkeyCCInputs(const CTransaction &tx, const CPubKey &pubkey)
|
||||
return total;
|
||||
}
|
||||
|
||||
extern struct CCcontract_info CCinfos[0x100];
|
||||
extern std::string MYCCLIBNAME;
|
||||
bool CClib_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const CTransaction tx,unsigned int nIn);
|
||||
|
||||
@@ -40,70 +40,6 @@ extern std::string MYCCLIBNAME;
|
||||
|
||||
char *CClib_name() { return((char *)MYCCLIBNAME.c_str()); }
|
||||
|
||||
struct CClib_rpcinfo
|
||||
{
|
||||
char *CCname,*method,*help;
|
||||
int32_t numrequiredargs,maxargs;
|
||||
uint8_t funcid,evalcode;
|
||||
}
|
||||
|
||||
CClib_methods[] =
|
||||
{
|
||||
{ (char *)"faucet2", (char *)"fund", (char *)"amount", 1, 1, 'F', EVAL_FAUCET2 },
|
||||
{ (char *)"faucet2", (char *)"get", (char *)"<no args>", 0, 0, 'G', EVAL_FAUCET2 },
|
||||
#ifdef BUILD_CUSTOMCC
|
||||
RPC_FUNCS
|
||||
#endif
|
||||
};
|
||||
|
||||
std::string CClib_rawtxgen(struct CCcontract_info *cp,uint8_t funcid,cJSON *params);
|
||||
|
||||
cJSON *cclib_reparse(int32_t *nump,char *jsonstr) // assumes origparams will be freed by caller
|
||||
{
|
||||
cJSON *params; char *newstr; int32_t i,j;
|
||||
*nump = 0;
|
||||
if ( jsonstr != 0 )
|
||||
{
|
||||
if ( jsonstr[0] == '"' && jsonstr[strlen(jsonstr)-1] == '"' )
|
||||
{
|
||||
jsonstr[strlen(jsonstr)-1] = 0;
|
||||
jsonstr++;
|
||||
}
|
||||
newstr = (char *)malloc(strlen(jsonstr)+1);
|
||||
for (i=j=0; jsonstr[i]!=0; i++)
|
||||
{
|
||||
if ( jsonstr[i] == '%' && jsonstr[i+1] == '2' && jsonstr[i+2] == '2' )
|
||||
{
|
||||
newstr[j++] = '"';
|
||||
i += 2;
|
||||
}
|
||||
else if ( jsonstr[i] == '\'' )
|
||||
newstr[j++] = '"';
|
||||
else newstr[j++] = jsonstr[i];
|
||||
}
|
||||
newstr[j] = 0;
|
||||
params = cJSON_Parse(newstr);
|
||||
if ( 0 && params != 0 )
|
||||
printf("new.(%s) -> %s\n",newstr,jprint(params,0));
|
||||
free(newstr);
|
||||
*nump = cJSON_GetArraySize(params);
|
||||
//free(origparams);
|
||||
} else params = 0;
|
||||
return(params);
|
||||
}
|
||||
|
||||
UniValue CClib_method(struct CCcontract_info *cp,char *method,char *jsonstr)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ);
|
||||
return(result);
|
||||
}
|
||||
|
||||
UniValue CClib_info(struct CCcontract_info *cp)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ);
|
||||
return(result);
|
||||
}
|
||||
|
||||
UniValue CClib(struct CCcontract_info *cp,char *method,char *jsonstr)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ);
|
||||
@@ -120,11 +56,6 @@ bool CClibExactAmounts(struct CCcontract_info *cp,Eval* eval,const CTransaction
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CClib_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const CTransaction tx,unsigned int nIn)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int64_t AddCClibInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey pk,int64_t total,int32_t maxinputs,char *cmpaddr,int32_t CCflag)
|
||||
{
|
||||
return 0;
|
||||
@@ -135,21 +66,6 @@ int64_t AddCClibtxfee(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKe
|
||||
return(0);
|
||||
}
|
||||
|
||||
std::string Faucet2Fund(struct CCcontract_info *cp,uint64_t txfee,int64_t funds)
|
||||
{
|
||||
return("");
|
||||
}
|
||||
|
||||
std::string CClib_rawtxgen(struct CCcontract_info *cp,uint8_t funcid,cJSON *params)
|
||||
{
|
||||
return("");
|
||||
}
|
||||
|
||||
UniValue cclib_error(UniValue &result,const char *errorstr)
|
||||
{
|
||||
return(result);
|
||||
}
|
||||
|
||||
uint256 juint256(cJSON *obj)
|
||||
{
|
||||
uint256 tmp; bits256 t = jbits256(obj,0);
|
||||
@@ -157,11 +73,6 @@ uint256 juint256(cJSON *obj)
|
||||
return(revuint256(tmp));
|
||||
}
|
||||
|
||||
int32_t cclib_parsehash(uint8_t *hash32,cJSON *item,int32_t len)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
#if BUILD_CUSTOMCC
|
||||
#include "customcc.cpp"
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
char *CClib_name();
|
||||
|
||||
Eval* EVAL_TEST = 0;
|
||||
struct CCcontract_info CCinfos[0x100];
|
||||
extern pthread_mutex_t HUSH_CC_mutex;
|
||||
|
||||
|
||||
|
||||
@@ -5311,7 +5311,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
}
|
||||
txsize += CTXOUT_REGULAR_SIZE * taddrRecipients.size();
|
||||
if (txsize > max_tx_size) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Too many outputs, size of raw transaction would be larger than limit of %d bytes", max_tx_size ));
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Size of raw transaction %d would be larger than limit of %d bytes", txsize, max_tx_size ));
|
||||
}
|
||||
|
||||
// Minimum confirmations
|
||||
|
||||
@@ -2790,7 +2790,7 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
|
||||
// This should never fail: we should always be able to get the tree
|
||||
// state on the path to the tip of our chain
|
||||
if (pindex->pprev) {
|
||||
const bool sapling = true;
|
||||
const bool sapling = pindex->GetHeight() >= 2 ? true : false;
|
||||
if (sapling) { // NetworkUpgradeActive(pindex->pprev->GetHeight(), Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
|
||||
assert(pcoinsTip->GetSaplingAnchorAt(pindex->pprev->hashFinalSaplingRoot, saplingTree));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user