Refactored copayers selection on create form

This commit is contained in:
Ivan Socolsky 2014-09-30 13:04:48 -03:00
commit 33e115d0c2
3 changed files with 52 additions and 43 deletions

View file

@ -132,6 +132,21 @@ Wallet.PERSISTED_PROPERTIES = [
'lastTimestamp',
];
Wallet.VALID_COPAYER_PAIRS = {
1: 1,
2: 2,
3: 3,
4: 4,
5: 4,
6: 3,
7: 3,
8: 2,
9: 2,
10: 2,
11: 1,
12: 1,
};
/**
* @desc Retrieve a random id for the wallet
* @TODO: Discuss changing to a UUID
@ -151,6 +166,18 @@ Wallet.getRandomNumber = function() {
return r;
};
/**
* @desc
* Get the maximum allowed number of required copayers.
* This is a limit imposed by the maximum allowed size of the scriptSig.
* @param {number} totalCopayers - the total number of copayers
* @return {number}
*/
Wallet.getMaxRequiredCopayers = function(totalCopayers) {
return Wallet.VALID_COPAYER_PAIRS[totalCopayers];
};
/**
* @desc Set the copayer id for the owner of this wallet
* @param {string} pubkey - the pubkey to set to the {@link Wallet#seededCopayerId} property