Skip to content

Commit ff1fe66

Browse files
committed
Merge pull request #3939
3da434a Introduce option to disable relay/mining of bare multisig scripts in TX outputs (Jeff Garzik)
2 parents b9345f7 + 3da434a commit ff1fe66

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/init.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ std::string HelpMessage(HelpMessageMode mode)
248248
strUsage += " -maxsendbuffer=<n> " + _("Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)") + "\n";
249249
strUsage += " -onion=<ip:port> " + _("Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: -proxy)") + "\n";
250250
strUsage += " -onlynet=<net> " + _("Only connect to nodes in network <net> (IPv4, IPv6 or Tor)") + "\n";
251+
strUsage += " -permitbaremultisig " + _("Relay non-P2SH multisig (default: 1)") + "\n";
251252
strUsage += " -port=<port> " + _("Listen for connections on <port> (default: 8333 or testnet: 18333)") + "\n";
252253
strUsage += " -proxy=<ip:port> " + _("Connect through SOCKS5 proxy") + "\n";
253254
strUsage += " -seednode=<ip> " + _("Connect to a node to retrieve peer addresses, and disconnect") + "\n";
@@ -676,7 +677,10 @@ bool AppInit2(boost::thread_group& threadGroup)
676677
bSpendZeroConfChange = GetArg("-spendzeroconfchange", true);
677678

678679
std::string strWalletFile = GetArg("-wallet", "wallet.dat");
679-
#endif
680+
#endif // ENABLE_WALLET
681+
682+
fIsBareMultisigStd = GetArg("-permitbaremultisig", true);
683+
680684
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log
681685
// Sanity check
682686
if (!InitSanityCheck())

src/main.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ bool fImporting = false;
4848
bool fReindex = false;
4949
bool fBenchmark = false;
5050
bool fTxIndex = false;
51+
bool fIsBareMultisigStd = true;
5152
unsigned int nCoinCacheSize = 5000;
5253

5354
/** Fees smaller than this (in satoshi) are considered zero fee (for relaying and mining) */
@@ -604,9 +605,13 @@ bool IsStandardTx(const CTransaction& tx, string& reason)
604605
reason = "scriptpubkey";
605606
return false;
606607
}
608+
607609
if (whichType == TX_NULL_DATA)
608610
nDataOut++;
609-
else if (txout.IsDust(::minRelayTxFee)) {
611+
else if ((whichType == TX_MULTISIG) && (!fIsBareMultisigStd)) {
612+
reason = "bare-multisig";
613+
return false;
614+
} else if (txout.IsDust(::minRelayTxFee)) {
610615
reason = "dust";
611616
return false;
612617
}

src/main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ extern bool fReindex;
9494
extern bool fBenchmark;
9595
extern int nScriptCheckThreads;
9696
extern bool fTxIndex;
97+
extern bool fIsBareMultisigStd;
9798
extern unsigned int nCoinCacheSize;
9899
extern CFeeRate minRelayTxFee;
99100

0 commit comments

Comments
 (0)