@@ -48,9 +48,12 @@ static UniValue AddDomainEntry(const JSONRPCRequest& request, BDAP::ObjectType b
48
48
if (GetDomainEntry (txDomainEntry.vchFullObjectPath (), txDomainEntry))
49
49
throw std::runtime_error (" BDAP_ADD_PUBLIC_ENTRY_RPC_ERROR: ERRCODE: 3500 - " + txDomainEntry.GetFullObjectPath () + _ (" entry already exists. Can not add duplicate." ));
50
50
51
- // now using GetKeyFromPool instead of MakeNewKey
51
+ LogPrintf (" DEBUGGER ED %s - made it here! BEFORE\n " , __func__);
52
+
53
+ // now using GetKeyFromPool instead of MakeNewKey
52
54
CPubKey pubWalletKey;
53
- if (!pwalletMain->GetKeyFromPool (pubWalletKey, true ))
55
+ CharString vchDHTPubKey;
56
+ if (!pwalletMain->GetEdKeyFromPool (pubWalletKey, vchDHTPubKey, true ))
54
57
throw JSONRPCError (RPC_WALLET_KEYPOOL_RAN_OUT, " Error: Keypool ran out, please call keypoolrefill first" );
55
58
CKeyID keyWalletID = pubWalletKey.GetID ();
56
59
CDynamicAddress walletAddress = CDynamicAddress (keyWalletID);
@@ -62,14 +65,20 @@ static UniValue AddDomainEntry(const JSONRPCRequest& request, BDAP::ObjectType b
62
65
txDomainEntry.WalletAddress = vchWalletAddress;
63
66
64
67
// TODO: Add ability to pass in the DHT public key
65
- CKeyEd25519 privDHTKey;
66
- CharString vchDHTPubKey = privDHTKey.GetPubKey ();
68
+ // CKeyEd25519 privDHTKey;
69
+ // CharString vchDHTPubKey = privDHTKey.GetPubKey();
67
70
68
- if (pwalletMain && !pwalletMain->AddDHTKey (privDHTKey, vchDHTPubKey))
69
- throw std::runtime_error (" BDAP_ADD_PUBLIC_ENTRY_RPC_ERROR: ERRCODE: 3503 - " + _ (" Error adding ed25519 key to wallet for BDAP" ));
71
+ // if (pwalletMain && !pwalletMain->AddDHTKey(privDHTKey, vchDHTPubKey))
72
+ // throw std::runtime_error("BDAP_ADD_PUBLIC_ENTRY_RPC_ERROR: ERRCODE: 3503 - " + _("Error adding ed25519 key to wallet for BDAP"));
70
73
71
74
txDomainEntry.DHTPublicKey = vchDHTPubKey;
72
- pwalletMain->SetAddressBook (privDHTKey.GetID (), strObjectID, " bdap-dht-key" );
75
+ CKeyID vchDHTPubKeyID = GetIdFromCharVector (vchDHTPubKey); // CKeyID(Hash160(vchDHTPubKey.begin(), vchDHTPubKey.end()));
76
+ // pwalletMain->SetAddressBook(privDHTKey.GetID(), strObjectID, "bdap-dht-key"); //need private key for this?
77
+ pwalletMain->SetAddressBook (vchDHTPubKeyID, strObjectID, " bdap-dht-key" );
78
+
79
+ LogPrintf (" DEBUGGER ED %s - made it here! AFTER\n " , __func__);
80
+
81
+
73
82
74
83
// TODO: Add ability to pass in the link address
75
84
// TODO: Use stealth address for the link address so linking will be private
@@ -147,8 +156,13 @@ static UniValue AddDomainEntry(const JSONRPCRequest& request, BDAP::ObjectType b
147
156
testDomainEntry.nVersion , testDomainEntry.GetFullObjectPath (), stringFromVch (testDomainEntry.CommonName ),
148
157
stringFromVch (testDomainEntry.OrganizationalUnit ), stringFromVch (testDomainEntry.DHTPublicKey ));
149
158
}
150
- std::string strPubKeyHash = privDHTKey.GetHash ().ToString ();
151
- std::string strPubKeyID = privDHTKey.GetID ().ToString ();
159
+ std::string strPubKeyHash = GetHashFromCharVector (vchDHTPubKey).ToString ();
160
+ std::string strPubKeyID = GetIdFromCharVector (vchDHTPubKey).ToString ();
161
+
162
+ LogPrintf (" DEBUGGER ED %s - GetHashFromCharVector [%s]\n " , __func__,strPubKeyHash);
163
+ LogPrintf (" DEBUGGER ED %s - GetIdFromCharVector [%s]\n " , __func__,strPubKeyID);
164
+
165
+
152
166
oName.push_back (Pair (" dht_pubkey_hash" , strPubKeyHash));
153
167
oName.push_back (Pair (" dht_pubkey_id" , strPubKeyID));
154
168
return oName;
@@ -858,10 +872,14 @@ UniValue mybdapaccounts(const JSONRPCRequest& request)
858
872
if (!pwalletMain->GetDHTPubKeys (vvchDHTPubKeys))
859
873
return NullUniValue;
860
874
875
+ LogPrintf (" DEBUGGER ED %s - size [%d]\n " ,__func__,vvchDHTPubKeys.size ());
876
+
877
+
861
878
UniValue result (UniValue::VOBJ);
862
879
uint32_t nCount = 1 ;
863
880
for (const std::vector<unsigned char >& vchPubKey : vvchDHTPubKeys) {
864
881
CDomainEntry entry;
882
+ LogPrintf (" DEBUGGER ED %s - PubKey [%s]\n " ,__func__,stringFromVch (vchPubKey));
865
883
if (pDomainEntryDB->ReadDomainEntryPubKey (vchPubKey, entry)) {
866
884
UniValue oAccount (UniValue::VOBJ);
867
885
if (BuildBDAPJson (entry, oAccount, false )) {
0 commit comments