Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. LLM Linter (✨ experimental)Possible typos and grammar issues:
2026-11-24 20:08:07 |
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
e2aa2e6 to
632e42a
Compare
| } | ||
| tempKeystore.AddKey(key); | ||
| CPubKey pubkey = key.GetPubKey(); | ||
| tempKeystore.keys.emplace(pubkey.GetID(), key); |
There was a problem hiding this comment.
The key path works correctly. A helper function would maybe be handy same as the AddKey one but since we are only using it in a single place, I guess expanding it here may be fine.
bitcoin-tx testing
Creating unsigned transaction
ratedg@0xratedg:~/projects/contributions/bitcoin/build2/bin$ TX=$(./bitcoin-tx -regtest -create \
in=7dc357e7ba70b0b503c9a12f4a293add0b1d230e08de3cad83e142737746c4b8:1 \
outaddr=0.9:mmhnpJgEDuPxTmw6Nuu5Ms2xmP21n6XoCi)
ratedg@0xratedg:~/projects/contributions/bitcoin/build2/bin$Signing the transaction
ratedg@0xratedg:~/projects/contributions/bitcoin/build2/bin$ TX=$(./bitcoin-tx -regtest "$TX" \
set=prevtxs:"[{\"txid\":\"7dc357e7ba70b0b503c9a12f4a293add0b1d230e08de3cad83e142737746c4b8\",\"vout\":1,\"scriptPubKey\":\"76a91443dd6b08400c8e763c5e1b8520957e132cac817088ac\",\"amount\":1}]" \
set=privatekeys:"[\"cNPgXXtoNEkhZd6txFEPQvWMF8gfvyG15JnYxgtrbQgiesHPwERA\"]" \
sign=ALL)Confirming
ratedg@0xratedg:~/projects/contributions/bitcoin/build2/bin$ ./bitcoin-cli -regtest testmempoolaccept "[\"$TX\"]" 0
[
{
"txid": "96aba7a976963a610c82d8fe5ba0f5da1837d64e875127fc74b3253c2de1b9d9",
"wtxid": "96aba7a976963a610c82d8fe5ba0f5da1837d64e875127fc74b3253c2de1b9d9",
"allowed": true,
"vsize": 191,
"fees": {
"base": 0.10000000
}
}
]The values used were generated from bitcoin 24.0 binary from the commands
| UniValue v = prevOut["redeemScript"]; | ||
| std::vector<unsigned char> rsData(ParseHexUV(v, "redeemScript")); | ||
| CScript redeemScript(rsData.begin(), rsData.end()); | ||
| tempKeystore.AddCScript(redeemScript); |
There was a problem hiding this comment.
Following this function, the maximum script element size condition is being checked redeemScript.size() > MAX_SCRIPT_ELEMENT_SIZE
| std::vector<unsigned char> rsData(ParseHexUV(v, "redeemScript")); | ||
| CScript redeemScript(rsData.begin(), rsData.end()); | ||
| tempKeystore.AddCScript(redeemScript); | ||
| tempKeystore.scripts.emplace(CScriptID(redeemScript), redeemScript); |
There was a problem hiding this comment.
It was thoughtful to remove the check since pay-to-witness-script-hash doesn't share the same MAX_SCRIPT_ELEMENT_SIZE limit as the pay-to-script-hash.
The script path works correctly.
bitcoin-tx testing
Creating unsigned transaction
ratedg@0xratedg:~/projects/contributions/bitcoin/build2/bin$ TX=$(./bitcoin-tx -regtest -create \
in=f4e3e878eefc814436f3cf27752bb1896934dcd8fa8663ffd8187e9358d0c03b:0 \
outaddr=0.9:mwbmunN2ojMDLGWwZJuqPNX3dfyuvNqheF)
ratedg@0xratedg:~/projects/contributions/bitcoin/build2/bin$ Signing the transaction
ratedg@0xratedg:~/projects/contributions/bitcoin/build2/bin$ TX=$(./bitcoin-tx -regtest "$TX" \
set=prevtxs:"[{\"txid\":\"f4e3e878eefc814436f3cf27752bb1896934dcd8fa8663ffd8187e9358d0c03b\",\"vout\":0,\"scriptPubKey\":\"a91417c74210b483bf6dd004660b05b356b6c3aa12dc87\",\"redeemScript\":\"522103804969501e96ed27704e3d82bef2b5ef04a53d80683ea1a4dbbb9d2e63b7e09921034c988b448e0fa6a1fcc09f33a20abf5ab0ca3e393fa717bb251493dd2819412752ae\",\"amount\":1.00000000}]" \
set=privatekeys:"[\"cTzVvTMsbz75L9mF15FdM6AZWe22EXstSoQGhBGNMjYRjm28N7Yx\",\"cNc7X8u7KCubwor6rsuSMFdNCCEwK2qSkbHv5WFTPDWmBdRNWHgG\"]" \
sign=ALL)Confirming
ratedg@0xratedg:~/projects/contributions/bitcoin/build2/bin$ ./bitcoin-cli -regtest testmempoolaccept "[\"$TX\"]" 0
[
{
"txid": "6286887e90dfd4aebcbdec8d1949593ce46ed6b0d10a03e8f84db6fe7d52a914",
"wtxid": "6286887e90dfd4aebcbdec8d1949593ce46ed6b0d10a03e8f84db6fe7d52a914",
"allowed": true,
"vsize": 302,
"fees": {
"base": 0.10000000
}
}
]The values used were generated from bitcoin 24.0 binary from the commands
| if (!registers.contains("privatekeys")) | ||
| throw std::runtime_error("privatekeys register variable must be set."); | ||
| FillableSigningProvider tempKeystore; | ||
| FlatSigningProvider tempKeystore; |
There was a problem hiding this comment.
appropriate for the self-contained bitcoin-tx
| } | ||
|
|
||
| const FillableSigningProvider& keystore = tempKeystore; | ||
| const FlatSigningProvider& keystore = tempKeystore; |
There was a problem hiding this comment.
appropriate for the self-contained bitcoin-tx
632e42a to
0396996
Compare
|
Concept ACK 0396996 to containerise the codepath related to legacy wallets while discouraging usage of this seemingly outdated signing provider. |
0396996 to
814fdcb
Compare
814fdcb to
b68a383
Compare
b68a383 to
2ecac41
Compare
2ecac41 to
52dcf96
Compare
Instead of using FillableSigningProvider, use a FlatSigningProvider.
FillableSigningProvider is not a necessary part of the tests and FlatSigningProvider is sufficient.
bitcoin-tx does not need to use FillableSigningProvider, it can use FlatSigningProvider and inline ImplicitlyLearnRelatedKeyScripts.
The only real user of FillableSigningProvider is LegacyDataSPKM. Instead of having it be a separate class which LegacyDataSPKM subclasses, move the implementation directly into LegacyDataSPKM and have LegacyDataSPKM be a subclass of SigningProvider.
52dcf96 to
73373d1
Compare

FillableSigningProviderwas initially extracted from the wallet in order to produce theSigningProviderencapsulation system that we use today for the wallet and for providing key material to signing. It's primary user was the legacy wallet, but it was also being used as a convenience in a few other places. Since the legacy wallet is removed, there is no need to keep it around as a separate class. Instead, the things that it was doing can be inlined intoLegacyDataSPKMwhere the functionality is actually being used to support migrating legacy wallets.The remaining uses are tests and the
bitcoin-txtool, some of which were relying on the implicit addition of segwit scripts when adding a key. However, these can also useFlatSigningProviderwith explicitly adding the segwit scripts when necessary, and have thusly been converted to do so.