Skip to content

BTC source swaps can expire after funds are sent because 3-conf wait exceeds reservation TTL #315

@JSONbored

Description

@JSONbored

Summary

alw swap now --from btc --to tao can successfully reserve a miner and broadcast the BTC source transaction, then fail to initiate any on-chain swap because the reservation expires before the required BTC confirmations arrive.

In this case, BTC was sent to the selected miner address, the reservation later disappeared, next_swap_id did not advance, and no TAO was received.

This looks like a mismatch between:

  • BTC source confirmation requirement: 3 confirmations, displayed by CLI as ~30 min
  • reservation TTL: ~50 Bittensor blocks / ~10 min

The CLI warns not to send near the end of the reservation, but even sending immediately can miss the TTL when BTC requires 3 confirmations.

Reproduction / observed flow

Quote:

alw swap quote --from btc --to tao --amount 0.00018

Selected route:

UID 136
Rate: 1 BTC -> 255 TAO
Expected receive: 0.04544100 TAO after 1% fee

Swap command:

alw swap now \
  --from btc \
  --to tao \
  --amount 0.00018 \
  --receive-address 5E5PDWy3msrnA4uucy5bWRPVkFrzip4DTNN2qcEnPe5Tb24j \
  --from-address bc1qqnja4d8q0jxnv06v6f2sxj9570klg3hm46cnul \
  --auto \
  --btc-fee-rate 3

CLI output showed:

Miner reserved! You have ~10 min to send your funds before the reservation expires.
...
BTC sent (tx: 51c83350cd3dc695f6a53bbfe0709aeb04cba5387fa47a44ffd790457e234c3a)
...
V1: queued Queued — 0/3 confirmations. Validator will auto-initiate when confirmed.
Waiting for 3 BTC confirmation(s) (~30 min).

On-chain / transaction evidence

BTC tx:

51c83350cd3dc695f6a53bbfe0709aeb04cba5387fa47a44ffd790457e234c3a

Mempool:

https://mempool.space/tx/51c83350cd3dc695f6a53bbfe0709aeb04cba5387fa47a44ffd790457e234c3a

Confirmed output to selected miner BTC address:

bc1qdpw3zrh50ygk8akrg69lnyt3q3qkkdwxw9pth2
18,000 sats / 0.00018 BTC

Change output back to source wallet:

bc1qqnja4d8q0jxnv06v6f2sxj9570klg3hm46cnul
1,373 sats

Expected TAO receive address:

5E5PDWy3msrnA4uucy5bWRPVkFrzip4DTNN2qcEnPe5Tb24j

Expected receive amount:

0.04544100 TAO

Current Allways state after BTC confirmation

alw view reservation:
Reservation is no longer active on-chain.
Either the reservation expired before you sent funds, or your swap already initiated and has since completed.
Local reservation state cleared.
alw view active-swaps:
No swaps found
alw view swap 5:
Swap 5 does not exist. Next swap ID: 5.

Coldkey TAO balance did not increase.

Expected behavior

The CLI/protocol should not allow a BTC source swap to enter a state where funds are sent but the reservation TTL is too short for the required confirmation policy.

Possible fixes:

  • extend reservation TTL for BTC source swaps to cover the required confirmation window plus margin
  • reduce BTC confirmation requirement or make it configurable by risk policy
  • prevent auto-send when required_confirmations * btc_block_time exceeds remaining reservation TTL
  • after BTC tx broadcast, extend/finalize reservation automatically until confirmation can initiate the swap
  • surface a hard preflight error instead of a warning when the confirmation window cannot fit inside the reservation TTL

Impact

This creates a user-funds-loss condition: BTC can be sent to the miner, but no swap is initiated and no TAO is delivered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions