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)
This commit is contained in:
UdjinM6 2016-12-09 00:03:57 +04:00 committed by GitHub
parent cf57c5ca93
commit a11bd2c5ba
2 changed files with 7 additions and 11 deletions

View File

@ -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

View File

@ -2931,8 +2931,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& 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,