myGettxout

This commit is contained in:
jl777
2018-08-02 00:04:29 -11:00
parent b0a85aec3f
commit 1f9a4106c5
3 changed files with 16 additions and 1 deletions

View File

@@ -53,6 +53,7 @@ static const uint256 zeroid;
bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock);
int32_t is_hexstr(char *str,int32_t n);
bool myAddtomempool(CTransaction &tx);
uint64_t myGettxout(uint256 hash,int32_t n);
// CCcustom
CPubKey GetUnspendable(struct CCcontract_info *cp,uint8_t *unspendablepriv);

View File

@@ -220,7 +220,8 @@ uint64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,uint64_t total,in
break;
if ( j != mtx.vin.size() )
continue;
if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.IsCoinBase() == 0 )
if ( myGettxout(txid,vout) == out.tx->vout[out.i].nValue )
//if ( GetTransaction(txid,tx,hashBlock,false) != 0 && tx.IsCoinBase() == 0 )
{
mtx.vin.push_back(CTxIn(txid,vout,CScript()));
nValue = out.tx->vout[out.i].nValue;

View File

@@ -1603,6 +1603,19 @@ bool GetAddressUnspent(uint160 addressHash, int type,
return true;
}
uint64_t myGettxout(uint256 hash,int32_t n)
{
CCoins coins;
LOCK(cs_main);
LOCK(mempool.cs);
CCoinsViewMemPool view(pcoinsTip, mempool);
if (!view.GetCoins(hash, coins))
return(0);
if ( n<0 || (unsigned int)n>=coins.vout.size() || coins.vout[n].IsNull() )
return(0);
else return(coins.vout[n].nValue);
}
bool myAddtomempool(CTransaction &tx)
{
CValidationState state; CTransaction Ltx; bool fMissingInputs,fOverrideFees = false;