Skip to content

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

Open
bittoby wants to merge 2 commits intoentrius:testfrom
bittoby:refactor/provider-method-extractions
Open

Extract helper methods for readability across chain providers and axon handlers#18
bittoby wants to merge 2 commits intoentrius:testfrom
bittoby:refactor/provider-method-extractions

Conversation

@bittoby
Copy link
Copy Markdown

@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 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
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.

1 participant