From b8b28ad7ece3104cda5854e3d32af62e0d9876f6 Mon Sep 17 00:00:00 2001 From: Kosta Korenkov Date: Thu, 6 Feb 2020 17:32:31 +0800 Subject: [PATCH] feat: adapt to new getPeriodByBlockHeight API (#171) BREAKING CHANGE --- lib/helpers.js | 4 ++-- lib/helpers.spec.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/helpers.js b/lib/helpers.js index 233428c..a6807d3 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -219,9 +219,9 @@ export function getYoungestInputTx(plasma, tx) { export function getProof(plasma, tx, periodOpts = {}) { return plasma.getPeriodByBlockHeight(tx.blockNumber) .then(periodData => { - if (periodData && periodData.length) { + if (periodData) { Object.assign(periodOpts, { - validatorData: periodData[0], + validatorData: periodData, }); } else { const msg = `No period data for the given tx. Height: ${tx.blockNumber}`; diff --git a/lib/helpers.spec.js b/lib/helpers.spec.js index 9492b2a..22db3b3 100644 --- a/lib/helpers.spec.js +++ b/lib/helpers.spec.js @@ -243,7 +243,7 @@ describe('helpers', () => { }, getPeriodByBlockHeight: n => { expect(n).to.be.equal(4); - return Promise.resolve([{ slotId: 0, validatorAddress: ADDR_1, casBitmap }]); + return Promise.resolve({ slotId: 0, validatorAddress: ADDR_1, casBitmap }); }, };