Commit 8e7ba7f
committed
HACK: Wire per-swap BTC/XMR adapters into startAdaptorMatches.
Core.New builds the AdaptorSwapManager with Send:NoopSender and no
BTC or XMR asset adapters, with a comment saying they'd be installed
later by per-asset wiring - but no wiring code ever landed. Every
orchestrator started from a match therefore got AssetBTC=nil and
panicked on the first FundBroadcastTaproot call:
panic: runtime error: invalid memory address or nil pointer
...(*Orchestrator).handleKeysReceived orchestrator.go:620
Work around it with two per-swap builders invoked inline before
StartSwap:
- client/core/adaptorswap_bridge.go: buildAdaptorBTCAdapter reads
DCRDEX_ADAPTOR_BTC_{RPC,USER,PASS} env vars, constructs a
btcd/rpcclient.Client against the simnet bitcoind RPC, and wraps
it in BTCRPCAdapter with a poll-for-confirm waitConfirm. Returns
nil if env vars unset.
- client/core/adaptorswap_xmr_bridge.go (xmr tag): buildAdaptorXMR
Adapter looks up the connected xmr.ExchangeWallet from Core's
wallets map and wraps it in XMRWalletAdapter.
- client/core/adaptorswap_xmr_bridge_noxmr.go (!xmr tag): stub that
returns nil so non-xmr builds still compile.
- startAdaptorMatches: sets cfg.AssetBTC / cfg.AssetXMR from the
builders before calling StartSwap. With these wired, the initiator
can fund + broadcast the lockTx and both sides can exercise the
XMR wallet adapter.
Still needed for production (README TODO #5): expose the BTC wallet's
rpcclient.Client on bisonw's BTC asset wallet so env-var side-channels
are not required. Drop the env lookup and source the client from the
connected wallet.1 parent 0e6450f commit 8e7ba7f
3 files changed
Lines changed: 124 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
401 | 402 | | |
402 | 403 | | |
403 | 404 | | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
404 | 433 | | |
405 | 434 | | |
406 | 435 | | |
| |||
414 | 443 | | |
415 | 444 | | |
416 | 445 | | |
| 446 | + | |
| 447 | + | |
417 | 448 | | |
418 | 449 | | |
419 | 450 | | |
| |||
618 | 649 | | |
619 | 650 | | |
620 | 651 | | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
621 | 713 | | |
622 | 714 | | |
623 | 715 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
0 commit comments