test
This commit is contained in:
@@ -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