Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

check to prevent wallet created with more _required than _owners #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

p-s-dev
Copy link

@p-s-dev p-s-dev commented Jun 20, 2016

No description provided.

@@ -52,6 +52,7 @@ contract multiowned {
// constructor is given number of sigs required to do protected "onlymanyowners" transactions
// as well as the selection of addresses capable of confirming them.
function multiowned(address[] _owners, uint _required) {
if (_required > 1 && _owners.length < _required -1) throw;
Copy link

Choose a reason for hiding this comment

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

Is that -1 supposed to be there?

Copy link
Contributor

Choose a reason for hiding this comment

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

@sunny-g I believe the -1 is because _owners does not include the msg.sender which automatically becomes an owner as well. so if _owners.length is 2 then _required can be 3 (2 owners provided + the msg.sender creating the contract).

The code should be updated to make this clearer, through comments or by doing a +1 to the owners instead.

Copy link

Choose a reason for hiding this comment

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

Wow that was dumb misread. My mistake!

Copy link
Contributor

Choose a reason for hiding this comment

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

If we do such checks, we should probably also check for:
if (_required == 0) throw;
Also rewriting the current condition as if (_required > _owners.length + 1) would be more readable, I think.

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

Successfully merging this pull request may close these issues.

4 participants