From a11bd2c5bad3d0ae84c8c234e6e6328720a3dd8b Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 9 Dec 2016 00:03:57 +0400 Subject: [PATCH] small ix fixes: (#1193) - make script verification a part of IsInstantSendTxValid() - relax nLockTime for IS txes since we don't have compatibility with 12.0 IS txes anyway now (fee is lower in 12.1) --- src/instantx.cpp | 15 ++++++--------- src/wallet/wallet.cpp | 3 +-- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/instantx.cpp b/src/instantx.cpp index 0b3f19ffe..802c87be0 100644 --- a/src/instantx.cpp +++ b/src/instantx.cpp @@ -85,6 +85,12 @@ bool IsInstantSendTxValid(const CTransaction& txCandidate) bool fMissingInputs = false; BOOST_FOREACH(const CTxOut& txout, txCandidate.vout) { + // InstandSend supports normal scripts and unspendable (i.e. data) scripts. + // TODO: Look into other script types that are normal and can be included + if(!txout.scriptPubKey.IsNormalPaymentScript() && !txout.scriptPubKey.IsUnspendable()) { + LogPrint("instantsend", "IsInstantSendTxValid -- Invalid Script %s", txCandidate.ToString()); + return false; + } nValueOut += txout.nValue; } @@ -126,15 +132,6 @@ bool ProcessTxLockRequest(CNode* pfrom, const CTransaction &tx) { if(!IsInstantSendTxValid(tx)) return false; - BOOST_FOREACH(const CTxOut o, tx.vout) { - // InstandSend supports normal scripts and unspendable scripts (used in PrivateSend collateral and Governance collateral). - // TODO: Look into other script types that are normal and can be included - if(!o.scriptPubKey.IsNormalPaymentScript() && !o.scriptPubKey.IsUnspendable()) { - LogPrintf("TXLOCKREQUEST -- Invalid Script %s", tx.ToString()); - return false; - } - } - int nBlockHeight = CreateTxLockCandidate(tx); if(!nBlockHeight) { // smth is not right diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index e3bae0cf2..8a1ff0a53 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2931,8 +2931,7 @@ bool CWallet::CreateTransaction(const vector& vecSend, CWalletTx& wt // now we ensure code won't be written that makes assumptions about // nLockTime that preclude a fix later. - // FIXME: "compatibility mode" for 12.0 IX, make it "txNew.nLockTime = chainActive.Height();" again in 12.2 - txNew.nLockTime = fUseInstantSend ? 0 : chainActive.Height(); + txNew.nLockTime = chainActive.Height(); // Secondly occasionally randomly pick a nLockTime even further back, so // that transactions that are delayed after signing for whatever reason,