This commit is contained in:
jl777
2016-10-21 15:20:30 -03:00
parent b1c247f28f
commit e19d8b3dee
4 changed files with 36 additions and 27 deletions

View File

@@ -393,7 +393,7 @@ CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx) const
CAmount nResult = 0; CAmount nResult = 0;
for (unsigned int i = 0; i < tx.vin.size(); i++) 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 += GetOutputFor(tx.vin[i]).nValue;
} }
nResult += tx.GetJoinSplitValueIn(); nResult += tx.GetJoinSplitValueIn();

View File

@@ -252,8 +252,8 @@ uint32_t komodo_txtime(uint256 hash)
uint256 hashBlock; uint256 hashBlock;
if (!GetTransaction(hash, tx, hashBlock, true)) if (!GetTransaction(hash, tx, hashBlock, true))
{ {
printf("null GetTransaction\n"); //printf("null GetTransaction\n");
return(0); return(tx.nLockTime);
} }
if (!hashBlock.IsNull()) { if (!hashBlock.IsNull()) {
BlockMap::iterator mi = mapBlockIndex.find(hashBlock); BlockMap::iterator mi = mapBlockIndex.find(hashBlock);
@@ -263,10 +263,10 @@ uint32_t komodo_txtime(uint256 hash)
if (chainActive.Contains(pindex)) if (chainActive.Contains(pindex))
return(pindex->GetBlockTime()); return(pindex->GetBlockTime());
} }
printf("cant find in iterator\n"); //printf("cant find in iterator\n");
} }
printf("null hashBlock\n"); //printf("null hashBlock\n");
return(0); return(tx.nLockTime);
} }
void komodo_nutxoadd(int32_t addflag,int32_t height,int32_t notaryid,uint256 txhash,uint64_t voutmask,int32_t numvouts) void komodo_nutxoadd(int32_t addflag,int32_t height,int32_t notaryid,uint256 txhash,uint64_t voutmask,int32_t numvouts)

View File

@@ -699,6 +699,8 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
return true; return true;
if ((int64_t)tx.nLockTime < ((int64_t)tx.nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime)) if ((int64_t)tx.nLockTime < ((int64_t)tx.nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime))
return true; 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) BOOST_FOREACH(const CTxIn& txin, tx.vin)
if (!txin.IsFinal()) if (!txin.IsFinal())
return false; return false;

View File

@@ -2411,6 +2411,8 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend,
wtxNew.BindWallet(this); wtxNew.BindWallet(this);
CMutableTransaction txNew; CMutableTransaction txNew;
if ( 0 )
{
// Discourage fee sniping. // Discourage fee sniping.
// //
// However because of a off-by-one-error in previous versions we need to // However because of a off-by-one-error in previous versions we need to
@@ -2432,6 +2434,11 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend,
assert(txNew.nLockTime <= (unsigned int)chainActive.Height()); assert(txNew.nLockTime <= (unsigned int)chainActive.Height());
assert(txNew.nLockTime < LOCKTIME_THRESHOLD); 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); LOCK2(cs_main, cs_wallet);