Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
amydevs committed Aug 20, 2024
1 parent c240bb4 commit 644da69
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/nodes/NodeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import { MDNS, events as mdnsEvents, utils as mdnsUtils } from '@matrixai/mdns';
import * as nodesUtils from './utils';
import * as nodesEvents from './events';
import * as nodesErrors from './errors';
import * as agentErrors from './agent/errors';
import NodeConnectionQueue from './NodeConnectionQueue';
import Token from '../tokens/Token';
import * as keysUtils from '../keys/utils';
Expand Down Expand Up @@ -1552,7 +1553,7 @@ class NodeManager {
requestingNodeId: NodeId,
input: AgentRPCRequestParams<AgentClaimMessage>,
tran?: DBTransaction,
): Promise<AgentRPCResponseResult<{ success: boolean }>> {
): Promise<AgentRPCResponseResult<{ success: true }>> {
if (tran == null) {
return this.db.withTransactionF((tran) =>
this.handleVerifyClaimNetwork(requestingNodeId, input, tran),
Expand Down Expand Up @@ -1620,8 +1621,12 @@ class NodeManager {
}
}

if (!success) {
throw new agentErrors.ErrorNodesClaimNetworkVerificationFailed();
}

return {
success: success,
success: true,
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/nodes/agent/handlers/NodesClaimNetworkVerify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ class NodesClaimNetworkVerify extends UnaryHandler<
nodeManager: NodeManager;
},
AgentRPCRequestParams<AgentClaimMessage>,
AgentRPCResponseResult<{ success: boolean }>
AgentRPCResponseResult<{ success: true }>
> {
public handle = async (
input: AgentRPCRequestParams<AgentClaimMessage>,
_cancel,
meta: Record<string, JSONValue> | undefined,
): Promise<AgentRPCResponseResult<{ success: boolean }>> => {
): Promise<AgentRPCResponseResult<{ success: true }>> => {
const requestingNodeId = agentUtils.nodeIdFromMeta(meta);
if (requestingNodeId == null) {
throw new agentErrors.ErrorAgentNodeIdMissing();
Expand Down

0 comments on commit 644da69

Please sign in to comment.