mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-09 15:37:00 -04:00
wallet: Keep secnonces in DescriptorScriptPubKeyMan
This commit is contained in:
parent
b7b302bad2
commit
d971824dc1
2 changed files with 19 additions and 0 deletions
|
@ -2496,6 +2496,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>
|
||||
|
@ -605,6 +606,20 @@ 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.
|
||||
*/
|
||||
// TODO: Check thread safety of this
|
||||
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);
|
||||
|
|
Loading…
Add table
Reference in a new issue