@@ -80,7 +80,7 @@ bool PermitsUncompressed(IsMineSigVersion sigversion)
80
80
return sigversion == IsMineSigVersion::TOP || sigversion == IsMineSigVersion::P2SH;
81
81
}
82
82
83
- bool HaveKeys (const std::vector<valtype>& pubkeys, const LegacyScriptPubKeyMan & keystore)
83
+ bool HaveKeys (const std::vector<valtype>& pubkeys, const LegacyDataSPKM & keystore)
84
84
{
85
85
for (const valtype& pubkey : pubkeys) {
86
86
CKeyID keyID = CPubKey (pubkey).GetID ();
@@ -227,7 +227,7 @@ isminetype LegacyScriptPubKeyMan::IsMine(const CScript& script) const
227
227
assert (false );
228
228
}
229
229
230
- bool LegacyScriptPubKeyMan ::CheckDecryptionKey (const CKeyingMaterial& master_key)
230
+ bool LegacyDataSPKM ::CheckDecryptionKey (const CKeyingMaterial& master_key)
231
231
{
232
232
{
233
233
LOCK (cs_KeyStore);
@@ -581,7 +581,7 @@ int64_t LegacyScriptPubKeyMan::GetTimeFirstKey() const
581
581
return nTimeFirstKey;
582
582
}
583
583
584
- std::unique_ptr<SigningProvider> LegacyScriptPubKeyMan ::GetSolvingProvider (const CScript& script) const
584
+ std::unique_ptr<SigningProvider> LegacyDataSPKM ::GetSolvingProvider (const CScript& script) const
585
585
{
586
586
return std::make_unique<LegacySigningProvider>(*this );
587
587
}
@@ -717,7 +717,7 @@ void LegacyScriptPubKeyMan::UpdateTimeFirstKey(int64_t nCreateTime)
717
717
NotifyFirstKeyTimeChanged (this , nTimeFirstKey);
718
718
}
719
719
720
- bool LegacyScriptPubKeyMan ::LoadKey (const CKey& key, const CPubKey &pubkey)
720
+ bool LegacyDataSPKM ::LoadKey (const CKey& key, const CPubKey &pubkey)
721
721
{
722
722
return AddKeyPubKeyInner (key, pubkey);
723
723
}
@@ -769,7 +769,7 @@ bool LegacyScriptPubKeyMan::AddKeyPubKeyWithDB(WalletBatch& batch, const CKey& s
769
769
return true ;
770
770
}
771
771
772
- bool LegacyScriptPubKeyMan ::LoadCScript (const CScript& redeemScript)
772
+ bool LegacyDataSPKM ::LoadCScript (const CScript& redeemScript)
773
773
{
774
774
/* A sanity check was added in pull #3843 to avoid adding redeemScripts
775
775
* that never can be redeemed. However, old wallets may still contain
@@ -784,18 +784,36 @@ bool LegacyScriptPubKeyMan::LoadCScript(const CScript& redeemScript)
784
784
return FillableSigningProvider::AddCScript (redeemScript);
785
785
}
786
786
787
+ void LegacyDataSPKM::LoadKeyMetadata (const CKeyID& keyID, const CKeyMetadata& meta)
788
+ {
789
+ LOCK (cs_KeyStore);
790
+ mapKeyMetadata[keyID] = meta;
791
+ }
792
+
787
793
void LegacyScriptPubKeyMan::LoadKeyMetadata (const CKeyID& keyID, const CKeyMetadata& meta)
788
794
{
789
795
LOCK (cs_KeyStore);
796
+ LegacyDataSPKM::LoadKeyMetadata (keyID, meta);
790
797
UpdateTimeFirstKey (meta.nCreateTime );
791
- mapKeyMetadata[keyID] = meta;
798
+ }
799
+
800
+ void LegacyDataSPKM::LoadScriptMetadata (const CScriptID& script_id, const CKeyMetadata& meta)
801
+ {
802
+ LOCK (cs_KeyStore);
803
+ m_script_metadata[script_id] = meta;
792
804
}
793
805
794
806
void LegacyScriptPubKeyMan::LoadScriptMetadata (const CScriptID& script_id, const CKeyMetadata& meta)
795
807
{
796
808
LOCK (cs_KeyStore);
809
+ LegacyDataSPKM::LoadScriptMetadata (script_id, meta);
797
810
UpdateTimeFirstKey (meta.nCreateTime );
798
- m_script_metadata[script_id] = meta;
811
+ }
812
+
813
+ bool LegacyDataSPKM::AddKeyPubKeyInner (const CKey& key, const CPubKey& pubkey)
814
+ {
815
+ LOCK (cs_KeyStore);
816
+ return FillableSigningProvider::AddKeyPubKey (key, pubkey);
799
817
}
800
818
801
819
bool LegacyScriptPubKeyMan::AddKeyPubKeyInner (const CKey& key, const CPubKey &pubkey)
@@ -823,7 +841,7 @@ bool LegacyScriptPubKeyMan::AddKeyPubKeyInner(const CKey& key, const CPubKey &pu
823
841
return true ;
824
842
}
825
843
826
- bool LegacyScriptPubKeyMan ::LoadCryptedKey (const CPubKey &vchPubKey, const std::vector<unsigned char > &vchCryptedSecret, bool checksum_valid)
844
+ bool LegacyDataSPKM ::LoadCryptedKey (const CPubKey &vchPubKey, const std::vector<unsigned char > &vchCryptedSecret, bool checksum_valid)
827
845
{
828
846
// Set fDecryptionThoroughlyChecked to false when the checksum is invalid
829
847
if (!checksum_valid) {
@@ -833,7 +851,7 @@ bool LegacyScriptPubKeyMan::LoadCryptedKey(const CPubKey &vchPubKey, const std::
833
851
return AddCryptedKeyInner (vchPubKey, vchCryptedSecret);
834
852
}
835
853
836
- bool LegacyScriptPubKeyMan ::AddCryptedKeyInner (const CPubKey &vchPubKey, const std::vector<unsigned char > &vchCryptedSecret)
854
+ bool LegacyDataSPKM ::AddCryptedKeyInner (const CPubKey &vchPubKey, const std::vector<unsigned char > &vchCryptedSecret)
837
855
{
838
856
LOCK (cs_KeyStore);
839
857
assert (mapKeys.empty ());
@@ -861,13 +879,13 @@ bool LegacyScriptPubKeyMan::AddCryptedKey(const CPubKey &vchPubKey,
861
879
}
862
880
}
863
881
864
- bool LegacyScriptPubKeyMan ::HaveWatchOnly (const CScript &dest) const
882
+ bool LegacyDataSPKM ::HaveWatchOnly (const CScript &dest) const
865
883
{
866
884
LOCK (cs_KeyStore);
867
885
return setWatchOnly.count (dest) > 0 ;
868
886
}
869
887
870
- bool LegacyScriptPubKeyMan ::HaveWatchOnly () const
888
+ bool LegacyDataSPKM ::HaveWatchOnly () const
871
889
{
872
890
LOCK (cs_KeyStore);
873
891
return (!setWatchOnly.empty ());
@@ -901,12 +919,12 @@ bool LegacyScriptPubKeyMan::RemoveWatchOnly(const CScript &dest)
901
919
return true ;
902
920
}
903
921
904
- bool LegacyScriptPubKeyMan ::LoadWatchOnly (const CScript &dest)
922
+ bool LegacyDataSPKM ::LoadWatchOnly (const CScript &dest)
905
923
{
906
924
return AddWatchOnlyInMem (dest);
907
925
}
908
926
909
- bool LegacyScriptPubKeyMan ::AddWatchOnlyInMem (const CScript &dest)
927
+ bool LegacyDataSPKM ::AddWatchOnlyInMem (const CScript &dest)
910
928
{
911
929
LOCK (cs_KeyStore);
912
930
setWatchOnly.insert (dest);
@@ -950,7 +968,7 @@ bool LegacyScriptPubKeyMan::AddWatchOnly(const CScript& dest, int64_t nCreateTim
950
968
return AddWatchOnly (dest);
951
969
}
952
970
953
- void LegacyScriptPubKeyMan ::LoadHDChain (const CHDChain& chain)
971
+ void LegacyDataSPKM ::LoadHDChain (const CHDChain& chain)
954
972
{
955
973
LOCK (cs_KeyStore);
956
974
m_hd_chain = chain;
@@ -971,14 +989,14 @@ void LegacyScriptPubKeyMan::AddHDChain(const CHDChain& chain)
971
989
m_hd_chain = chain;
972
990
}
973
991
974
- void LegacyScriptPubKeyMan ::AddInactiveHDChain (const CHDChain& chain)
992
+ void LegacyDataSPKM ::AddInactiveHDChain (const CHDChain& chain)
975
993
{
976
994
LOCK (cs_KeyStore);
977
995
assert (!chain.seed_id .IsNull ());
978
996
m_inactive_hd_chains[chain.seed_id ] = chain;
979
997
}
980
998
981
- bool LegacyScriptPubKeyMan ::HaveKey (const CKeyID &address) const
999
+ bool LegacyDataSPKM ::HaveKey (const CKeyID &address) const
982
1000
{
983
1001
LOCK (cs_KeyStore);
984
1002
if (!m_storage.HasEncryptionKeys ()) {
@@ -987,7 +1005,7 @@ bool LegacyScriptPubKeyMan::HaveKey(const CKeyID &address) const
987
1005
return mapCryptedKeys.count (address) > 0 ;
988
1006
}
989
1007
990
- bool LegacyScriptPubKeyMan ::GetKey (const CKeyID &address, CKey& keyOut) const
1008
+ bool LegacyDataSPKM ::GetKey (const CKeyID &address, CKey& keyOut) const
991
1009
{
992
1010
LOCK (cs_KeyStore);
993
1011
if (!m_storage.HasEncryptionKeys ()) {
@@ -1006,7 +1024,7 @@ bool LegacyScriptPubKeyMan::GetKey(const CKeyID &address, CKey& keyOut) const
1006
1024
return false ;
1007
1025
}
1008
1026
1009
- bool LegacyScriptPubKeyMan ::GetKeyOrigin (const CKeyID& keyID, KeyOriginInfo& info) const
1027
+ bool LegacyDataSPKM ::GetKeyOrigin (const CKeyID& keyID, KeyOriginInfo& info) const
1010
1028
{
1011
1029
CKeyMetadata meta;
1012
1030
{
@@ -1026,7 +1044,7 @@ bool LegacyScriptPubKeyMan::GetKeyOrigin(const CKeyID& keyID, KeyOriginInfo& inf
1026
1044
return true ;
1027
1045
}
1028
1046
1029
- bool LegacyScriptPubKeyMan ::GetWatchPubKey (const CKeyID &address, CPubKey &pubkey_out) const
1047
+ bool LegacyDataSPKM ::GetWatchPubKey (const CKeyID &address, CPubKey &pubkey_out) const
1030
1048
{
1031
1049
LOCK (cs_KeyStore);
1032
1050
WatchKeyMap::const_iterator it = mapWatchKeys.find (address);
@@ -1037,7 +1055,7 @@ bool LegacyScriptPubKeyMan::GetWatchPubKey(const CKeyID &address, CPubKey &pubke
1037
1055
return false ;
1038
1056
}
1039
1057
1040
- bool LegacyScriptPubKeyMan ::GetPubKey (const CKeyID &address, CPubKey& vchPubKeyOut) const
1058
+ bool LegacyDataSPKM ::GetPubKey (const CKeyID &address, CPubKey& vchPubKeyOut) const
1041
1059
{
1042
1060
LOCK (cs_KeyStore);
1043
1061
if (!m_storage.HasEncryptionKeys ()) {
@@ -1156,7 +1174,7 @@ void LegacyScriptPubKeyMan::DeriveNewChildKey(WalletBatch &batch, CKeyMetadata&
1156
1174
throw std::runtime_error (std::string (__func__) + " : writing HD chain model failed" );
1157
1175
}
1158
1176
1159
- void LegacyScriptPubKeyMan ::LoadKeyPool (int64_t nIndex, const CKeyPool &keypool)
1177
+ void LegacyDataSPKM ::LoadKeyPool (int64_t nIndex, const CKeyPool &keypool)
1160
1178
{
1161
1179
LOCK (cs_KeyStore);
1162
1180
if (keypool.m_pre_split ) {
@@ -1677,7 +1695,7 @@ std::set<CKeyID> LegacyScriptPubKeyMan::GetKeys() const
1677
1695
return set_address;
1678
1696
}
1679
1697
1680
- std::unordered_set<CScript, SaltedSipHasher> LegacyScriptPubKeyMan ::GetScriptPubKeys () const
1698
+ std::unordered_set<CScript, SaltedSipHasher> LegacyDataSPKM ::GetScriptPubKeys () const
1681
1699
{
1682
1700
LOCK (cs_KeyStore);
1683
1701
std::unordered_set<CScript, SaltedSipHasher> spks;
0 commit comments