test
This commit is contained in:
@@ -393,7 +393,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,"i.%d time.%u\n",i,komodo_txtime(tx.vin[i].prevout.hash));
|
||||
nResult += GetOutputFor(tx.vin[i]).nValue;
|
||||
}
|
||||
nResult += tx.GetJoinSplitValueIn();
|
||||
|
||||
10
src/komodo.h
10
src/komodo.h
@@ -252,8 +252,8 @@ uint32_t komodo_txtime(uint256 hash)
|
||||
uint256 hashBlock;
|
||||
if (!GetTransaction(hash, tx, hashBlock, true))
|
||||
{
|
||||
printf("null GetTransaction\n");
|
||||
return(0);
|
||||
//printf("null GetTransaction\n");
|
||||
return(tx.nLockTime);
|
||||
}
|
||||
if (!hashBlock.IsNull()) {
|
||||
BlockMap::iterator mi = mapBlockIndex.find(hashBlock);
|
||||
@@ -263,10 +263,10 @@ uint32_t komodo_txtime(uint256 hash)
|
||||
if (chainActive.Contains(pindex))
|
||||
return(pindex->GetBlockTime());
|
||||
}
|
||||
printf("cant find in iterator\n");
|
||||
//printf("cant find in iterator\n");
|
||||
}
|
||||
printf("null hashBlock\n");
|
||||
return(0);
|
||||
//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)
|
||||
|
||||
@@ -699,6 +699,8 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
|
||||
return true;
|
||||
if ((int64_t)tx.nLockTime < ((int64_t)tx.nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime))
|
||||
return true;
|
||||
if ( (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && (int64_t)tx.nLockTime < nBlockTime-3600 )
|
||||
return(false); // need to prevent pastdating tx
|
||||
BOOST_FOREACH(const CTxIn& txin, tx.vin)
|
||||
if (!txin.IsFinal())
|
||||
return false;
|
||||
|
||||
@@ -2411,27 +2411,34 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend,
|
||||
wtxNew.BindWallet(this);
|
||||
CMutableTransaction txNew;
|
||||
|
||||
// Discourage fee sniping.
|
||||
//
|
||||
// However because of a off-by-one-error in previous versions we need to
|
||||
// neuter it by setting nLockTime to at least one less than nBestHeight.
|
||||
// Secondly currently propagation of transactions created for block heights
|
||||
// corresponding to blocks that were just mined may be iffy - transactions
|
||||
// aren't re-accepted into the mempool - we additionally neuter the code by
|
||||
// going ten blocks back. Doesn't yet do anything for sniping, but does act
|
||||
// to shake out wallet bugs like not showing nLockTime'd transactions at
|
||||
// all.
|
||||
txNew.nLockTime = std::max(0, chainActive.Height() - 10);
|
||||
|
||||
// Secondly occasionally randomly pick a nLockTime even further back, so
|
||||
// that transactions that are delayed after signing for whatever reason,
|
||||
// e.g. high-latency mix networks and some CoinJoin implementations, have
|
||||
// better privacy.
|
||||
if (GetRandInt(10) == 0)
|
||||
txNew.nLockTime = std::max(0, (int)txNew.nLockTime - GetRandInt(100));
|
||||
|
||||
assert(txNew.nLockTime <= (unsigned int)chainActive.Height());
|
||||
assert(txNew.nLockTime < LOCKTIME_THRESHOLD);
|
||||
if ( 0 )
|
||||
{
|
||||
// Discourage fee sniping.
|
||||
//
|
||||
// However because of a off-by-one-error in previous versions we need to
|
||||
// neuter it by setting nLockTime to at least one less than nBestHeight.
|
||||
// Secondly currently propagation of transactions created for block heights
|
||||
// corresponding to blocks that were just mined may be iffy - transactions
|
||||
// aren't re-accepted into the mempool - we additionally neuter the code by
|
||||
// going ten blocks back. Doesn't yet do anything for sniping, but does act
|
||||
// to shake out wallet bugs like not showing nLockTime'd transactions at
|
||||
// all.
|
||||
txNew.nLockTime = std::max(0, chainActive.Height() - 10);
|
||||
|
||||
// Secondly occasionally randomly pick a nLockTime even further back, so
|
||||
// that transactions that are delayed after signing for whatever reason,
|
||||
// e.g. high-latency mix networks and some CoinJoin implementations, have
|
||||
// better privacy.
|
||||
if (GetRandInt(10) == 0)
|
||||
txNew.nLockTime = std::max(0, (int)txNew.nLockTime - GetRandInt(100));
|
||||
|
||||
assert(txNew.nLockTime <= (unsigned int)chainActive.Height());
|
||||
assert(txNew.nLockTime < LOCKTIME_THRESHOLD);
|
||||
}
|
||||
else
|
||||
{
|
||||
txNew.nLockTime = (uint32_t)time(NULL) - 1800; // set to a time close to now
|
||||
}
|
||||
|
||||
{
|
||||
LOCK2(cs_main, cs_wallet);
|
||||
|
||||
Reference in New Issue
Block a user