Skip to content

Commit e196b5e

Browse files
authored
Merge pull request #1283 from jamescowens/hotfix
Remove bOPReturnEnabled and correct handling of OP_RETURN
2 parents 07ff7a9 + 484d5f7 commit e196b5e

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed

src/main.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ CBigNum bnProofOfWorkLimitTestNet(~uint256(0) >> 16);
172172
unsigned int nStakeMinAge = 16 * 60 * 60; // 16 hours
173173
unsigned int nStakeMaxAge = -1; // unlimited
174174
unsigned int nModifierInterval = 10 * 60; // time to elapse before new modifier is computed
175-
bool bOPReturnEnabled = true;
176175

177176
// Gridcoin:
178177
int nCoinbaseMaturity = 100;
@@ -5115,7 +5114,6 @@ bool LoadBlockIndex(bool fAllowNew)
51155114
nGrandfather = 196550;
51165115
nNewIndex = 10;
51175116
nNewIndex2 = 36500;
5118-
bOPReturnEnabled = false;
51195117
//1-24-2016
51205118
MAX_OUTBOUND_CONNECTIONS = (int)GetArg("-maxoutboundconnections", 8);
51215119
}

src/main.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ extern std::set<CWallet*> setpwalletRegistered;
170170
extern unsigned char pchMessageStart[4];
171171
extern std::map<uint256, CBlock*> mapOrphanBlocks;
172172

173-
extern bool bOPReturnEnabled;
174-
175173
// Settings
176174
extern int64_t nTransactionFee;
177175
extern int64_t nReserveBalance;

src/qt/transactionrecord.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ bool TransactionRecord::showTransaction(const CWalletTx &wtx)
2626
return false;
2727
}
2828
}
29+
30+
// Suppress OP_RETURN transactions if they did not originate from you.
31+
// This is not "very" taxing but necessary since the transaction is in the wallet already.
32+
if (!wtx.IsFromMe())
33+
{
34+
for (auto const& txout : wtx.vout)
35+
{
36+
if (txout.scriptPubKey == (CScript() << OP_RETURN))
37+
return false;
38+
}
39+
}
2940
return true;
3041
}
3142

src/script.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,7 @@ int ScriptSigArgsExpected(txnouttype t, const std::vector<std::vector<unsigned c
15061506
case TX_NONSTANDARD:
15071507
return -1; // Note, this was empty (thats -1);
15081508
case TX_NULL_DATA:
1509-
return (bOPReturnEnabled) ? -1 : -1;
1509+
return -1;
15101510
// Script Sig Args Expected: Bitcoin=-1, PPCoin=1
15111511
case TX_PUBKEY:
15121512
return 1;
@@ -1584,8 +1584,7 @@ bool IsMine(const CKeyStore &keystore, const CScript& scriptPubKey)
15841584
{
15851585
case TX_NONSTANDARD:
15861586
case TX_NULL_DATA:
1587-
// Note this was always false, til 3-13-2016.
1588-
return (bOPReturnEnabled) ? true : false;
1587+
return false;
15891588
case TX_PUBKEY:
15901589
keyID = CPubKey(vSolutions[0]).GetID();
15911590
return keystore.HaveKey(keyID);
@@ -1620,8 +1619,8 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet)
16201619
if (!Solver(scriptPubKey, whichType, vSolutions))
16211620
return false;
16221621

1623-
if (bOPReturnEnabled && whichType == TX_NULL_DATA)
1624-
return true;
1622+
if (whichType == TX_NULL_DATA)
1623+
return false;
16251624

16261625
if (whichType == TX_PUBKEY)
16271626
{

src/wallet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,8 @@ void CWalletTx::GetAmounts2(list<COutputEntry>& listReceived,
818818
}
819819
else
820820
{
821-
if ( ( !bOPReturnEnabled && !ExtractDestination(txout.scriptPubKey, address) )
822-
|| ( bOPReturnEnabled && !ExtractDestination(txout.scriptPubKey, address) && txout.scriptPubKey[0] != OP_RETURN) )
821+
if ( ( !ExtractDestination(txout.scriptPubKey, address) )
822+
|| ( !ExtractDestination(txout.scriptPubKey, address) && txout.scriptPubKey[0] != OP_RETURN) )
823823
{
824824
LogPrintf("CWalletTx::GetAmounts: Unknown transaction type found, txid %s",
825825
this->GetHash().ToString().c_str());

0 commit comments

Comments
 (0)