Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

fix: getStatus wrong hashes serialization #362

Merged
merged 18 commits into from
May 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DRIVE_BRANCH=new-dpp
DASHMATE_BRANCH=update-dependencies
TEST_SUITE_BRANCH=new-dpp
SDK_BRANCH=new-dpp
#DRIVE_BRANCH=
#DASHMATE_BRANCH=
TEST_SUITE_BRANCH=update-wallet
#SDK_BRANCH=
6 changes: 3 additions & 3 deletions lib/grpcServer/handlers/core/getStatusHandlerFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ function getStatusHandlerFactory(coreRPCClient) {
chain.setName(blockchainInfoResponse.chain);
chain.setBlocksCount(blockchainInfoResponse.blocks);
chain.setHeadersCount(blockchainInfoResponse.headers);
chain.setBestBlockHash(blockchainInfoResponse.bestblockhash);
chain.setBestBlockHash(Buffer.from(blockchainInfoResponse.bestblockhash, 'hex'));
chain.setDifficulty(blockchainInfoResponse.difficulty);
chain.setChainWork(blockchainInfoResponse.chainwork);
chain.setChainWork(Buffer.from(blockchainInfoResponse.chainwork, 'hex'));
chain.setIsSynced(mnSyncStatusResponse.IsBlockchainSynced);
chain.setSyncProgress(blockchainInfoResponse.verificationprogress);

Expand All @@ -53,7 +53,7 @@ function getStatusHandlerFactory(coreRPCClient) {
const masternodeStatus = GetStatusResponse.Masternode.Status[masternodeStatusResponse.state];

masternode.setStatus(masternodeStatus);
masternode.setProTxHash(masternodeStatusResponse.proTxHash);
masternode.setProTxHash(Buffer.from(masternodeStatusResponse.proTxHash, 'hex'));
masternode.setPosePenalty(masternodeStatusResponse.dmnState.PoSePenalty);
masternode.setIsSynced(mnSyncStatusResponse.IsSynced);

Expand Down
9 changes: 6 additions & 3 deletions test/unit/grpcServer/handlers/core/getStatusHandlerFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,18 @@ describe('getStatusHandlerFactory', () => {
expect(chain.getName()).to.be.equal(blockchainInfo.chain);
expect(chain.getBlocksCount()).to.be.equal(blockchainInfo.blocks);
expect(chain.getHeadersCount()).to.be.equal(blockchainInfo.headers);
expect(chain.getBestBlockHash()).to.be.equal(blockchainInfo.bestblockhash);
expect(chain.getBestBlockHash()).to.be.an.instanceOf(Buffer);
expect(chain.getBestBlockHash().toString('hex')).to.be.equal(blockchainInfo.bestblockhash);
expect(chain.getDifficulty()).to.be.equal(blockchainInfo.difficulty);
expect(chain.getChainWork()).to.be.equal(blockchainInfo.chainwork);
expect(chain.getChainWork()).to.be.an.instanceOf(Buffer);
expect(chain.getChainWork().toString('hex')).to.be.equal(blockchainInfo.chainwork);
expect(chain.getIsSynced()).to.be.equal(mnSyncInfo.IsBlockchainSynced);
expect(chain.getSyncProgress()).to.be.equal(blockchainInfo.verificationprogress);

const masternode = result.getMasternode();
expect(masternode.getStatus()).to.be.equal(GetStatusResponse.Masternode.Status.READY);
expect(masternode.getProTxHash()).to.be.equal(masternodeStatus.proTxHash);
expect(masternode.getProTxHash()).to.be.an.instanceOf(Buffer);
expect(masternode.getProTxHash().toString('hex')).to.be.equal(masternodeStatus.proTxHash);
expect(masternode.getPosePenalty()).to.be.equal(masternodeStatus.dmnState.PoSePenalty);
expect(masternode.getIsSynced()).to.be.equal(mnSyncInfo.IsSynced);
expect(masternode.getSyncProgress()).to.be.equal(1);
Expand Down