Skip to content

Commit

Permalink
fix(core-p2p): support common blocks with sha256 ids (#2317)
Browse files Browse the repository at this point in the history
  • Loading branch information
spkjp authored and faustbrian committed Mar 26, 2019
1 parent 4133d4e commit 1c5e64c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/core-p2p/src/server/versions/1/handlers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { app } from "@arkecosystem/core-container";
import { Blockchain, Database, Logger, P2P } from "@arkecosystem/core-interfaces";
import { TransactionGuard, TransactionPool } from "@arkecosystem/core-transaction-pool";
import { models, slots } from "@arkecosystem/crypto";
import { AjvWrapper, models, slots } from "@arkecosystem/crypto";
import pluralize from "pluralize";
import { monitor } from "../../../monitor";
import { schema } from "./schema";
Expand Down Expand Up @@ -78,10 +78,7 @@ export const getCommonBlocks = {

const blockchain = app.resolvePlugin<Blockchain.IBlockchain>("blockchain");

const ids = request.query.ids
.split(",")
.slice(0, 9)
.filter(id => id.match(/^\d+$/));
const ids = request.query.ids.split(",").filter(id => AjvWrapper.instance().validate({ blockId: {} }, id));

try {
const commonBlocks = await blockchain.database.getCommonBlocks(ids);
Expand Down

0 comments on commit 1c5e64c

Please sign in to comment.