Skip to content

Extract helper methods for readability across chain providers and axon handlers#18

Merged
LandynDev merged 3 commits intoentrius:testfrom
bittoby:refactor/provider-method-extractions
Apr 13, 2026
Merged

Extract helper methods for readability across chain providers and axon handlers#18
LandynDev merged 3 commits intoentrius:testfrom
bittoby:refactor/provider-method-extractions

Conversation

@bittoby
Copy link
Copy Markdown
Contributor

@bittoby bittoby commented Apr 8, 2026

Summary

Several long methods had too many responsibilities packed into one function, making them hard to follow. This PR pulls out focused helper methods without changing any behavior.

What changed

bitcoin.py

  • _rpc_resolve_sender() — extracts the sender address lookup from the first vin inside _rpc_verify_transaction
  • _blockstream_calc_confirmations() — extracts the tip-height fetch and confirmation math from _blockstream_verify_transaction
  • _resolve_sender_utxos() — extracts address matching and UTXO fetching from send_amount_lightweight (was ~45 lines deep)
  • _select_utxos() — extracts greedy coin selection and fee calculation from send_amount_lightweight
  • _broadcast_tx() — extracts the Blockstream broadcast call from send_amount_lightweight

subtensor.py

  • _match_transfer() — extracts the extrinsic-matching logic from the inner loop of verify_transaction

axon_handlers.py

  • _load_swap_commitment() — consolidates the duplicated commitment read + chain validation in handle_swap_reserve and handle_swap_confirm
  • _resolve_swap_direction() — extracts deposit/fulfillment address resolution and rate lookup from handle_swap_confirm

No behavioral changes, no new dependencies, just reorganization.

@bittoby bittoby force-pushed the refactor/provider-method-extractions branch from 8aaa519 to 20b3123 Compare April 8, 2026 01:06
@bittoby bittoby changed the title Extract helper methods from Bitcoin and Subtensor verify_transaction for readability Extract helper methods for readability across chain providers and axon handlers Apr 8, 2026
@bittoby bittoby force-pushed the refactor/provider-method-extractions branch from 83b7e73 to 6173989 Compare April 10, 2026 00:09
@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented Apr 10, 2026

@LandynDev Could you also review this? It is not behavior change. Just refactoring PR based on your feedback(#10 (review)). Thanks

@LandynDev LandynDev merged commit 236d662 into entrius:test Apr 13, 2026
2 checks passed
@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented Apr 13, 2026

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants