mirror of
https://github.com/logos-blockchain/logos-blockchain-module.git
synced 2026-06-10 02:19:28 +00:00
Standardise blend_join_as_core_node return behaviour.
This commit is contained in:
parent
782ef8f61c
commit
315d63e8ec
@ -25,7 +25,7 @@ public:
|
||||
const QString& optionalTipHex
|
||||
) = 0;
|
||||
virtual QStringList wallet_get_known_addresses() = 0;
|
||||
virtual int blend_join_as_core_node(
|
||||
virtual QString blend_join_as_core_node(
|
||||
const QString& providerIdHex,
|
||||
const QString& zkIdHex,
|
||||
const QString& lockedNoteIdHex,
|
||||
|
||||
@ -264,33 +264,29 @@ QStringList LogosBlockchainModule::wallet_get_known_addresses() {
|
||||
return out;
|
||||
}
|
||||
|
||||
int LogosBlockchainModule::blend_join_as_core_node(
|
||||
QString LogosBlockchainModule::blend_join_as_core_node(
|
||||
const QString& providerIdHex,
|
||||
const QString& zkIdHex,
|
||||
const QString& lockedNoteIdHex,
|
||||
const QStringList& locators
|
||||
) {
|
||||
if (!node) {
|
||||
qWarning() << "Could not execute the operation: The node is not running.";
|
||||
return 1;
|
||||
return QStringLiteral("Error: The node is not running.");
|
||||
}
|
||||
|
||||
const QByteArray providerIdBytes = parseAddressHex(providerIdHex);
|
||||
if (providerIdBytes.isEmpty() || providerIdBytes.size() != kAddressBytes) {
|
||||
qCritical() << "blend_join_as_core_node: Invalid providerId (64 hex characters required).";
|
||||
return 2;
|
||||
return QStringLiteral("Error: Invalid providerId (64 hex characters required).");
|
||||
}
|
||||
|
||||
const QByteArray zkIdBytes = parseAddressHex(zkIdHex);
|
||||
if (zkIdBytes.isEmpty() || zkIdBytes.size() != kAddressBytes) {
|
||||
qCritical() << "blend_join_as_core_node: Invalid zkId (64 hex characters required).";
|
||||
return 3;
|
||||
return QStringLiteral("Error: Invalid zkId (64 hex characters required).");
|
||||
}
|
||||
|
||||
const QByteArray lockedNoteIdBytes = parseAddressHex(lockedNoteIdHex);
|
||||
if (lockedNoteIdBytes.isEmpty() || lockedNoteIdBytes.size() != kAddressBytes) {
|
||||
qCritical() << "blend_join_as_core_node: Invalid lockedNoteId (64 hex characters required).";
|
||||
return 4;
|
||||
return QStringLiteral("Error: Invalid lockedNoteId (64 hex characters required).");
|
||||
}
|
||||
|
||||
// QString is UTF-16, but the FFI requires UTF-8.
|
||||
@ -315,12 +311,12 @@ int LogosBlockchainModule::blend_join_as_core_node(
|
||||
);
|
||||
if (!is_ok(&error)) {
|
||||
qCritical() << "Failed to join as core node. Error:" << error;
|
||||
return 5;
|
||||
return QStringLiteral("Error: Failed to join as core node: ") + QString::number(error);
|
||||
}
|
||||
|
||||
const QByteArray declarationIdBytes(reinterpret_cast<const char*>(&value), sizeof(value));
|
||||
qInfo() << "Successfully joined as core node. DeclarationId:" << declarationIdBytes.toHex();
|
||||
return 0;
|
||||
return QString::fromUtf8(declarationIdBytes.toHex());
|
||||
}
|
||||
|
||||
QString LogosBlockchainModule::get_block(const QString& headerIdHex) {
|
||||
|
||||
@ -46,7 +46,7 @@ public:
|
||||
const QString& optionalTipHex
|
||||
);
|
||||
Q_INVOKABLE QStringList wallet_get_known_addresses() override;
|
||||
Q_INVOKABLE int blend_join_as_core_node(
|
||||
Q_INVOKABLE QString blend_join_as_core_node(
|
||||
const QString& providerIdHex,
|
||||
const QString& zkIdHex,
|
||||
const QString& lockedNoteIdHex,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user