Skip to content

Commit 25001fd

Browse files
committed
v1.6: guard new methods behind 1.6 ptuple
Guards the new `blockchain.transaction.broadcast_package` and `mempool.get_info` methods of protocol 1.6 behind this versions ptuple in `set_request_handlers` so they are only exposed in protocol versions >= 1.6. Also stops exposing the `blockchain.relayfee` endpoint for version >= 1.6 as it got removed in 1.6.
1 parent e891b55 commit 25001fd

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/electrumx/server/session.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,7 +1648,6 @@ def set_request_handlers(self, ptuple):
16481648
'blockchain.block.headers': self.block_headers,
16491649
'blockchain.estimatefee': self.estimatefee,
16501650
'blockchain.headers.subscribe': self.headers_subscribe,
1651-
'blockchain.relayfee': self.relayfee,
16521651
'blockchain.scripthash.get_balance': self.scripthash_get_balance,
16531652
'blockchain.scripthash.get_history': self.scripthash_get_history,
16541653
'blockchain.scripthash.get_mempool': self.scripthash_get_mempool,
@@ -1671,9 +1670,11 @@ def set_request_handlers(self, ptuple):
16711670
if ptuple >= (1, 4, 2):
16721671
handlers['blockchain.scripthash.unsubscribe'] = self.scripthash_unsubscribe
16731672

1674-
# experimental:
1675-
handlers['blockchain.transaction.broadcast_package'] = self.package_broadcast
1676-
handlers['mempool.get_info'] = self.mempool_info
1673+
if ptuple >= (1, 6):
1674+
handlers['blockchain.transaction.broadcast_package'] = self.package_broadcast
1675+
handlers['mempool.get_info'] = self.mempool_info
1676+
else:
1677+
handlers['blockchain.relayfee'] = self.relayfee # removed in 1.6
16771678

16781679
self.request_handlers = handlers
16791680

0 commit comments

Comments
 (0)