Make transaction sending fully async so the UI only reports success after broadcast completes
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Bắt đầu với BDKSwiftExampleWallet/Service/BDK Service/BDKService.swift và lần theo luồng gửi qua BuildTransactionViewModel.swift và BuildTransactionView.swift. Cập nhật luồng để việc ký và broadcast hoàn tất trước khi báo cáo thành công, loại bỏ heuristic về độ trễ cố định và xác minh rằng các lỗi vẫn ở màn hình gửi, trong khi các broadcast thành công sẽ hiển thị trạng thái thành công sau đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
The current send flow can report success before the transaction has actually been broadcast.
BDKClient.send is exposed as a synchronous throwing API, but the live implementation immediately starts an internal Task and returns without waiting for the async broadcast to finish. Because of that, the UI continues as if the send succeeded even though the real network operation is still in progress.
Why This Matters
This creates a user-facing correctness bug:
- The app can show a success state before the transaction is actually broadcast.
- Broadcast failures may be surfaced too late, or not in the right screen context.
- The user can be navigated away from the send screen even if the transaction was rejected.
- A wallet app should never optimistically confirm a send before the backend confirms success.
Current Behavior
BuildTransactionViewModel.send()callsbdkClient.send(...).- The live
BDKClient.sendimplementation starts a backgroundTaskand returns immediately. BuildTransactionViewModelthen postsTransactionSentright away.BuildTransactionViewwaits one second and assumes success if no error has appeared yet.
This means success is based on timing, not on the actual result of the broadcast.
Expected Behavior
The send flow should only report success after signing and broadcasting have completed successfully.
Proposed Fix
- Change the send API from synchronous to
async throwsacross the stack. - Make
BDKClient.sendawaitBDKService.send(...)directly instead of wrapping it in a detachedTask. - Update
BuildTransactionViewModel.send()to beasync. - In
BuildTransactionView, await the send call and only show the success UI after it returns successfully. - Remove the one-second timer-based success heuristic.
- Post wallet update notifications only after the async send has actually succeeded.
Suggested Acceptance Criteria
- A failed broadcast does not show the success checkmark.
- The user remains on the send screen when send fails.
- A successful broadcast shows success only after the async operation completes.
- No send-related state depends on fixed delays or race-prone background fire-and-forget tasks.
References
BDKSwiftExampleWallet/Service/BDK Service/BDKService.swiftBDKSwiftExampleWallet/View Model/Send/BuildTransactionViewModel.swiftBDKSwiftExampleWallet/View/Send/BuildTransactionView.swift
- Ngôn ngữ chính
- Swift
- Star
- 31
- Fork
- 16
- Merge trung bình
- 1 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của bitcoindevkit/BDKSwiftExampleWallet
-
chore: add codeowners fileĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 25/100
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
bitcoindevkit/BDKSwiftExampleWallet#352 · 1 bình luận ·
-
Add detailed log viewĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
bitcoindevkit/BDKSwiftExampleWallet#351 · 1 bình luận ·
-
experimental: eventsĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
bitcoindevkit/BDKSwiftExampleWallet#350 · 1 bình luận ·
Tất cả issue của bitcoindevkit/BDKSwiftExampleWallet
Issue tương tự
-
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
521xueweihan/HelloGitHub#3870 ·
-
🐛 bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
margelo/react-native-vision-camera#4211 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
TokenIterator.prepare drops LMOutput.State in the .logits branch, breaking generation for every VLMĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
ml-explore/mlx-swift-lm#681 ·
Maintainer thường phản hồi trong vòng 2 ngày