fix(key-wallet): correct AssetLockTx structure per DIP-00X#659
fix(key-wallet): correct AssetLockTx structure per DIP-00X#659xdustinface merged 1 commit intov0.42-devfrom
Conversation
The asset-lock builder in key-wallet produced transactions that masternodes refused to IS-lock. Four issues: 1. `AssetLockPayload.version` was 0 — must be 1. 2. `tx.output[0]` was the credit output (p2pkh), but per DIP-00X that position must hold an OP_RETURN burn carrying the total locked amount. Credit outputs live only in the payload. Moved burn output construction into `ManagedWalletInfo::build_asset_lock`. 3. BIP-69 output sorting in `TransactionBuilder::build` moved the change output into position 0 (change is typically smaller than the burn), breaking the structural requirement. Added a `preserve_output_order` builder option and set it in `build_asset_lock`. 4. Tx wire version was the builder default (2) instead of the special-tx version 3. Symptom: self-broadcast asset-lock txs never received an `InstantLockReceived` event. Network-visible broadcasts succeeded, peers relayed them into mempool, but masternodes rejected them as invalid asset-lock transactions and never signed an IS-lock. Verified against `dash-evo-tool` e2e tests on testnet: identity_create and related tests go green after this fix.
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 57 minutes and 37 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v0.42-dev #659 +/- ##
=============================================
- Coverage 68.08% 68.07% -0.01%
=============================================
Files 319 319
Lines 67646 67661 +15
=============================================
+ Hits 46057 46061 +4
- Misses 21589 21600 +11
|
ZocoLini
left a comment
There was a problem hiding this comment.
nice, were you able to send the transaction??
Summary
The asset-lock builder produced transactions that masternodes refused to IS-lock. Four related issues, all fixed in this PR:
AssetLockPayload.versionwas0— must be1per DIP-00X.tx.output[0]was the credit p2pkh output, but per DIP-00X that position must hold anOP_RETURNburn carrying the total locked amount. Credit outputs live only in the special-transaction payload. Burn output construction is moved intoManagedWalletInfo::build_asset_lock.TransactionBuilder::buildmoved the change output into position 0 (change is typically smaller than the burn), breaking the structural requirement from (2). Adds askip_bip69_sortbuilder option and sets it inbuild_asset_lock.2); special-tx version must be3.Symptom
Self-broadcast asset-lock txs never received an
InstantLockReceivedevent. Network-visible broadcasts succeeded, peers relayed them into mempool, but masternodes rejected them as invalid asset-lock transactions and never signed an IS-lock.Verification
Confirmed against
dash-evo-toole2e tests on testnet —identity_createand related tests go green after this fix.Extracted from
Cherry-picked from
feat/platform-wallet2(draft PR #655) so it can land independently.Test plan
cargo build -p key-wallet --all-featurescargo test -p key-wallet --all-features --lib— 459 passed / 0 failedcargo test -p key-wallet --all-features --lib asset_lock— 11 passed / 0 failedkey-wallet/src/wallet/managed_wallet_info/{asset_lock_builder, transaction_builder}.rs, +65 / −19).🤖 Extracted with Claude Code