diff --git a/src/cc/CCinclude.h b/src/cc/CCinclude.h index fa4ea7960..a1e433fdd 100644 --- a/src/cc/CCinclude.h +++ b/src/cc/CCinclude.h @@ -101,7 +101,7 @@ bool GetAddressUnspent(uint160 addressHash, int type,std::vectorGetHeight()+1,chainActive.LastTip()->GetMedianTimePast() + 777,0) < 0 ) { @@ -1579,6 +1571,14 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa return state.DoS(0, false, REJECT_NONSTANDARD, "non-final"); } + // if this is a valid stake transaction, don't put it in the mempool + CStakeParams p; + if (ValidateStakeTransaction(tx, p, false)) + { + return state.DoS(0, error("AcceptToMemoryPool: attempt to add staking transaction to the mempool"), + REJECT_INVALID, "staking"); + } + // is it already in the memory pool? uint256 hash = tx.GetHash(); if (pool.exists(hash)) @@ -1891,9 +1891,12 @@ bool GetAddressUnspent(uint160 addressHash, int type, else return(coins.vout[n].nValue); }*/ -bool myAddtomempool(CTransaction &tx) +bool myAddtomempool(CTransaction &tx, CValidationState *pstate) { - CValidationState state; CTransaction Ltx; bool fMissingInputs,fOverrideFees = false; + CValidationState state; + if (!pstate) + pstate = &state; + CTransaction Ltx; bool fMissingInputs,fOverrideFees = false; if ( mempool.lookup(tx.GetHash(),Ltx) == 0 ) return(AcceptToMemoryPool(mempool, state, tx, false, &fMissingInputs, !fOverrideFees)); else return(true); @@ -4541,18 +4544,27 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C // Check transactions if ( ASSETCHAINS_CC != 0 ) // CC contracts might refer to transactions in the current block, from a CC spend within the same block and out of order { - CValidationState stateDummy; int32_t i,j,rejects=0,lastrejects=0; + int32_t i,j,rejects=0,lastrejects=0; //fprintf(stderr,"put block's tx into mempool\n"); while ( 1 ) { for (i=0; iGetHeight()+1, block.vtx[0].vin[0].nSequence, block.vtx[0].vin[0].scriptSig.ToString().c_str()); bool fAccepted = ProcessNewBlock(1,chainActive.LastTip()->GetHeight()+1,state, NULL, &block, true, NULL); UnregisterValidationInterface(&sc); if (fBlockPresent) diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 0c227dd21..c8f500ca7 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -731,7 +731,7 @@ UniValue CRPCTable::execute(const std::string &strMethod, const UniValue ¶ms throw JSONRPCError(RPC_IN_WARMUP, rpcWarmupStatus); } - // printf("RPC call: %s\n", strMethod.c_str()); + //printf("RPC call: %s\n", strMethod.c_str()); // Find method const CRPCCommand *pcmd = tableRPC[strMethod]; diff --git a/src/util.cpp b/src/util.cpp index 9a8391f63..753f52ae4 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -554,11 +554,17 @@ static boost::filesystem::path ZC_GetBaseParamsDir() // Windows >= Vista: C:\Users\Username\AppData\Roaming\ZcashParams // Mac: ~/Library/Application Support/ZcashParams // Unix: ~/.zcash-params + fs::path pathRet; #ifdef _WIN32 // Windows + if (mapArgs.count("-zcashparamsdir")) { + pathRet = fs::system_complete(mapArgs["-zcashparamsdir"]); + if (fs::is_directory(pathRet)) { + return pathRet; + } + } return GetSpecialFolderPath(CSIDL_APPDATA) / "ZcashParams"; #else - fs::path pathRet; char* pszHome = getenv("HOME"); if (pszHome == NULL || strlen(pszHome) == 0) pathRet = fs::path("/"); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index a66e192d9..99d77fe27 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -6735,8 +6735,9 @@ UniValue getbalance64(const UniValue& params, bool fHelp) UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR),b(UniValue::VARR); CTxDestination address; const CKeyStore& keystore = *pwalletMain; CAmount nValues[64],nValues2[64],nValue,total,total2; int32_t i,segid; - assert(pwalletMain != NULL); - if (fHelp || params.size() > 0) + if (!EnsureWalletIsAvailable(fHelp)) + return NullUniValue; + if (params.size() > 0) throw runtime_error("getbalance64\n"); total = total2 = 0; memset(nValues,0,sizeof(nValues));