Repository navigation
Conversation
- `create_tx`, `create_sp_tx` and `create_dns_tx` each decoded `--add_data`/`--add_string` into a `PushBytesBuf` in the handler, with the same block. Parse both arguments with clap value parsers. - Malformed `--add_data` base64 is now rejected at argument parsing (exit 2) before a wallet is loaded, rather than when building (exit 1).
create_tx` could build transactions over Bitcoin Core's 400,000 wu `MAX_STANDARD_TX_WEIGHT`, which no default node relays. The `--add_data` and `--add_string` docs claimed an 80 byte limit that was never enforced and is no longer Core's default. These changes: - Enforce 400k WU limit across `create_tx`, `create_dns_tx`, `bump_fee`, and `create_sp_tx`. - Estimate PSBT weight using `max_weight_to_satisfy` per input for unsigned flows (`create_tx`, `create_dns_tx`, `bump_fee`). - Check exact weight post-signing in `create_sp_tx`. - Update `--add_data` and `--add_string` docs to remove references to the deprecated 80-byte data limit. Bitcoin Core v30+ evaluates weight limits prior to data carrier limits.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #361 +/- ##
==========================================
+ Coverage 61.46% 62.42% +0.95%
==========================================
Files 23 23
Lines 3989 4077 +88
==========================================
+ Hits 2452 2545 +93
+ Misses 1537 1532 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
since you are already working on this i'll love you to address issue #360 in this same pr |
This branch has not been deployed
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.
Description
wallet create_txcould build transactions that are non-standard under Bitcoin Core's default policy, so they failed only at broadcast, after signing:MAX_STANDARD_TX_WEIGHT(400,000 wu / 100,000 vB). As shown in fix transaction creation input validation and fee rate calculation #326, a 99,994 byte--add_stringpayload produced a 100,150 vB tx that the node rejected withtx-size.--add_dataand--add_stringdocumented "max 80 bytes" but was never enforced, and it stopped being Core's default in v30.This PR rejects such transactions when they are built, with an error giving the weight and the limit. The check covers
create_tx,create_dns_tx,bump_fee(where a fee bump can add inputs and push a tx over), andcreate_sp_tx.It also parses
--add_data/--add_stringwith clap value parsers, the same way as--fee_rate. That removes three copies of the same decoding block.Fixes #339
Notes to the reviewers
IsStandardTxcheckstx-sizebeforedatacarrier, andMAX_OP_RETURN_RELAYis defined asMAX_STANDARD_TX_WEIGHT / WITNESS_SCALE_FACTOR. OP_RETURN bytes are non-witness, so at default settings any tx that passes the weight check also passesdatacarrier. A separate check would be dead code.create_tx,create_dns_txandbump_feereturn unsigned PSBTs. Their weight is estimated with each wallet input'smax_weight_to_satisfy(), the same worst case coin selection uses. The estimate is an upper bound: a tx under it can't go over once signed. In return, a segwit tx within about 1 wu per input of the limit may be rejected.create_sp_txsigns internally, so it checks the exact weight. Inputs are looked up throughspk_index()rather thanget_utxo(), because a fee bump's inputs are already spent.tr,wpkh,sh(wpkh),pkhand a fee bump, and check that the estimate bounds the signed weight tightly.--add_database64 now exits 2 at argument parsing instead of 1, consistent with--fee_rate.Changelog notice
create_tx,create_dns_tx,create_sp_txandbump_feebuilding transactions over Bitcoin Core's 400,000 wu (100,000 vB) standard weight limit; they are now rejected when built, counting the witnesses still to be signedChecklists
All Submissions:
cargo fmtandcargo clippybefore committingBugfixes: