-
Notifications
You must be signed in to change notification settings - Fork 226
Fixes broken .send() – Broadcast Transactions Working Again #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -500,12 +500,12 @@ def get_unspent_testnet(cls, address): | |
|
|
||
| @classmethod | ||
| def broadcast_tx(cls, tx_hex): # pragma: no cover | ||
| r = requests.post(cls.MAIN_TX_PUSH_API, data={cls.TX_PUSH_PARAM: tx_hex}, timeout=DEFAULT_TIMEOUT) | ||
| r = requests.post(cls.MAIN_TX_PUSH_API, data=tx_hex, timeout=DEFAULT_TIMEOUT) | ||
| return True if r.status_code == 200 else False | ||
|
|
||
| @classmethod | ||
| def broadcast_tx_testnet(cls, tx_hex): # pragma: no cover | ||
| r = requests.post(cls.TEST_TX_PUSH_API, data={cls.TX_PUSH_PARAM: tx_hex}, timeout=DEFAULT_TIMEOUT) | ||
| r = requests.post(cls.TEST_TX_PUSH_API, data=tx_hex, timeout=DEFAULT_TIMEOUT) | ||
| return True if r.status_code == 200 else False | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
|
|
||
|
|
@@ -980,11 +980,7 @@ class NetworkAPI: | |
| BitcoreAPI.get_unspent, # No limit | ||
| ] | ||
| BROADCAST_TX_MAIN = [ | ||
| BlockchairAPI.broadcast_tx, | ||
| BlockstreamAPI.broadcast_tx, | ||
| BitcoreAPI.broadcast_tx, | ||
| SmartbitAPI.broadcast_tx, # Limit 5/minute | ||
| BlockchainAPI.broadcast_tx, | ||
| ] | ||
|
Comment on lines
982
to
984
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change correctly removes the defunct API providers, which is a necessary fix for the immediate issue. However, this makes While this is a significant improvement over the previous silently-failing state, for long-term resilience, it would be beneficial to either:
|
||
|
|
||
| GET_BALANCE_TEST = [ | ||
|
|
@@ -1010,10 +1006,7 @@ class NetworkAPI: | |
| BitcoreAPI.get_unspent_testnet, # No limit | ||
| ] | ||
| BROADCAST_TX_TEST = [ | ||
| BlockchairAPI.broadcast_tx_testnet, | ||
| BlockstreamAPI.broadcast_tx_testnet, | ||
| BitcoreAPI.broadcast_tx_testnet, | ||
| SmartbitAPI.broadcast_tx_testnet, # Limit 5/minute | ||
| ] | ||
|
|
||
| @classmethod | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ternary operator
True if ... else Falseis redundant here. The comparisonr.status_code == 200already evaluates to a boolean, which can be returned directly. This simplifies the code and improves readability.