Repository navigation
fix(key-wallet): load unparsable sent addresses as None - #1280
Conversation
Dash Platform persists `TransactionRecord`s with `bincode::serde`, where `OutputDetail.address` is stored as the address display string. When a stored string no longer parses, the whole record fails to decode and the Platform wallet load aborts. This already happens for testnet and devnet witness addresses, which display with the `tb` prefix while `Address::from_str` only accepts `td`. `OutputDetail` now decodes through `StoredOutputDetail`, which keeps the address as text until the role is known. On a `Sent` or `Unspendable` output an unparsable address loads as `None` with a warning, since a counterparty address is only informational and the full transaction stays in the record. On a `Received` or `Change` output it still fails the load, because those addresses are always our own P2PKH addresses and Platform derives UTXOs from them. Serialization and the stored encoding are unchanged.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
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. |
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1280 +/- ##
==========================================
+ Coverage 80.75% 81.05% +0.29%
==========================================
Files 291 291
Lines 77899 78057 +158
==========================================
+ Hits 62911 63270 +359
+ Misses 14988 14787 -201
|
|
Bots are done — your move: post |
|
@CodeRabbit review |
Action not completed
|
ZocoLini
left a comment
There was a problem hiding this comment.
Approving: together with #400, this solves the issue I raised.
This only fixes this one case, though. Platform persists our structs directly with bincode, and TransactionRecord includes both key-wallet and dash types, so any field we add, remove or change can break loading existing records, and every refactor here has to keep that in mind.
The same thing already happened with the Core v24 update: I had to modify the consensus structures, which broke serialization/deserialization, so I had to implement those pipelines by hand instead of using derive as we did before.
It would be better to address that directly. Maybe Platform could persist its own structs and map them from ours, so we can change key-wallet and dash freely. This doesn't need to block this PR.
|
@ZocoLini I opened #5713. |
Dash Platform persists
TransactionRecords withbincode::serde, whereOutputDetail.addressis stored as the address display string. When a stored string no longer parses, the whole record fails to decode and the Platform wallet load aborts. This already happens for testnet and devnet witness addresses, which display with thetbprefix whileAddress::from_stronly acceptstd.OutputDetailnow decodes throughStoredOutputDetail, which keeps the address as text until the role is known. On aSentorUnspendableoutput an unparsable address loads asNonewith a warning, since a counterparty address is only informational and the full transaction stays in the record. On aReceivedorChangeoutput it still fails the load, because those addresses are always our own P2PKH addresses and Platform derives UTXOs from them. Serialization and the stored encoding are unchanged.PR Hygiene ·
49fd223/self-reviewedWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.