mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-09 06:09:48 +02:00
wallet: Keep secnonces in DescriptorScriptPubKeyMan
This commit is contained in:
@@ -1256,6 +1256,10 @@ std::unique_ptr<FlatSigningProvider> DescriptorScriptPubKeyMan::GetSigningProvid
|
||||
FlatSigningProvider master_provider;
|
||||
master_provider.keys = GetKeys();
|
||||
m_wallet_descriptor.descriptor->ExpandPrivate(index, master_provider, *out_keys);
|
||||
|
||||
// Always include musig_secnonces as this descriptor may have a participant private key
|
||||
// but not a musig() descriptor
|
||||
out_keys->musig2_secnonces = &m_musig2_secnonces;
|
||||
}
|
||||
|
||||
return out_keys;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <common/signmessage.h>
|
||||
#include <common/types.h>
|
||||
#include <logging.h>
|
||||
#include <musig.h>
|
||||
#include <node/types.h>
|
||||
#include <psbt.h>
|
||||
#include <script/descriptor.h>
|
||||
@@ -295,6 +296,19 @@ private:
|
||||
//! Number of pre-generated keys/scripts (part of the look-ahead process, used to detect payments)
|
||||
int64_t m_keypool_size GUARDED_BY(cs_desc_man){DEFAULT_KEYPOOL_SIZE};
|
||||
|
||||
/** Map of a session id to MuSig2 secnonce
|
||||
*
|
||||
* Stores MuSig2 secnonces while the MuSig2 signing session is still ongoing.
|
||||
* Note that these secnonces must not be reused. In order to avoid being tricked into
|
||||
* reusing a nonce, this map is held only in memory and must not be written to disk.
|
||||
* The side effect is that signing sessions cannot persist across restarts, but this
|
||||
* must be done in order to prevent nonce reuse.
|
||||
*
|
||||
* The session id is an arbitrary value set by the signer in order for the signing logic
|
||||
* to find ongoing signing sessions. It is the SHA256 of aggregate xonly key, + participant pubkey + sighash.
|
||||
*/
|
||||
mutable std::map<uint256, MuSig2SecNonce> m_musig2_secnonces;
|
||||
|
||||
bool AddDescriptorKeyWithDB(WalletBatch& batch, const CKey& key, const CPubKey &pubkey) EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man);
|
||||
|
||||
KeyMap GetKeys() const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man);
|
||||
|
||||
Reference in New Issue
Block a user