diff --git a/packages/js-drive/lib/identity/masternode/handleNewMasternodeFactory.js b/packages/js-drive/lib/identity/masternode/handleNewMasternodeFactory.js index 61253a10ae0..ab3a2487ecb 100644 --- a/packages/js-drive/lib/identity/masternode/handleNewMasternodeFactory.js +++ b/packages/js-drive/lib/identity/masternode/handleNewMasternodeFactory.js @@ -2,7 +2,6 @@ const Address = require('@dashevo/dashcore-lib/lib/address'); const Script = require('@dashevo/dashcore-lib/lib/script'); const { KeyType, Identifier } = require('@dashevo/wasm-dpp'); const createOperatorIdentifier = require('./createOperatorIdentifier'); -const createVotingIdentifier = require('./createVotingIdentifier'); /** * @@ -97,22 +96,23 @@ function handleNewMasternodeFactory( } } - const votingPubKeyHash = Buffer.from(proRegTxPayload.keyIDVoting, 'hex').reverse(); + // const votingPubKeyHash = Buffer.from(proRegTxPayload.keyIDVoting, 'hex').reverse(); + // TODO: Disabled until we have uniq keys support in DPP // don't need to create a separate Identity in case we don't have // voting public key (keyIDVoting === keyIDOwner) - if (!votingPubKeyHash.equals(ownerPublicKeyHash)) { - const votingIdentifier = createVotingIdentifier(masternodeEntry); - - createdEntities.push( - await createMasternodeIdentity( - blockInfo, - votingIdentifier, - votingPubKeyHash, - KeyType.ECDSA_HASH160, - ), - ); - } + // if (!votingPubKeyHash.equals(ownerPublicKeyHash)) { + // const votingIdentifier = createVotingIdentifier(masternodeEntry); + // + // createdEntities.push( + // await createMasternodeIdentity( + // blockInfo, + // votingIdentifier, + // votingPubKeyHash, + // KeyType.ECDSA_HASH160, + // ), + // ); + // } return { createdEntities, diff --git a/packages/js-drive/lib/identity/masternode/synchronizeMasternodeIdentitiesFactory.js b/packages/js-drive/lib/identity/masternode/synchronizeMasternodeIdentitiesFactory.js index cd4148dc47a..e699df55076 100644 --- a/packages/js-drive/lib/identity/masternode/synchronizeMasternodeIdentitiesFactory.js +++ b/packages/js-drive/lib/identity/masternode/synchronizeMasternodeIdentitiesFactory.js @@ -146,19 +146,19 @@ function synchronizeMasternodeIdentitiesFactory( result = mergeEntities(result, affectedEntities); } - const previousVotingMnEntry = previousMNList.find((previousMnListEntry) => ( - previousMnListEntry.proRegTxHash === mnEntry.proRegTxHash - && previousMnListEntry.votingAddress !== mnEntry.votingAddress - )); - - if (previousVotingMnEntry) { - const affectedEntities = await handleUpdatedVotingAddress( - mnEntry, - blockInfo, - ); - - result = mergeEntities(result, affectedEntities); - } + // const previousVotingMnEntry = previousMNList.find((previousMnListEntry) => ( + // previousMnListEntry.proRegTxHash === mnEntry.proRegTxHash + // && previousMnListEntry.votingAddress !== mnEntry.votingAddress + // )); + // + // if (previousVotingMnEntry) { + // const affectedEntities = await handleUpdatedVotingAddress( + // mnEntry, + // blockInfo, + // ); + // + // result = mergeEntities(result, affectedEntities); + // } if (mnEntry.payoutAddress) { const mnEntryWithChangedPayoutAddress = previousMNList.find((previousMnListEntry) => ( diff --git a/packages/js-drive/test/unit/identity/masternode/handleNewMasternodeFactory.spec.js b/packages/js-drive/test/unit/identity/masternode/handleNewMasternodeFactory.spec.js index b2a5867ae47..62d967da0bc 100644 --- a/packages/js-drive/test/unit/identity/masternode/handleNewMasternodeFactory.spec.js +++ b/packages/js-drive/test/unit/identity/masternode/handleNewMasternodeFactory.spec.js @@ -9,7 +9,6 @@ const handleNewMasternodeFactory = require('../../../../lib/identity/masternode/ const getSmlFixture = require('../../../../lib/test/fixtures/getSmlFixture'); const createOperatorIdentifier = require('../../../../lib/identity/masternode/createOperatorIdentifier'); const BlockInfo = require('../../../../lib/blockExecution/BlockInfo'); -const createVotingIdentifier = require('../../../../lib/identity/masternode/createVotingIdentifier'); describe('handleNewMasternodeFactory', () => { let handleNewMasternode; @@ -65,12 +64,12 @@ describe('handleNewMasternodeFactory', () => { const result = await handleNewMasternode(masternodeEntry, dataContract, blockInfo); - expect(result.createdEntities).to.have.lengthOf(2); + expect(result.createdEntities).to.have.lengthOf(1); // TODO: should be 2 expect(result.updatedEntities).to.have.lengthOf(0); expect(result.removedEntities).to.have.lengthOf(0); expect(result.createdEntities[0].toObject()).to.deep.equal(identityFixture.toObject()); - expect(result.createdEntities[1].toObject()).to.deep.equal(identityFixture.toObject()); + // expect(result.createdEntities[1].toObject()).to.deep.equal(identityFixture.toObject()); expect(fetchTransactionMock).to.be.calledOnceWithExactly(masternodeEntry.proRegTxHash); expect(createMasternodeIdentityMock.getCall(0)).to.be.calledWithExactly( @@ -81,12 +80,12 @@ describe('handleNewMasternodeFactory', () => { payoutScript, ); - expect(createMasternodeIdentityMock.getCall(1)).to.be.calledWithExactly( - blockInfo, - Identifier.from('GVYoKVDd29gbmHzbVGepFjCbdymCS5Jq26CCiLnWNL6C'), - Buffer.from('6262626262626262626262626262626262626262', 'hex'), - KeyType.ECDSA_HASH160, - ); + // expect(createMasternodeIdentityMock.getCall(1)).to.be.calledWithExactly( + // blockInfo, + // Identifier.from('GVYoKVDd29gbmHzbVGepFjCbdymCS5Jq26CCiLnWNL6C'), + // Buffer.from('6262626262626262626262626262626262626262', 'hex'), + // KeyType.ECDSA_HASH160, + // ); expect(createRewardShareDocumentMock).to.not.be.called(); }); @@ -126,24 +125,24 @@ describe('handleNewMasternodeFactory', () => { const result = await handleNewMasternode(masternodeEntry, dataContract, blockInfo); - expect(result.createdEntities).to.have.lengthOf(3); + expect(result.createdEntities).to.have.lengthOf(2); // TODO: Should be 3 expect(result.updatedEntities).to.have.lengthOf(0); expect(result.removedEntities).to.have.lengthOf(0); expect(result.createdEntities[0].toJSON()).to.deep.equal(identityFixture.toJSON()); expect(result.createdEntities[1].toJSON()).to.deep.equal(identityFixture.toJSON()); - expect(result.createdEntities[2].toJSON()).to.deep.equal(identityFixture.toJSON()); + // expect(result.createdEntities[2].toJSON()).to.deep.equal(identityFixture.toJSON()); const operatorIdentifier = createOperatorIdentifier(masternodeEntry); const operatorPayoutAddress = Address.fromString(masternodeEntry.operatorPayoutAddress); const operatorPayoutScript = new Script(operatorPayoutAddress); - const votingIdentifier = createVotingIdentifier(masternodeEntry); + // const votingIdentifier = createVotingIdentifier(masternodeEntry); const payoutAddress = Address.fromString(masternodeEntry.payoutAddress); const payoutScript = new Script(payoutAddress); expect(fetchTransactionMock).to.be.calledOnceWithExactly(masternodeEntry.proRegTxHash); - expect(createMasternodeIdentityMock).to.be.calledThrice(); + expect(createMasternodeIdentityMock).to.be.calledTwice(); // TODO: Should be calledThrice expect(createMasternodeIdentityMock.getCall(0)).to.be.calledWithExactly( blockInfo, Identifier.from('HYyu6DdUQyiHZwzeWpmahu7AUrsEF9MKkRcrdQnKeNSj'), @@ -160,12 +159,12 @@ describe('handleNewMasternodeFactory', () => { operatorPayoutScript, ); - expect(createMasternodeIdentityMock.getCall(2)).to.be.calledWithExactly( - blockInfo, - votingIdentifier, - Buffer.from('6262626262626262626262626262626262626262', 'hex'), - KeyType.ECDSA_HASH160, - ); + // expect(createMasternodeIdentityMock.getCall(2)).to.be.calledWithExactly( + // blockInfo, + // votingIdentifier, + // Buffer.from('6262626262626262626262626262626262626262', 'hex'), + // KeyType.ECDSA_HASH160, + // ); expect(createRewardShareDocumentMock).to.be.calledOnceWithExactly( dataContract,