Filter addassetinputs with signable addresses

This commit is contained in:
jl777
2018-09-11 22:14:18 -11:00
parent ae5efde754
commit 019206ff84
3 changed files with 7 additions and 2 deletions

View File

@@ -17,10 +17,11 @@
int64_t AddAssetInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey pk,uint256 assetid,int64_t total,int32_t maxinputs) int64_t AddAssetInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey pk,uint256 assetid,int64_t total,int32_t maxinputs)
{ {
char coinaddr[64]; int64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t j,vout,n = 0; char coinaddr[64],destaddr[64]; int64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t j,vout,n = 0;
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs; std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
GetCCaddress(cp,coinaddr,pk); GetCCaddress(cp,coinaddr,pk);
SetCCunspents(unspentOutputs,coinaddr); SetCCunspents(unspentOutputs,coinaddr);
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++) for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
{ {
txid = it->first.txhash; txid = it->first.txhash;
@@ -32,6 +33,9 @@ int64_t AddAssetInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubK
continue; continue;
if ( GetTransaction(txid,vintx,hashBlock,false) != 0 ) if ( GetTransaction(txid,vintx,hashBlock,false) != 0 )
{ {
Getscriptaddress(destaddr,vintx.vout[vout].scriptPubKey);
if ( strcmp(destaddr,coinaddr) != 0 && strcmp(destaddr,cp->unspendableCCaddr) != 0 && strmp(destaddr,cp->unspendableaddr2) != 0 )
continue;
if ( (nValue= IsAssetvout(price,origpubkey,vintx,vout,assetid)) > 0 && myIsutxo_spentinmempool(txid,vout) == 0 ) if ( (nValue= IsAssetvout(price,origpubkey,vintx,vout,assetid)) > 0 && myIsutxo_spentinmempool(txid,vout) == 0 )
{ {
if ( total != 0 && maxinputs != 0 ) if ( total != 0 && maxinputs != 0 )

View File

@@ -339,6 +339,7 @@ bool ProcessCC(struct CCcontract_info *cp,Eval* eval, std::vector<uint8_t> param
//if ( txid == cp->prevtxid ) //if ( txid == cp->prevtxid )
// return(true); // return(true);
//fprintf(stderr,"process CC %02x\n",cp->evalcode); //fprintf(stderr,"process CC %02x\n",cp->evalcode);
cp->unspendableaddr2[0] = 0;
if ( paramsNull.size() != 0 ) // Don't expect params if ( paramsNull.size() != 0 ) // Don't expect params
return eval->Invalid("Cannot have params"); return eval->Invalid("Cannot have params");
else if ( ctx.vout.size() == 0 ) else if ( ctx.vout.size() == 0 )

View File

@@ -17,10 +17,10 @@
/* /*
prevent duplicate bindtxid and cointxid via mempool scan prevent duplicate bindtxid and cointxid via mempool scan
baton from mempool for oracle
assets vin selector needs to filter by signable vins assets vin selector needs to filter by signable vins
loop on merkle oracle
string oracles string oracles
*/ */