Merge pull request #818 from maraoz/bug/addresses-check-network
check network for addresses
* Chrome 35.0.1916 (Mac OS X 10.9.3): Executed 76 of 76 SUCCESS (0.806 secs / 0.239 secs)
* mocha: 170 passing (8s)
* browser: 100%: 128.16s
Code: OK (I am starting to like preconditions 👍 )
This commit is contained in:
commit
44ef1c4710
5 changed files with 45 additions and 16 deletions
|
|
@ -13,7 +13,7 @@ angular.module('copayApp.directives')
|
|||
link: function(scope, elem, attrs, ctrl) {
|
||||
var validator = function(value) {
|
||||
var a = new Address(value);
|
||||
ctrl.$setValidity('validAddress', a.isValid());
|
||||
ctrl.$setValidity('validAddress', a.isValid() && a.network().name === config.networkName);
|
||||
return value;
|
||||
};
|
||||
|
||||
|
|
@ -29,8 +29,7 @@ angular.module('copayApp.directives')
|
|||
restrict: 'A',
|
||||
link: function(scope, element, attrs, ctrl) {
|
||||
setTimeout(function() {
|
||||
scope.$apply(function() {
|
||||
});
|
||||
scope.$apply(function() {});
|
||||
}, 5000);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ var buffertools = bitcore.buffertools;
|
|||
var Builder = bitcore.TransactionBuilder;
|
||||
var SecureRandom = bitcore.SecureRandom;
|
||||
var Base58Check = bitcore.Base58.base58Check;
|
||||
var Address = bitcore.Address;
|
||||
|
||||
var AddressIndex = require('./AddressIndex');
|
||||
var PublicKeyRing = require('./PublicKeyRing');
|
||||
|
|
@ -697,7 +698,7 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, comment, utxos
|
|||
opts = opts || {};
|
||||
|
||||
var amountSat = bignum(amountSatStr);
|
||||
|
||||
preconditions.checkArgument(new Address(toAddress).network().name === this.getNetworkName());
|
||||
if (!pkr.isComplete()) {
|
||||
throw new Error('publicKeyRing is not complete');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue