@@ -101,7 +101,7 @@ bool GetAddressUnspent(uint160 addressHash, int type,std::vector<std::pair<CAddr
|
|||||||
static const uint256 zeroid;
|
static const uint256 zeroid;
|
||||||
bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock);
|
bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock);
|
||||||
int32_t is_hexstr(char *str,int32_t n);
|
int32_t is_hexstr(char *str,int32_t n);
|
||||||
bool myAddtomempool(CTransaction &tx);
|
bool myAddtomempool(CTransaction &tx, CValidationState *pstate = NULL);
|
||||||
//uint64_t myGettxout(uint256 hash,int32_t n);
|
//uint64_t myGettxout(uint256 hash,int32_t n);
|
||||||
bool myIsutxo_spentinmempool(uint256 txid,int32_t vout);
|
bool myIsutxo_spentinmempool(uint256 txid,int32_t vout);
|
||||||
int32_t myIsutxo_spent(uint256 &spenttxid,uint256 txid,int32_t vout);
|
int32_t myIsutxo_spent(uint256 &spenttxid,uint256 txid,int32_t vout);
|
||||||
|
|||||||
42
src/main.cpp
42
src/main.cpp
@@ -1532,14 +1532,6 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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");
|
|
||||||
}
|
|
||||||
|
|
||||||
auto verifier = libzcash::ProofVerifier::Strict();
|
auto verifier = libzcash::ProofVerifier::Strict();
|
||||||
if ( komodo_validate_interest(tx,chainActive.LastTip()->GetHeight()+1,chainActive.LastTip()->GetMedianTimePast() + 777,0) < 0 )
|
if ( komodo_validate_interest(tx,chainActive.LastTip()->GetHeight()+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");
|
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?
|
// is it already in the memory pool?
|
||||||
uint256 hash = tx.GetHash();
|
uint256 hash = tx.GetHash();
|
||||||
if (pool.exists(hash))
|
if (pool.exists(hash))
|
||||||
@@ -1891,9 +1891,12 @@ bool GetAddressUnspent(uint160 addressHash, int type,
|
|||||||
else return(coins.vout[n].nValue);
|
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 )
|
if ( mempool.lookup(tx.GetHash(),Ltx) == 0 )
|
||||||
return(AcceptToMemoryPool(mempool, state, tx, false, &fMissingInputs, !fOverrideFees));
|
return(AcceptToMemoryPool(mempool, state, tx, false, &fMissingInputs, !fOverrideFees));
|
||||||
else return(true);
|
else return(true);
|
||||||
@@ -4541,18 +4544,27 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
|
|||||||
// Check transactions
|
// 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
|
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");
|
//fprintf(stderr,"put block's tx into mempool\n");
|
||||||
while ( 1 )
|
while ( 1 )
|
||||||
{
|
{
|
||||||
for (i=0; i<block.vtx.size(); i++)
|
for (i=0; i<block.vtx.size(); i++)
|
||||||
{
|
{
|
||||||
CTransaction Tx; const CTransaction &tx = (CTransaction)block.vtx[i];
|
CValidationState state;
|
||||||
if (tx.IsCoinBase() || ((i == (block.vtx.size() - 1)) && ((ASSETCHAINS_LWMAPOS && block.IsVerusPOSBlock()) || (ASSETCHAINS_STAKED && komodo_isPoS((CBlock *)&block) != 0))))
|
CTransaction Tx;
|
||||||
|
const CTransaction &tx = (CTransaction)block.vtx[i];
|
||||||
|
if (tx.IsCoinBase() || ((i == (block.vtx.size() - 1)) && (ASSETCHAINS_STAKED && komodo_isPoS((CBlock *)&block) != 0)))
|
||||||
continue;
|
continue;
|
||||||
Tx = tx;
|
Tx = tx;
|
||||||
if ( myAddtomempool(Tx) == false ) // happens with out of order tx in block on resync
|
if ( myAddtomempool(Tx, &state) == false ) // happens with out of order tx in block on resync
|
||||||
rejects++;
|
{
|
||||||
|
// take advantage of other checks, but if we were only rejected because it is a valid staking
|
||||||
|
// transaction, sync with wallets and don't mark as a reject
|
||||||
|
if (i == (block.vtx.size() - 1) && ASSETCHAINS_LWMAPOS && block.IsVerusPOSBlock() && state.GetRejectReason() == "staking")
|
||||||
|
SyncWithWallets(Tx, &block);
|
||||||
|
else
|
||||||
|
rejects++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ( rejects == 0 || rejects == lastrejects )
|
if ( rejects == 0 || rejects == lastrejects )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -878,6 +878,7 @@ UniValue submitblock(const UniValue& params, bool fHelp)
|
|||||||
);
|
);
|
||||||
|
|
||||||
CBlock block;
|
CBlock block;
|
||||||
|
//LogPrintStr("Hex block submission: " + params[0].get_str());
|
||||||
if (!DecodeHexBlk(block, params[0].get_str()))
|
if (!DecodeHexBlk(block, params[0].get_str()))
|
||||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
|
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
|
||||||
|
|
||||||
@@ -903,6 +904,7 @@ UniValue submitblock(const UniValue& params, bool fHelp)
|
|||||||
CValidationState state;
|
CValidationState state;
|
||||||
submitblock_StateCatcher sc(block.GetHash());
|
submitblock_StateCatcher sc(block.GetHash());
|
||||||
RegisterValidationInterface(&sc);
|
RegisterValidationInterface(&sc);
|
||||||
|
//printf("submitblock, height=%d, coinbase sequence: %d, scriptSig: %s\n", chainActive.LastTip()->GetHeight()+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);
|
bool fAccepted = ProcessNewBlock(1,chainActive.LastTip()->GetHeight()+1,state, NULL, &block, true, NULL);
|
||||||
UnregisterValidationInterface(&sc);
|
UnregisterValidationInterface(&sc);
|
||||||
if (fBlockPresent)
|
if (fBlockPresent)
|
||||||
|
|||||||
@@ -731,7 +731,7 @@ UniValue CRPCTable::execute(const std::string &strMethod, const UniValue ¶ms
|
|||||||
throw JSONRPCError(RPC_IN_WARMUP, rpcWarmupStatus);
|
throw JSONRPCError(RPC_IN_WARMUP, rpcWarmupStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("RPC call: %s\n", strMethod.c_str());
|
//printf("RPC call: %s\n", strMethod.c_str());
|
||||||
|
|
||||||
// Find method
|
// Find method
|
||||||
const CRPCCommand *pcmd = tableRPC[strMethod];
|
const CRPCCommand *pcmd = tableRPC[strMethod];
|
||||||
|
|||||||
@@ -554,11 +554,17 @@ static boost::filesystem::path ZC_GetBaseParamsDir()
|
|||||||
// Windows >= Vista: C:\Users\Username\AppData\Roaming\ZcashParams
|
// Windows >= Vista: C:\Users\Username\AppData\Roaming\ZcashParams
|
||||||
// Mac: ~/Library/Application Support/ZcashParams
|
// Mac: ~/Library/Application Support/ZcashParams
|
||||||
// Unix: ~/.zcash-params
|
// Unix: ~/.zcash-params
|
||||||
|
fs::path pathRet;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Windows
|
// Windows
|
||||||
|
if (mapArgs.count("-zcashparamsdir")) {
|
||||||
|
pathRet = fs::system_complete(mapArgs["-zcashparamsdir"]);
|
||||||
|
if (fs::is_directory(pathRet)) {
|
||||||
|
return pathRet;
|
||||||
|
}
|
||||||
|
}
|
||||||
return GetSpecialFolderPath(CSIDL_APPDATA) / "ZcashParams";
|
return GetSpecialFolderPath(CSIDL_APPDATA) / "ZcashParams";
|
||||||
#else
|
#else
|
||||||
fs::path pathRet;
|
|
||||||
char* pszHome = getenv("HOME");
|
char* pszHome = getenv("HOME");
|
||||||
if (pszHome == NULL || strlen(pszHome) == 0)
|
if (pszHome == NULL || strlen(pszHome) == 0)
|
||||||
pathRet = fs::path("/");
|
pathRet = fs::path("/");
|
||||||
|
|||||||
@@ -6735,8 +6735,9 @@ UniValue getbalance64(const UniValue& params, bool fHelp)
|
|||||||
UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR),b(UniValue::VARR); CTxDestination address;
|
UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR),b(UniValue::VARR); CTxDestination address;
|
||||||
const CKeyStore& keystore = *pwalletMain;
|
const CKeyStore& keystore = *pwalletMain;
|
||||||
CAmount nValues[64],nValues2[64],nValue,total,total2; int32_t i,segid;
|
CAmount nValues[64],nValues2[64],nValue,total,total2; int32_t i,segid;
|
||||||
assert(pwalletMain != NULL);
|
if (!EnsureWalletIsAvailable(fHelp))
|
||||||
if (fHelp || params.size() > 0)
|
return NullUniValue;
|
||||||
|
if (params.size() > 0)
|
||||||
throw runtime_error("getbalance64\n");
|
throw runtime_error("getbalance64\n");
|
||||||
total = total2 = 0;
|
total = total2 = 0;
|
||||||
memset(nValues,0,sizeof(nValues));
|
memset(nValues,0,sizeof(nValues));
|
||||||
|
|||||||
Reference in New Issue
Block a user