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

Conversation

pablitovicente
Copy link

@pablitovicente pablitovicente commented Feb 27, 2019

What was the problem?

  • secondSignature flag was not being set

How did I fix it?

  • secondSignature flag is being added on apply asset and removed in undo

How to test it?

Build should be green

Review checklist

@@ -209,6 +210,8 @@ export class SecondSignatureTransaction extends BaseTransaction {
protected undoAsset(store: StateStore): ReadonlyArray<TransactionError> {
const sender = store.account.get(this.senderId);
const { secondPublicKey, ...strippedSender } = sender;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const { secondPublicKey, ...strippedSender } = sender;
const { secondPublicKey, secondSignature, ...strippedSender } = sender;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shuse2 I think we need the properties to be present for stateStore to handle them correctly so instead changed to de-structuring as we discussed.

@@ -200,6 +200,7 @@ export class SecondSignatureTransaction extends BaseTransaction {
const updatedSender = {
...sender,
secondPublicKey: this.asset.signature.publicKey,
secondSignature: true,
Copy link
Contributor

@SargeKhan SargeKhan Feb 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be a number, with values either 0 or 1.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

shuse2
shuse2 previously approved these changes Feb 28, 2019
const { secondPublicKey, ...strippedSender } = sender;
const strippedSender = {
...sender,
secondPublicKey: undefined,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Lisk-core, on undo action, the secondPublicKey property is assigned with the value null. Therefore, I think we should keep it consistent.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SargeKhan We have a TS lint rule that forbids null and favours undefined should I skip it in this case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I guess we have to do it in this particular case.

…transaction-should-update-secondsignature-flag-for-account
@shuse2 shuse2 merged commit 7f855a9 into release/2.1.0 Feb 28, 2019
@shuse2 shuse2 deleted the 1147-second-signature-registration-transaction-should-update-secondsignature-flag-for-account branch February 28, 2019 10:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants