test
This commit is contained in:
@@ -383,7 +383,28 @@ const CScript &CCoinsViewCache::GetSpendFor(const CTxIn& input) const
|
||||
return coins->vout[input.prevout.n].scriptPubKey;
|
||||
}
|
||||
|
||||
uint32_t komodo_txtime(uint256 hash);
|
||||
uint32_t komodo_txtime(uint256 hash)
|
||||
{
|
||||
CTransaction tx;
|
||||
uint256 hashBlock;
|
||||
if (!GetTransaction(hash, tx, hashBlock, true))
|
||||
{
|
||||
//printf("null GetTransaction\n");
|
||||
return(tx.nLockTime);
|
||||
}
|
||||
if (!hashBlock.IsNull()) {
|
||||
BlockMap::iterator mi = mapBlockIndex.find(hashBlock);
|
||||
if (mi != mapBlockIndex.end() && (*mi).second)
|
||||
{
|
||||
CBlockIndex* pindex = (*mi).second;
|
||||
if (chainActive.Contains(pindex))
|
||||
return(pindex->GetBlockTime());
|
||||
}
|
||||
//printf("cant find in iterator\n");
|
||||
}
|
||||
//printf("null hashBlock\n");
|
||||
return(tx.nLockTime);
|
||||
}
|
||||
|
||||
CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx) const
|
||||
{
|
||||
@@ -393,7 +414,7 @@ CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx) const
|
||||
CAmount nResult = 0;
|
||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
||||
{
|
||||
fprintf(stderr,"i.%d time.%u\n",i,komodo_txtime(tx.vin[i].prevout.hash));
|
||||
fprintf(stderr,"GetValueIn i.%d time.%u\n",i,komodo_txtime(tx.vin[i].prevout.hash));
|
||||
nResult += GetOutputFor(tx.vin[i]).nValue;
|
||||
}
|
||||
nResult += tx.GetJoinSplitValueIn();
|
||||
|
||||
23
src/komodo.h
23
src/komodo.h
@@ -246,29 +246,6 @@ int32_t komodo_threshold(int32_t height,uint64_t signedmask)
|
||||
else return(0);
|
||||
}
|
||||
|
||||
uint32_t komodo_txtime(uint256 hash)
|
||||
{
|
||||
CTransaction tx;
|
||||
uint256 hashBlock;
|
||||
if (!GetTransaction(hash, tx, hashBlock, true))
|
||||
{
|
||||
//printf("null GetTransaction\n");
|
||||
return(tx.nLockTime);
|
||||
}
|
||||
if (!hashBlock.IsNull()) {
|
||||
BlockMap::iterator mi = mapBlockIndex.find(hashBlock);
|
||||
if (mi != mapBlockIndex.end() && (*mi).second)
|
||||
{
|
||||
CBlockIndex* pindex = (*mi).second;
|
||||
if (chainActive.Contains(pindex))
|
||||
return(pindex->GetBlockTime());
|
||||
}
|
||||
//printf("cant find in iterator\n");
|
||||
}
|
||||
//printf("null hashBlock\n");
|
||||
return(tx.nLockTime);
|
||||
}
|
||||
|
||||
void komodo_nutxoadd(int32_t addflag,int32_t height,int32_t notaryid,uint256 txhash,uint64_t voutmask,int32_t numvouts)
|
||||
{
|
||||
struct nutxo_entry *np;
|
||||
|
||||
@@ -2133,7 +2133,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
||||
if (nSigOps > MAX_BLOCK_SIGOPS)
|
||||
return state.DoS(100, error("ConnectBlock(): too many sigops"),
|
||||
REJECT_INVALID, "bad-blk-sigops");
|
||||
|
||||
fprintf(stderr,"ht.%d vout0 t%u\n",pindex->nHeight,tx.nLockTime);
|
||||
if (!tx.IsCoinBase())
|
||||
{
|
||||
if (!view.HaveInputs(tx))
|
||||
|
||||
@@ -329,6 +329,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
||||
|
||||
// Create coinbase tx
|
||||
CMutableTransaction txNew;
|
||||
txNew.nLockTime = (uint32_t)time(NULL) - 60;
|
||||
txNew.vin.resize(1);
|
||||
txNew.vin[0].prevout.SetNull();
|
||||
txNew.vout.resize(1);
|
||||
@@ -499,7 +500,6 @@ void static BitcoinMiner(CWallet *pwallet)
|
||||
}
|
||||
CBlock *pblock = &pblocktemplate->block;
|
||||
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
|
||||
|
||||
LogPrintf("Running ZcashMiner with %u transactions in block (%u bytes)\n", pblock->vtx.size(),
|
||||
::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION));
|
||||
|
||||
|
||||
@@ -2437,7 +2437,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend,
|
||||
}
|
||||
else
|
||||
{
|
||||
txNew.nLockTime = (uint32_t)time(NULL) - 1800; // set to a time close to now
|
||||
txNew.nLockTime = (uint32_t)time(NULL) - 60; // set to a time close to now
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user