Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multisignature attribute is set twice on multisignature wallet #3262

Closed
dated opened this issue Nov 16, 2019 · 8 comments
Closed

multisignature attribute is set twice on multisignature wallet #3262

dated opened this issue Nov 16, 2019 · 8 comments

Comments

@dated
Copy link
Contributor

dated commented Nov 16, 2019

The multisignature attribute is currently set twice on the multisignature wallet, in the applyToSender as well as in the applyToRecipient method. Also the name recipientWallet is a bit confusing in this context.

public async applyToSender(
transaction: Interfaces.ITransaction,
walletManager: State.IWalletManager,
): Promise<void> {
await super.applyToSender(transaction, walletManager);
// Create the multi sig wallet
if (transaction.data.version >= 2) {
walletManager
.findByAddress(Identities.Address.fromMultiSignatureAsset(transaction.data.asset.multiSignature))
.setAttribute("multiSignature", transaction.data.asset.multiSignature);
}
}

public async applyToRecipient(
transaction: Interfaces.ITransaction,
walletManager: State.IWalletManager,
): Promise<void> {
const { data }: Interfaces.ITransaction = transaction;
if (data.version >= 2) {
const recipientWallet: State.IWallet = walletManager.findByAddress(
Identities.Address.fromMultiSignatureAsset(data.asset.multiSignature),
);
recipientWallet.setAttribute("multiSignature", transaction.data.asset.multiSignature);
}
}

@ghost
Copy link

ghost commented Nov 16, 2019

Thanks for opening this issue! A maintainer will review this in the next few days and explicitly select labels so you know what's going on.

If no reviewer appears after a week, a reminder will be sent out.

@dated dated changed the title multisignature attribute is set twice on recipient wallet multisignature attribute is set twice on multisignature wallet Nov 18, 2019
@air1one
Copy link
Contributor

air1one commented Nov 20, 2019

Looks like it was introduced by @vasild here 090bc2d

Before only applyToRecipient was implemented, did you do this on purpose @vasild ?

@vasild
Copy link
Contributor

vasild commented Nov 20, 2019

No, I was probably confused by the recipientWallet naming and did not realize that the recipient and the sender are the same in this case (correct me if I am wrong, please).

Is the fact that we set the attribute twice (to the same value) causing any problems?

@dated
Copy link
Contributor Author

dated commented Nov 20, 2019

Is the fact that we set the attribute twice (to the same value) causing any problems?

No, afaik. But If there is no reason it should probably be avoided.

@dated
Copy link
Contributor Author

dated commented Nov 20, 2019

Fyi i tried removing it from applyToSender but that caused some problems, i didn't investigate further.

For reference #3263

@spkjp
Copy link
Contributor

spkjp commented Nov 20, 2019

Afaik it resolves some problems for pool wallets, because applyToRecipient/applyToSender are called under different conditions. Without applying it in both cases, the pool wallet may end up without an asset.

@dated
Copy link
Contributor Author

dated commented Nov 20, 2019

Sounds like it is necessary then 👍

@dated dated closed this as completed Nov 20, 2019
@ghost
Copy link

ghost commented Nov 20, 2019

This issue has been closed. If you wish to re-open it please provide additional information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants