Skip to content

Commit a0cd8fa

Browse files
committed
Restrict submitpackage RPC: require Core 28.0.0
Apparently Core 27.0.0 has it but it's largely not useful. According to ElectrumX devs. See: https://github.com/spesmilo/electrum-protocol/pull/6/files#r2459860616
1 parent 326ea8d commit a0cd8fa

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/BitcoinD.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,10 @@ void BitcoinDMgr::refreshBitcoinDNetworkInfo()
312312
// Bitcoin Core 25.0+ requires specifying `maxburnamount` in the `sendrawtransaction` RPC
313313
// (which, due to bitcoin core weirdness in how it encodes the version int, maps to Version{0, 25, 0}
314314
rsi.sendRawTransactionRequiresMaxBurnAmount = res.isCore && bitcoinDInfo.version >= Version{0, 25, 0};
315-
// The `submitpackage` RPC is only present in a form usable by us on Bitcoin Core >= 27.0.0
316-
rsi.hasSubmitPackageRPC = res.isCore && bitcoinDInfo.version >= Version{0, 27, 0};
317-
rsi.submitPackageRPCSupportsMaxBurnAmount = rsi.hasSubmitPackageRPC && bitcoinDInfo.version >= Version{0, 28, 0};
315+
// The `submitpackage` RPC is only present in a form usable by us on Bitcoin Core >= 27.0.0, but it was
316+
// almost worthless on 27.0.0 (according to ElectrumX devs), and so we require 28.0.0.
317+
// See: https://github.com/spesmilo/electrum-protocol/pull/6/files#r2459860616
318+
rsi.hasSubmitPackageRPC = res.isCore && bitcoinDInfo.version >= Version{0, 28, 0};
318319
} // end lock scope
319320
// be sure to announce whether remote bitcoind is bitcoin core (this determines whether we use segwit or not)
320321
BTC::Coin coin = BTC::Coin::BCH; // default BCH if unknown (not segwit)
@@ -1070,7 +1071,6 @@ QVariantMap BitcoinDInfo::toVariantMap() const
10701071
ret["hasDSProofRPC"] = rpcSupportInfo.hasDSProofRPC;
10711072
ret["sendRawTransactionRequiresMaxBurnAmount"] = rpcSupportInfo.sendRawTransactionRequiresMaxBurnAmount;
10721073
ret["hasSubmitPackageRPC"] = rpcSupportInfo.hasSubmitPackageRPC;
1073-
ret["submitPackageRPCSupportsMaxBurnAmount"] = rpcSupportInfo.submitPackageRPCSupportsMaxBurnAmount;
10741074
ret["isCore"] = isCore;
10751075
ret["isLTC"] = isLTC;
10761076
ret["isBU"] = isBU;

src/BitcoinD.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ struct BitcoinDInfo {
5656
bool lacksGetZmqNotifications = false; ///< true if bchd or BU < 1.9.1.0, or if we got an RPC error the last time we queried
5757
bool hasDSProofRPC = false; ///< true if the RPC query to `getdsprooflist` didn't return an error.
5858
bool sendRawTransactionRequiresMaxBurnAmount = false; ///< true if the `sendrawtransaction` RPC requires 2 extra args. Bitcoin Core >= 25.0.0 only.
59-
bool hasSubmitPackageRPC = false; ///< true if the `submitpackage` RPC method exists and is what we expect. Bitcoin Core >= 27.0.0 only.
60-
bool submitPackageRPCSupportsMaxBurnAmount = false; ///< true if hasSubmitPackageRPC and Bitcoin Core >= 28.0.0.
59+
bool hasSubmitPackageRPC = false; ///< true if the `submitpackage` RPC method exists and is what we expect. Bitcoin Core >= 28.0.0 only.
6160
};
6261
RpcSupportInfo rpcSupportInfo;
6362
bool isCore = false; ///< true if we are actually connected to /Satoshi.. node (Bitcoin Core)

0 commit comments

Comments
 (0)