diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-05-17 01:23:05 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-18 23:25:46 +0200 |
commit | 8bc307024e1331811ccdea34d4eb5eb737b7c891 (patch) | |
tree | 0779386c62c98bf3b30565cc9db9486308b1c5a6 | |
parent | 8015d182a7b58642cc253956e885c746c49d8d60 (diff) |
Fix bug where addData/addUser doesn't get send to listening peers
-rw-r--r-- | src/Database.cpp | 4 | ||||
-rw-r--r-- | tests/main.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/Database.cpp b/src/Database.cpp index 065f441..68f7b9c 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -461,7 +461,7 @@ namespace odhtdb DataView encryptedDataView((char*)requestData.data + serializer.getBuffer().size(), requestData.size - serializer.getBuffer().size()); databaseStorage.appendStorage(*nodeInfo.getRequestHash(), requestDataHash, DatabaseOperation::ADD_DATA, newActionCounter, userToPerformActionWith.getPublicKey(), timestampCombined, (u8*)stagedAddObject.data, stagedAddObject.size, encryptedDataView); - DhtKey dhtKey(requestDataHash); + DhtKey dhtKey(*nodeInfo.getRequestHash()); Value addDataValue((u8*)stagedAddObject.data, stagedAddObject.size); node.put(dhtKey.getNewDataListenerKey(), move(addDataValue), [](bool ok) { @@ -495,7 +495,7 @@ namespace odhtdb DataView additionalDataView((void*)(static_cast<const char*>(requestData.data) + additionalDataOffset), requestData.size - additionalDataOffset); databaseStorage.appendStorage(*nodeInfo.getRequestHash(), requestDataHash, DatabaseOperation::ADD_USER, newActionCounter, userToPerformActionWith.getPublicKey(), timestampCombined, (u8*)stagedAddObject.data, stagedAddObject.size, additionalDataView); - DhtKey dhtKey(requestDataHash); + DhtKey dhtKey(*nodeInfo.getRequestHash()); Value addDataValue((u8*)stagedAddObject.data, stagedAddObject.size); node.put(dhtKey.getNewDataListenerKey(), move(addDataValue), [](bool ok) { diff --git a/tests/main.cpp b/tests/main.cpp index e4438e7..5d527fe 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -193,7 +193,7 @@ int main() database.addUser(databaseNode, *adminUserKey, localUserKeyPair.getPublicKey(), databaseCreateResponse->getNodeAdminGroupId()->getView()); database.addData(databaseNode, localUserKeyPair, DataView{ (void*)"hello, aaald!", 13 }); - database.seed(databaseNode, DatabaseFetchOrder::NEWEST_FIRST); + database.seed(databaseNode, DatabaseFetchOrder::OLDEST_FIRST); this_thread::sleep_for(chrono::seconds(3)); assertEquals(1, createNodeCounter); @@ -263,7 +263,7 @@ int main() Database database("bootstrap.ring.cx", 4222, storagePath, callbackFuncs); database.loadNode(*databaseNode.getRequestHash()); - database.seed(databaseNode, DatabaseFetchOrder::NEWEST_FIRST); + database.seed(databaseNode, DatabaseFetchOrder::OLDEST_FIRST); this_thread::sleep_for(chrono::seconds(3)); assertEquals(1, createNodeCounter); |