wallet: Keep secnonces in DescriptorScriptPubKeyMan
This commit is contained in:
1 parent
4a273edda0
commit
68ef954c4c
2 files changed
+18
No files matched your search
@@ -1256,6 +1256,10 @@ std::unique_ptr<FlatSigningProvider> DescriptorScriptPubKeyMan::GetSigningProvid
|
|||||||
FlatSigningProvider master_provider;
|
FlatSigningProvider master_provider;
|
||||||
master_provider.keys = GetKeys();
|
master_provider.keys = GetKeys();
|
||||||
m_wallet_descriptor.descriptor->ExpandPrivate(index, master_provider, *out_keys);
|
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;
|
return out_keys;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <common/signmessage.h>
|
#include <common/signmessage.h>
|
||||||
#include <common/types.h>
|
#include <common/types.h>
|
||||||
#include <logging.h>
|
#include <logging.h>
|
||||||
|
#include <musig.h>
|
||||||
#include <node/types.h>
|
#include <node/types.h>
|
||||||
#include <psbt.h>
|
#include <psbt.h>
|
||||||
#include <script/descriptor.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)
|
//! 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};
|
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);
|
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);
|
KeyMap GetKeys() const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man);
|
||||||
|
|||||||
Reference in new issue
Block a user