-
-
Notifications
You must be signed in to change notification settings - Fork 33
fix: incorrect witness status in state_all method for RBF scenarios #318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: incorrect witness status in state_all method for RBF scenarios #318
Conversation
Signed-off-by: will-bitlightlabs <jayabb@bitlightlabs.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #318 +/- ##
========================================
- Coverage 38.8% 38.7% -0.1%
========================================
Files 11 11
Lines 1733 1734 +1
========================================
- Hits 672 671 -1
- Misses 1061 1063 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Not sure this is a correct way. First, the status of an output in state object is not defined only by the witness status of the last transaction, but by the minimum status of all witness transactions leading in the history. So the original code was correct; with the new version re-orgs won't work. Second, when a new transaction is created, it gets "tentative" status. When an RBF transaction is created, we have two tentative statues. The wallet has to run I assume the original "bug" report ignores the sync operation, and thus gets the state ambiguity. |
Thank you for the detailed explanation! I understand your concern about the status calculation logic. However, I want to clarify that test case, it did execute the sync operation before checking state_all. Even after the sync operation, the unbroadcasted RBF transaction still shows Mined status instead of the expected Archived status. The broadcasted transaction correctly shows Mined. |
|
Ok, after more careful consideration I found that your approach is correct: we create an independent state entry for each of the witness variants, thus we need to use a specific witness status, not an aggregated one. However, it seems there was some other bug on top of the one you have discovered, and I tried to fix it as well in 884edb2 Please check does it works with the test |
I tested the fix in commit 884edb2, but unfortunately there's a new issue now. The Looking at the test output:
It seems like the fix |
884edb2 to
e6c1e09
Compare
|
Ok, I think your original PR improves things: indeed we need to use a witness-specific status. So I am merging it - and the rest of work I moved to the new PR #319 |
dr-orlovsky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK: e6c1e09
PR Description
Summary
This PR fixes a bug in the
state_allmethod where unbroadcasted RBF (Replace-By-Fee) transactions were incorrectly marked withMinedstatus instead of their actualArchivedstatus.Problem Description
In RBF scenarios, when a sender creates multiple transactions (original + replacement) but only broadcasts one of them, the
state_allmethod was returning incorrect witness status for unbroadcasted transactions. Specifically:ArchivedstatusMinedstatusRoot Cause
The issue was in
rgb-std/src/contract.rswhere the state collection logic was not properly querying the actual witness status for each witness ID. Instead, it was using a potentially incorrect or hardcoded status value.Solution
Before (problematic code):
After (fixed code):