Repository navigation
Conversation
…W#1875) The node lets an asset be unregistered once CA.LockPeriod has passed since it was burned (processor.cpp: m_LockHeight + CA.LockPeriod > h means locked). The wallet pre-checked with WalletAsset::CanRollback, i.e. MaxRollback, instead. Both are 1440 on mainnet, so it didn't show there, but on a network with a different --CA.LockPeriod the wallet followed MaxRollback: with a shorter lock period it refused (AssetLocked) although the node would accept, with a longer one it sent a tx the node rejects. That's why BeamMW#1875 found that --CA.LockPeriod "only works together with --MaxRollback". Add WalletAsset::IsLocked(h) with the node's rule and use it for unregistering. CanRollback stays where it's about rollbacks (asset info confirmation).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: the wallet allows unregistering an asset once
CA.LockPeriodhas passed, the same rule the node enforces, instead of waiting forMaxRollback.Why: the node checks
m_LockHeight + CA.LockPeriod > h(node/processor.cpp:4227), butAssetUnregisterTransactionpre-checked withWalletAsset::CanRollback, which ism_LockHeight + MaxRollback > h. On mainnet both are 1440, so nobody noticed. On a network with a different--CA.LockPeriod:AssetLockedalthough the node would accept it;That's what #1875 observed ("to change
--CA.LockPeriodyou also need--MaxRollback"). It's a wallet bug, not a documentation gap.How to see the bug: on a test network started with, for example,
--CA.LockPeriod=10(defaultMaxRollback1440), burn an asset completely, wait 11 blocks, and runbeam-wallet asset_unreg --asset_id N. Master fails withAssetLockeduntil 1440 blocks have passed; this PR succeeds after 11 blocks, which is when the node accepts it. In code: comparenode/processor.cpp:4227withaunregister_transaction.cpp:120on master.Improvement
How: a new
WalletAsset::IsLocked(h)uses the node's rule and is used for unregistering.CanRollbackstays where it really is about rollbacks (asset info confirmation inbase_transaction.cpp).Testing: new
TestAssetLockPeriodinwallet_assets_testcovers LockPeriod/MaxRollback = 10/20, 20/10 and 20/20. IfIsLockedis made to followMaxRollback(the old rule), 2 checks fail. The existing asset flow (register, issue, burn, unregister of a locked asset, then unregister after the lock period) passes unchanged; its only failure is the known macOS-only check at line 195, which passes in CI. Fork CI (running): https://github.com/vsnation/beam/actions/runs/Fixes #1875