works sometimes

This commit is contained in:
Matias Alejo Garcia 2014-04-21 20:28:57 -03:00
commit 4092f0cb9d
6 changed files with 78 additions and 17 deletions

View file

@ -71,6 +71,8 @@ PrivateKey.prototype.get = function(index,isChange) {
PrivateKey.prototype.getAll = function(addressIndex, changeAddressIndex) {
var ret = [];
console.log('[PrivateKey.js.75:addressIndex:]',addressIndex); //TODO
console.log('[PrivateKey.js.79:changeAddressIndex:]',changeAddressIndex); //TODO
for(var i=0;i<addressIndex; i++) {
ret.push(this.get(i,false));

View file

@ -162,6 +162,7 @@ PublicKeyRing.prototype.getRedeemScript = function (index, isChange) {
this._checkIndexRange(index, isChange);
var pubKeys = this.getPubKeys(index, isChange);
console.log('[PublicKeyRing.js.164:index:] getRedeemScript: ',index, isChange); //TODO
var script = Script.createMultisig(this.requiredCopayers, pubKeys);
return script;
};

View file

@ -318,7 +318,7 @@ Wallet.prototype.sign = function(ntxid) {
var pkr = self.publicKeyRing;
var keys = self.privateKey.getAll(pkr.addressIndex, pkr.changeAddressIndex);
console.log('[Wallet.js.329:keys:]',keys); //TODO
console.log('[Wallet.js.329:keys:] LENGTH::',keys.length, pkr.addressIndex, pkr.changeAddressIndex); //TODO
var b = txp.builder;
var before = b.signaturesAdded;
@ -497,8 +497,9 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, utxos, opts) {
var signRet;
if (priv) {
console.log('[Wallet.js.486] aLL Priv', priv.getAll(pkr.addressIndex, pkr.changeAddressIndex)); //TODO
b.sign( priv.getAll(pkr.addressIndex, pkr.changeAddressIndex) );
var keys = priv.getAll(pkr.addressIndex, pkr.changeAddressIndex);
console.log('[Wallet.js.329:keys:] LENGTH::',keys.length, pkr.addressIndex, pkr.changeAddressIndex); //TODO
b.sign( keys );
}
console.log('[Wallet.js.494]', b, b.build().serialize().toString('hex')); //TODO
var me = {};