Delete more CCs #381
This commit is contained in:
@@ -622,43 +622,9 @@ CPubKey pubkey2pk(std::vector<uint8_t> vpubkey);
|
|||||||
/// @param tokenid id of token (id of token creation tx)
|
/// @param tokenid id of token (id of token creation tx)
|
||||||
int64_t CCfullsupply(uint256 tokenid);
|
int64_t CCfullsupply(uint256 tokenid);
|
||||||
|
|
||||||
/// CCtoken_balance returns token balance for an address
|
|
||||||
/// @param destaddr address to search the balance on
|
|
||||||
/// @param tokenid id of the token
|
|
||||||
int64_t CCtoken_balance(char *destaddr,uint256 tokenid);
|
|
||||||
|
|
||||||
/// @private
|
|
||||||
int64_t CCtoken_balance2(char *destaddr,uint256 tokenid);
|
|
||||||
|
|
||||||
/// _GetCCaddress retrieves the address for the scriptPubKey for the cryptocondition that is made for eval code and public key
|
|
||||||
/// @param[out] destaddr the address for the cc scriptPubKey. Should have at least 64 char buffer space
|
|
||||||
/// @param evalcode eval code for which cryptocondition will be made
|
|
||||||
/// @param pk pubkey for which cryptocondition will be made
|
|
||||||
bool _GetCCaddress(char *destaddr,uint8_t evalcode,CPubKey pk);
|
|
||||||
|
|
||||||
/// GetCCaddress retrieves the address for the scriptPubKey for the cryptocondition that is made for eval code and public key.
|
|
||||||
/// The evalcode is taken from the cp object
|
|
||||||
/// @param cp object of CCcontract_info type
|
|
||||||
/// @param[out] destaddr the address for the cc scriptPubKey. Should have at least 64 char buffer space
|
|
||||||
/// @param pk pubkey for which cryptocondition will be made
|
|
||||||
/// @see CCcontract_info
|
|
||||||
bool GetCCaddress(struct CCcontract_info *cp,char *destaddr,CPubKey pk);
|
|
||||||
|
|
||||||
/// GetCCaddress1of2 retrieves the address for the scriptPubKey for the 1of2 cryptocondition that is made for eval code and two public keys.
|
|
||||||
/// The evalcode is taken from the cp object
|
|
||||||
/// @param cp object of CCcontract_info type
|
|
||||||
/// @param[out] destaddr the address for the cc scriptPubKey. Should have at least 64 char buffer space
|
|
||||||
/// @param pk first pubkey 1of2 cryptocondition
|
|
||||||
/// @param pk2 second pubkey of 1of2 cryptocondition
|
|
||||||
/// @see CCcontract_info
|
|
||||||
bool GetCCaddress1of2(struct CCcontract_info *cp,char *destaddr,CPubKey pk,CPubKey pk2);
|
|
||||||
|
|
||||||
/// @private
|
/// @private
|
||||||
bool ConstrainVout(CTxOut vout,int32_t CCflag,char *cmpaddr,int64_t nValue);
|
bool ConstrainVout(CTxOut vout,int32_t CCflag,char *cmpaddr,int64_t nValue);
|
||||||
|
|
||||||
/// @private
|
|
||||||
bool PreventCC(Eval* eval,const CTransaction &tx,int32_t preventCCvins,int32_t numvins,int32_t preventCCvouts,int32_t numvouts);
|
|
||||||
|
|
||||||
/// Returns bitcoin address for the scriptPubKey parameter
|
/// Returns bitcoin address for the scriptPubKey parameter
|
||||||
/// @param[out] destaddr the returned address of the scriptPubKey, the buffer should have size of at least 64 chars
|
/// @param[out] destaddr the returned address of the scriptPubKey, the buffer should have size of at least 64 chars
|
||||||
/// @param scriptPubKey scriptPubKey object
|
/// @param scriptPubKey scriptPubKey object
|
||||||
|
|||||||
@@ -160,48 +160,6 @@ bool GetCustomscriptaddress(char *destaddr,const CScript &scriptPubKey,uint8_t t
|
|||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetCCParams(Eval* eval, const CTransaction &tx, uint32_t nIn,
|
|
||||||
CTransaction &txOut, std::vector<std::vector<unsigned char>> &preConditions, std::vector<std::vector<unsigned char>> ¶ms)
|
|
||||||
{
|
|
||||||
uint256 blockHash;
|
|
||||||
|
|
||||||
if (myGetTransaction(tx.vin[nIn].prevout.hash, txOut, blockHash) && txOut.vout.size() > tx.vin[nIn].prevout.n)
|
|
||||||
{
|
|
||||||
CBlockIndex index;
|
|
||||||
if (eval->GetBlock(blockHash, index))
|
|
||||||
{
|
|
||||||
// read preconditions
|
|
||||||
CScript subScript = CScript();
|
|
||||||
preConditions.clear();
|
|
||||||
if (txOut.vout[tx.vin[nIn].prevout.n].scriptPubKey.IsPayToCryptoCondition(&subScript, preConditions))
|
|
||||||
{
|
|
||||||
// read any available parameters in the output transaction
|
|
||||||
params.clear();
|
|
||||||
if (tx.vout.size() > 0 && tx.vout[tx.vout.size() - 1].scriptPubKey.IsOpReturn())
|
|
||||||
{
|
|
||||||
if (tx.vout[tx.vout.size() - 1].scriptPubKey.GetOpretData(params) && params.size() == 1)
|
|
||||||
{
|
|
||||||
CScript scr = CScript(params[0].begin(), params[0].end());
|
|
||||||
|
|
||||||
// printf("Script decoding inner:\n%s\nouter:\n%s\n", scr.ToString().c_str(), tx.vout[tx.vout.size() - 1].scriptPubKey.ToString().c_str());
|
|
||||||
|
|
||||||
if (!scr.GetPushedData(scr.begin(), params))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else return true;
|
|
||||||
}
|
|
||||||
else return false;
|
|
||||||
}
|
|
||||||
else return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
//fprintf(stderr,"ExtractDestination failed\n");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pubkey2addr(char *destaddr,uint8_t *pubkey33)
|
bool pubkey2addr(char *destaddr,uint8_t *pubkey33)
|
||||||
{
|
{
|
||||||
std::vector<uint8_t>pk; int32_t i;
|
std::vector<uint8_t>pk; int32_t i;
|
||||||
@@ -210,58 +168,6 @@ bool pubkey2addr(char *destaddr,uint8_t *pubkey33)
|
|||||||
return(Getscriptaddress(destaddr,CScript() << pk << OP_CHECKSIG));
|
return(Getscriptaddress(destaddr,CScript() << pk << OP_CHECKSIG));
|
||||||
}
|
}
|
||||||
|
|
||||||
CPubKey CCtxidaddr(char *txidaddr,uint256 txid)
|
|
||||||
{
|
|
||||||
uint8_t buf33[33]; CPubKey pk;
|
|
||||||
buf33[0] = 0x02;
|
|
||||||
endiancpy(&buf33[1],(uint8_t *)&txid,32);
|
|
||||||
pk = buf2pk(buf33);
|
|
||||||
Getscriptaddress(txidaddr,CScript() << ParseHex(HexStr(pk)) << OP_CHECKSIG);
|
|
||||||
return(pk);
|
|
||||||
}
|
|
||||||
|
|
||||||
CPubKey CCCustomtxidaddr(char *txidaddr,uint256 txid,uint8_t taddr,uint8_t prefix,uint8_t prefix2)
|
|
||||||
{
|
|
||||||
uint8_t buf33[33]; CPubKey pk;
|
|
||||||
buf33[0] = 0x02;
|
|
||||||
endiancpy(&buf33[1],(uint8_t *)&txid,32);
|
|
||||||
pk = buf2pk(buf33);
|
|
||||||
GetCustomscriptaddress(txidaddr,CScript() << ParseHex(HexStr(pk)) << OP_CHECKSIG,taddr,prefix,prefix2);
|
|
||||||
return(pk);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool _GetCCaddress(char *destaddr,uint8_t evalcode,CPubKey pk)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetCCaddress(struct CCcontract_info *cp,char *destaddr,CPubKey pk)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool _GetTokensCCaddress(char *destaddr, uint8_t evalcode, uint8_t evalcode2, CPubKey pk)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get scriptPubKey adddress for three/dual eval token cc vout
|
|
||||||
bool GetTokensCCaddress(struct CCcontract_info *cp, char *destaddr, CPubKey pk)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool GetCCaddress1of2(struct CCcontract_info *cp,char *destaddr,CPubKey pk,CPubKey pk2)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetTokensCCaddress1of2(struct CCcontract_info *cp, char *destaddr, CPubKey pk, CPubKey pk2)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ConstrainVout(CTxOut vout, int32_t CCflag, char *cmpaddr, int64_t nValue)
|
bool ConstrainVout(CTxOut vout, int32_t CCflag, char *cmpaddr, int64_t nValue)
|
||||||
{
|
{
|
||||||
char destaddr[64];
|
char destaddr[64];
|
||||||
@@ -283,31 +189,6 @@ bool ConstrainVout(CTxOut vout, int32_t CCflag, char *cmpaddr, int64_t nValue)
|
|||||||
else return(true);
|
else return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PreventCC(Eval* eval,const CTransaction &tx,int32_t preventCCvins,int32_t numvins,int32_t preventCCvouts,int32_t numvouts)
|
|
||||||
{
|
|
||||||
int32_t i;
|
|
||||||
if ( preventCCvins >= 0 )
|
|
||||||
{
|
|
||||||
for (i=preventCCvins; i<numvins; i++)
|
|
||||||
{
|
|
||||||
if ( IsCCInput(tx.vin[i].scriptSig) != 0 )
|
|
||||||
return eval->Invalid("invalid CC vin");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( preventCCvouts >= 0 )
|
|
||||||
{
|
|
||||||
for (i=preventCCvouts; i<numvouts; i++)
|
|
||||||
{
|
|
||||||
if ( tx.vout[i].scriptPubKey.IsPayToCryptoCondition() != 0 )
|
|
||||||
{
|
|
||||||
fprintf(stderr,"vout.%d is CC\n",i);
|
|
||||||
return eval->Invalid("invalid CC vout");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool priv2addr(char *coinaddr,uint8_t *buf33,uint8_t priv32[32])
|
bool priv2addr(char *coinaddr,uint8_t *buf33,uint8_t priv32[32])
|
||||||
{
|
{
|
||||||
CKey priv; CPubKey pk; int32_t i; uint8_t *src;
|
CKey priv; CPubKey pk; int32_t i; uint8_t *src;
|
||||||
|
|||||||
Reference in New Issue
Block a user