Fix intermittent "fee cannot be less than vSize" errors and Firo EX address sends - #1426
Open
reubenyap wants to merge 5 commits into
Open
Fix intermittent "fee cannot be less than vSize" errors and Firo EX address sends#1426reubenyap wants to merge 5 commits into
reubenyap wants to merge 5 commits into
Conversation
The legacy fee paths estimate fees from a dummy build, then re-sign the final transaction. Signature length can differ between signings, so the final vSize occasionally exceeds the estimate and prepareSend throws "Transaction fee cannot be less than vSize" at 1 sat/vB rates. - _sendAllBuilder: apply the existing recalculate-from-final-tx loop to all tx types, not just mwebPegIn. Overridden and mweb/mwebPegOut fees (recalculated by the caller) still build once as before. - coinSelection two-output branch: replace the one-shot vSize - fee == 1 change adjustment with a loop that rebuilds until the fee covers the final signed size, dropping change and reverting to a single output if it would become dust. - singleOutputTxn: report the whole input excess as the fee instead of the smaller rate-based estimate. - fees getter: clamp server estimates below the coin's defaultFeeRate, consistent with the -1 fallback in ElectrumXClient.estimateFee, so a broken estimate cannot force the guard failure. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NFAYSbQoTjdbLmGwNJWzCj
_optimalCoinSelection parsed the recipient with bare coinlib.Address.fromString, which throws on Firo EX (exchange) addresses, so normal sends to them failed since the switch to coinlib coin selection. Share buildTransaction's EX fallback as _addressFromString and use it in both places. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NFAYSbQoTjdbLmGwNJWzCj
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.
Fixes intermittent fee-versus-vSize failures in legacy coin selection and restores Firo EX address sends through optimal selection.
Changes
Complementary to #1422, which fixes OP_RETURN sizing in optimal selection.
Validation
flutter test --no-pub test/wallets/electrumx_interface_test.dart: 4 passed.flutter analyze --no-pub lib/wallets/crypto_currency/coins/ecash.dart lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart test/wallets/electrumx_interface_test.dart: no errors or warnings; 13 existing line-length infos.dart format --output=none --set-exit-if-changedon the three analyzed files: clean.git diff refs/codex/pr1426-base HEAD --check: clean.flutter test --no-pub: 344 passed, 4 skipped, and 1 unrelated existing failure increate_pin_view_screen_test.dart.A native desktop build was not completed because CMake is unavailable in the local environment.
GitHub Test run 33382300891 passed setup and changed-file formatting, then finished with 100 tests passed and 81 failed. The failures are compilation cascades because the workflow's fork fallback key stub omits four unrelated exchange constants. That workflow repair remains outside this PR.