Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Fix problem with libpqxx 7.3.0 upgrade #9884

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions plugins/blockvault_client_plugin/postgres_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ bool postgres_backend::propose_constructed_block(std::pair<uint32_t, uint32_t> w
pqxx::binarystring previous_block_id_blob(previous_block_id.data(), previous_block_id.size());
w.exec_prepared0("insert_constructed_block", watermark.first, watermark.second, lib, block_id_blob,
previous_block_id_blob, obj.id(), block_content.size());
auto r = w.exec_prepared1("get_block_insertion_result", obj.id());
obj.write(block_content.data(), block_content.size());
w.commit();
return true;
auto r = w.exec_prepared("get_block_insertion_result", obj.id());
if (!r.empty()) {
obj.write(block_content.data(), block_content.size());
w.commit();
return true;
}
} catch (const pqxx::unexpected_rows&) {
} catch (const pqxx::unique_violation&) {
} catch (const pqxx::serialization_failure&) {
Expand All @@ -105,11 +107,12 @@ bool postgres_backend::append_external_block(uint32_t block_num, uint32_t lib, c
pqxx::binarystring previous_block_id_blob(previous_block_id.data(), previous_block_id.size());
w.exec_prepared0("insert_external_block", block_num, lib, block_id_blob, previous_block_id_blob, obj.id(),
block_content.size());
auto r = w.exec_prepared1("get_block_insertion_result", obj.id());
obj.write(block_content.data(), block_content.size());
w.commit();
return true;

auto r = w.exec_prepared("get_block_insertion_result", obj.id());
if (!r.empty()) {
obj.write(block_content.data(), block_content.size());
w.commit();
return true;
}
} catch (const pqxx::unexpected_rows&) {
} catch (const pqxx::unique_violation&) {
} catch (const pqxx::serialization_failure&) {
Expand Down