File tree 2 files changed +19
-0
lines changed
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -2486,6 +2486,10 @@ std::unique_ptr<FlatSigningProvider> DescriptorScriptPubKeyMan::GetSigningProvid
2486
2486
FlatSigningProvider master_provider;
2487
2487
master_provider.keys = GetKeys ();
2488
2488
m_wallet_descriptor.descriptor ->ExpandPrivate (index , master_provider, *out_keys);
2489
+
2490
+ // Always include musig_secnonces as this descriptor may have a participant private key
2491
+ // but not a musig() descriptor
2492
+ out_keys->musig2_secnonces = &m_musig2_secnonces;
2489
2493
}
2490
2494
2491
2495
return out_keys;
Original file line number Diff line number Diff line change 10
10
#include < common/signmessage.h>
11
11
#include < common/types.h>
12
12
#include < logging.h>
13
+ #include < musig.h>
13
14
#include < node/types.h>
14
15
#include < psbt.h>
15
16
#include < script/descriptor.h>
@@ -603,6 +604,20 @@ class DescriptorScriptPubKeyMan : public ScriptPubKeyMan
603
604
// ! Number of pre-generated keys/scripts (part of the look-ahead process, used to detect payments)
604
605
int64_t m_keypool_size GUARDED_BY (cs_desc_man){DEFAULT_KEYPOOL_SIZE};
605
606
607
+ /* * Map of a session id to MuSig2 secnonce
608
+ *
609
+ * Stores MuSig2 secnonces while the MuSig2 signing session is still ongoing.
610
+ * Note that these secnonces must not be reused. In order to avoid being tricked into
611
+ * reusing a nonce, this map is held only in memory and must not be written to disk.
612
+ * The side effect is that signing sessions cannot persist across restarts, but this
613
+ * must be done in order to prevent nonce reuse.
614
+ *
615
+ * The session id is an arbitrary value set by the signer in order for the signing logic
616
+ * to find ongoing signing sessions. It is the SHA256 of aggregate xonly key, + participant pubkey + sighash.
617
+ */
618
+ // TODO: Check thread safety of this
619
+ mutable std::map<uint256, MuSig2SecNonce> m_musig2_secnonces;
620
+
606
621
bool AddDescriptorKeyWithDB (WalletBatch& batch, const CKey& key, const CPubKey &pubkey) EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man);
607
622
608
623
KeyMap GetKeys () const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man);
You can’t perform that action at this time.
0 commit comments