Skip to content
This repository has been archived by the owner on Jun 7, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1126 from LiskHQ/1125-multisignature-transaction-…
Browse files Browse the repository at this point in the history
…should-update-the-memberpublickeys-property

Multisignature transaction should update the memberPublicKeys property for account - Closes #1125
  • Loading branch information
shuse2 authored Feb 22, 2019
2 parents e3c8bc0 + 55947b6 commit 7c224bf
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"balance": "94378900000",
"multimin": 2,
"multilifetime": 1,
"multisignatures": [
"membersPublicKeys": [
"40af643265a718844f3dac56ce17ae1d7d47d0a24a35a277a0a6cb0baaa1939f",
"d042ad3f1a5b042ddc5aa80c4267b5bfd3b4dda3a682da0a3ef7269409347adb",
"542fdc008964eacc580089271353268d655ab5ec2829687aadc278653fad33cf"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export class MultisignatureTransaction extends BaseTransaction {
const sender = store.account.get(this.senderId);

// Check if multisignatures already exists on account
if (sender.multisignatures && sender.multisignatures.length > 0) {
if (sender.membersPublicKeys && sender.membersPublicKeys.length > 0) {
errors.push(
new TransactionError(
'Register multisignature only allowed once per account.',
Expand All @@ -255,7 +255,7 @@ export class MultisignatureTransaction extends BaseTransaction {

const updatedSender = {
...sender,
multisignatures: this.asset.multisignature.keysgroup.map(key =>
membersPublicKeys: this.asset.multisignature.keysgroup.map(key =>
key.substring(1),
),
multimin: this.asset.multisignature.min,
Expand Down Expand Up @@ -289,7 +289,7 @@ export class MultisignatureTransaction extends BaseTransaction {
const sender = store.account.get(this.senderId);

const {
multisignatures,
membersPublicKeys,
multimin,
multilifetime,
...strippedSender
Expand Down
2 changes: 1 addition & 1 deletion packages/lisk-transactions/src/transaction_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface Account {
readonly delegate?: Delegate;
readonly publicKey?: string;
readonly secondPublicKey?: string;
readonly multisignatures?: ReadonlyArray<string>;
readonly membersPublicKeys?: ReadonlyArray<string>;
readonly multimin?: number;
readonly multilifetime?: number;
readonly username?: string;
Expand Down
7 changes: 3 additions & 4 deletions packages/lisk-transactions/src/utils/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ interface VerifyMultiSignatureResult {

const isMultisignatureAccount = (account: Account): boolean =>
!!(
account.multisignatures &&
account.multisignatures.length > 0 &&
account.membersPublicKeys &&
account.membersPublicKeys.length > 0 &&
account.multimin
);

Expand Down Expand Up @@ -158,7 +158,7 @@ export const verifyMultiSignatures = (
}

const { valid, errors } = validateMultisignatures(
sender.multisignatures as ReadonlyArray<string>,
sender.membersPublicKeys as ReadonlyArray<string>,
signatures,
sender.multimin as number,
transactionBytes,
Expand All @@ -177,7 +177,6 @@ export const verifyMultiSignatures = (
errors.length === 1 &&
errors[0] instanceof TransactionPendingError
) {

return {
status: MultisignatureStatus.PENDING,
errors,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Multisignature transaction class', () => {
validMultisignatureRegistrationTransaction,
);
const {
multisignatures,
membersPublicKeys,
multilifetime,
multimin,
...nonMultisignatureAccount
Expand Down Expand Up @@ -311,8 +311,8 @@ describe('Multisignature transaction class', () => {
it('should return error when keysgroup includes sender key', async () => {
const invalidSender = {
...multisignatureSender,
multisignatures: [
...(multisignatureSender as any).multisignatures,
membersPublicKeys: [
...(multisignatureSender as any).membersPublicKeys,
multisignatureSender.publicKey,
],
};
Expand Down
2 changes: 1 addition & 1 deletion packages/lisk-transactions/test/utils/sign_and_validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ describe('signAndVerify module', () => {
);

const {
multisignatures: memberPublicKeys,
membersPublicKeys: memberPublicKeys,
} = defaultMultisignatureAccount as Account;

it('should return a valid response with valid signatures', async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/lisk-transactions/test/utils/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ describe('#verify', () => {
describe('#verifyMultiSignatures', () => {
const defaultAccount = {
address: '123L',
multisignatures: [
membersPublicKeys: [
'c465d74511c2bfd136cf9764172acd3c1514fa7ad76475e03bc91cf679757a5a',
'c465d74511c2bfd136cf9764172acd3c1514fa7ad76475e03bc91cf679757a5b',
'c465d74511c2bfd136cf9764172acd3c1514fa7ad76475e03bc91cf679757a5c',
Expand Down Expand Up @@ -252,7 +252,7 @@ describe('#verify', () => {
fakeTransactionBuffer,
);
expect(validator.validateMultisignatures).to.be.calledWithExactly(
defaultAccount.multisignatures,
defaultAccount.membersPublicKeys,
signatures,
defaultAccount.multimin,
fakeTransactionBuffer,
Expand Down

0 comments on commit 7c224bf

Please sign in to comment.