Skip to content

Commit

Permalink
fix(p2p): store requests even when relaying them over p2p
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasGassmann committed Sep 18, 2020
1 parent 4e87ce3 commit 4c2520c
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export class ToExtensionMessageHandler extends MessageHandler {
beaconConnected: boolean
): Promise<void> {
logger.log('ToExtensionMessageHandler')

const deserialized: BeaconMessage = (await new Serializer().deserialize(data.payload as string)) as BeaconMessage
this.client.pendingRequests.push({ message: deserialized, connectionContext })

// TODO: Decide where to send the request to
// Use a map and check all known addresses
// We can only do this for the operation and the sign request
Expand All @@ -48,9 +52,6 @@ export class ToExtensionMessageHandler extends MessageHandler {

await this.client.popupManager.startPopup()

const deserialized: BeaconMessage = (await new Serializer().deserialize(data.payload as string)) as BeaconMessage
this.client.pendingRequests.push({ message: deserialized, connectionContext })

const enriched: To<BeaconRequestOutputMessage> = await to(this.enrichRequest(deserialized))

const sendError: (error: Error, errorType: BeaconErrorType) => Promise<void> = async (
Expand Down

0 comments on commit 4c2520c

Please sign in to comment.