Browse Source

Add pause if scriptcheckqueue isn't idle

metaverse
jl777 6 years ago
parent
commit
c66eb36d51
  1. 2
      src/cc/CCassets.h
  2. 8
      src/cc/CCassetstx.cpp
  3. 8
      src/main.cpp
  4. 2
      src/rpcserver.cpp
  5. 2
      src/rpcserver.h
  6. 21
      src/wallet/rpcwallet.cpp

2
src/cc/CCassets.h

@ -50,6 +50,8 @@ bool AssetExactAmounts(struct CCcontract_info *cp,int64_t &inputs,int32_t starti
int64_t GetAssetBalance(CPubKey pk,uint256 tokenid);
int64_t AddAssetInputs(CMutableTransaction &mtx,CPubKey pk,uint256 assetid,int64_t total,int32_t maxinputs);
UniValue AssetOrders(uint256 tokenid);
UniValue AssetInfo(uint256 tokenid);
UniValue AssetList();
std::string CreateAsset(int64_t txfee,int64_t assetsupply,std::string name,std::string description);
std::string AssetTransfer(int64_t txfee,uint256 assetid,std::vector<uint8_t> destpubkey,int64_t total);
std::string CreateBuyOffer(int64_t txfee,int64_t bidamount,uint256 assetid,int64_t pricetotal);

8
src/cc/CCassetstx.cpp

@ -57,6 +57,14 @@ int64_t GetAssetBalance(CPubKey pk,uint256 tokenid)
return(AddAssetInputs(cp,mtx,pk,tokenid,0,0));
}
UniValue AssetList(uint256 refassetid)
{
}
UniValue AssetInfo()
{
}
UniValue AssetOrders(uint256 refassetid)
{
static uint256 zero;

8
src/main.cpp

@ -2825,6 +2825,14 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
CBlockUndo blockundo;
if ( ASSETCHAINS_CC != 0 )
{
if ( pqueue->IsIdle() == 0 )
{
fprintf(stderr,"scriptcheckqueue isnt idle\n");
sleep(1);
}
}
CCheckQueueControl<CScriptCheck> control(fExpensiveChecks && nScriptCheckThreads ? &scriptcheckqueue : NULL);
int64_t nTimeStart = GetTimeMicros();

2
src/rpcserver.cpp

@ -371,6 +371,8 @@ static const CRPCCommand vRPCCommands[] =
{ "dice", "diceaddress", &diceaddress, true },
/* tokens */
{ "tokens", "tokeninfo", &tokeninfo, true },
{ "tokens", "tokenlist", &tokenlist, true },
{ "tokens", "tokenorders", &tokenorders, true },
{ "tokens", "tokenaddress", &tokenaddress, true },
{ "tokens", "tokenbalance", &tokenbalance, true },

2
src/rpcserver.h

@ -208,6 +208,8 @@ extern UniValue submitblock(const UniValue& params, bool fHelp);
extern UniValue estimatefee(const UniValue& params, bool fHelp);
extern UniValue estimatepriority(const UniValue& params, bool fHelp);
extern UniValue coinsupply(const UniValue& params, bool fHelp);
extern UniValue tokeninfo(const UniValue& params, bool fHelp);
extern UniValue tokenlist(const UniValue& params, bool fHelp);
extern UniValue tokenorders(const UniValue& params, bool fHelp);
extern UniValue tokenbalance(const UniValue& params, bool fHelp);
extern UniValue tokenaddress(const UniValue& params, bool fHelp);

21
src/wallet/rpcwallet.cpp

@ -5122,6 +5122,27 @@ UniValue dicebet(const UniValue& params, bool fHelp)
return(result);
}
UniValue tokenlist(const UniValue& params, bool fHelp)
{
uint256 tokenid;
if ( fHelp || params.size() > 0 )
throw runtime_error("tokenlist\n");
if ( ensure_CCrequirements() < 0 )
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
return(AssetList());
}
UniValue tokeninfo(const UniValue& params, bool fHelp)
{
uint256 tokenid;
if ( fHelp || params.size() != 1 )
throw runtime_error("tokeninfo tokenid\n");
if ( ensure_CCrequirements() < 0 )
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
tokenid = Parseuint256((char *)params[0].get_str().c_str());
return(AssetInfo(tokenid));
}
UniValue tokenorders(const UniValue& params, bool fHelp)
{
uint256 tokenid;

Loading…
Cancel
Save