This commit is contained in:
jl777
2018-04-07 22:46:38 +03:00
parent c6e53b1ad3
commit eb6c7bb831
3 changed files with 12 additions and 16 deletions

View File

@@ -988,15 +988,3 @@ int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_
return(0);
}
void komodo_listunspent();
int32_t komodo_staked(uint256 *utxotxidp,int32_t *utxovoutp,uint64_t *utxovaluep,uint8_t *utxosig)
{
*utxovaluep = 0;
memset(utxotxidp,0,sizeof(*utxotxidp));
memset(utxovoutp,0,sizeof(*utxovoutp));
memset(utxosig,0,72);
komodo_listunspent();
return(72);
}

View File

@@ -120,7 +120,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *symbol,int32_t
int32_t komodo_isrealtime(int32_t *kmdheightp);
int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_t nTime,int32_t dispflag);
uint64_t komodo_commission(const CBlock &block);
int32_t komodo_staked(uint256 *utxotxidp,int32_t *utxovoutp,uint64_t *utxovaluep,uint8_t *utxosig);
int32_t komodo_staked(uint32_t *txtimep,uint256 *utxotxidp,int32_t *utxovoutp,uint64_t *utxovaluep,uint8_t *utxosig);
CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
{
@@ -387,8 +387,8 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
LogPrintf("CreateNewBlock(): total size %u\n", nBlockSize);
if ( ASSETCHAINS_SYMBOL[0] != 0 && ASSETCHAINS_STAKED != 0 && NOTARY_PUBKEY33[0] != 0 )
{
uint64_t txfees,utxovalue; uint256 utxotxid; int32_t i,siglen,numsigs,utxovout; uint8_t utxosig[128],*ptr;
if ( (siglen= komodo_staked(&utxotxid,&utxovout,&utxovalue,utxosig)) > 0 )
uint64_t txfees,utxovalue; uint32_t txtime; uint256 utxotxid; int32_t i,siglen,numsigs,utxovout; uint8_t utxosig[128],*ptr;
if ( (siglen= komodo_staked(&txtime,&utxotxid,&utxovout,&utxovalue,utxosig)) > 0 )
{
CMutableTransaction txStaked = CreateNewContextualCMutableTransaction(chainparams.GetConsensus(), nHeight);
CAmount txfees = 10000;

View File

@@ -2691,11 +2691,15 @@ UniValue listunspent(const UniValue& params, bool fHelp)
return results;
}
void komodo_listunspent()
int32_t komodo_staked(uint32_t *txtimep,uint256 *utxotxidp,int32_t *utxovoutp,uint64_t *utxovaluep,uint8_t *utxosig)
{
set<CBitcoinAddress> setAddress; int32_t nMinDepth = 1,nMaxDepth = 9999999; vector<COutput> vecOutputs;
assert(pwalletMain != NULL);
LOCK2(cs_main, pwalletMain->cs_wallet);
*utxovaluep = 0;
memset(utxotxidp,0,sizeof(*utxotxidp));
memset(utxovoutp,0,sizeof(*utxovoutp));
memset(utxosig,0,72);
pwalletMain->AvailableCoins(vecOutputs, false, NULL, true);
BOOST_FOREACH(const COutput& out, vecOutputs)
{
@@ -2712,6 +2716,10 @@ void komodo_listunspent()
CAmount nValue = out.tx->vout[out.i].nValue;
const CScript& pk = out.tx->vout[out.i].scriptPubKey;
//entry.push_back(Pair("generated", out.tx->IsCoinBase()));
*utxovaluep = (uint64_t)nValue;
decode_hex(utxotxidp,32,out.tx->GetHash().GetHex().c_str());
*utxovoutp = out.i;
*txtimep = (uint32_t)out.tx->nLockTime;
CTxDestination address;
if (ExtractDestination(out.tx->vout[out.i].scriptPubKey, address))
{