Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13115389
D4493.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Subscribers
None
D4493.diff
View Options
diff --git a/src/script/sign.h b/src/script/sign.h
--- a/src/script/sign.h
+++ b/src/script/sign.h
@@ -128,7 +128,7 @@
/// BIP 174 style partial signatures for the input. May contain all
/// signatures necessary for producing a final scriptSig.
std::map<CKeyID, SigPair> signatures;
- std::map<CKeyID, CPubKey> misc_pubkeys;
+ std::map<CKeyID, std::pair<CPubKey, KeyOriginInfo>> misc_pubkeys;
SignatureData() {}
explicit SignatureData(const CScript &script) : scriptSig(script) {}
diff --git a/src/script/sign.cpp b/src/script/sign.cpp
--- a/src/script/sign.cpp
+++ b/src/script/sign.cpp
@@ -52,10 +52,6 @@
static bool GetPubKey(const SigningProvider &provider, SignatureData &sigdata,
const CKeyID &address, CPubKey &pubkey) {
- if (provider.GetPubKey(address, pubkey)) {
- sigdata.misc_pubkeys.emplace(pubkey.GetID(), pubkey);
- return true;
- }
// Look for pubkey in all partial sigs
const auto it = sigdata.signatures.find(address);
if (it != sigdata.signatures.end()) {
@@ -65,7 +61,16 @@
// Look for pubkey in pubkey list
const auto &pk_it = sigdata.misc_pubkeys.find(address);
if (pk_it != sigdata.misc_pubkeys.end()) {
- pubkey = pk_it->second;
+ pubkey = pk_it->second.first;
+ return true;
+ }
+ // Query the underlying provider
+ if (provider.GetPubKey(address, pubkey)) {
+ KeyOriginInfo info;
+ if (provider.GetKeyOrigin(address, info)) {
+ sigdata.misc_pubkeys.emplace(
+ address, std::make_pair(pubkey, std::move(info)));
+ }
return true;
}
return false;
@@ -494,7 +499,7 @@
sigdata.redeem_script = redeem_script;
}
for (const auto &key_pair : hd_keypaths) {
- sigdata.misc_pubkeys.emplace(key_pair.first.GetID(), key_pair.first);
+ sigdata.misc_pubkeys.emplace(key_pair.first.GetID(), key_pair);
}
}
@@ -514,6 +519,9 @@
if (redeem_script.empty() && !sigdata.redeem_script.empty()) {
redeem_script = sigdata.redeem_script;
}
+ for (const auto &entry : sigdata.misc_pubkeys) {
+ hd_keypaths.emplace(entry.second);
+ }
}
void PSBTInput::Merge(const PSBTInput &input) {
@@ -542,7 +550,7 @@
sigdata.redeem_script = redeem_script;
}
for (const auto &key_pair : hd_keypaths) {
- sigdata.misc_pubkeys.emplace(key_pair.first.GetID(), key_pair.first);
+ sigdata.misc_pubkeys.emplace(key_pair.first.GetID(), key_pair);
}
}
@@ -550,6 +558,9 @@
if (redeem_script.empty() && !sigdata.redeem_script.empty()) {
redeem_script = sigdata.redeem_script;
}
+ for (const auto &entry : sigdata.misc_pubkeys) {
+ hd_keypaths.emplace(entry.second);
+ }
}
bool PSBTOutput::IsNull() const {
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -5127,15 +5127,9 @@
}
SignatureData sigdata;
- complete &= SignPSBTInput(HidingSigningProvider(pwallet, !sign, false),
- *psbtx.tx, input, sigdata, i, sighash_type);
-
- // Get public key paths
- if (bip32derivs) {
- for (const auto &pubkey_it : sigdata.misc_pubkeys) {
- AddKeypathToMap(pwallet, pubkey_it.first, input.hd_keypaths);
- }
- }
+ complete &=
+ SignPSBTInput(HidingSigningProvider(pwallet, !sign, !bip32derivs),
+ *psbtx.tx, input, sigdata, i, sighash_type);
}
// Fill in the bip32 keypaths and redeemscripts for the outputs so that
@@ -5155,15 +5149,9 @@
MutableTransactionSignatureCreator creator(
psbtx.tx.get_ptr(), 0, out.nValue, SigHashType().withForkId());
- ProduceSignature(*pwallet, creator, out.scriptPubKey, sigdata);
+ ProduceSignature(HidingSigningProvider(pwallet, true, !bip32derivs),
+ creator, out.scriptPubKey, sigdata);
psbt_out.FromSignatureData(sigdata);
-
- // Get public key paths
- if (bip32derivs) {
- for (const auto &pubkey_it : sigdata.misc_pubkeys) {
- AddKeypathToMap(pwallet, pubkey_it.first, psbt_out.hd_keypaths);
- }
- }
}
return complete;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 1, 11:01 (16 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5187453
Default Alt Text
D4493.diff (4 KB)
Attached To
D4493: Pass HD path data through SignatureData
Event Timeline
Log In to Comment