add BCH createTX tests
This commit is contained in:
parent
d8e6964587
commit
5186392558
|
@ -1929,6 +1929,7 @@ WalletService.prototype._canCreateTx = function(cb) {
|
|||
};
|
||||
|
||||
WalletService.prototype._validateOutputs = function(opts, wallet, cb) {
|
||||
var A = Bitcore_[wallet.coin].Address;
|
||||
var dustThreshold = Math.max(Defaults.MIN_OUTPUT_AMOUNT, Bitcore_[wallet.coin].Transaction.DUST_AMOUNT);
|
||||
|
||||
if (_.isEmpty(opts.outputs)) return new ClientError('No outputs were specified');
|
||||
|
@ -1943,7 +1944,7 @@ WalletService.prototype._validateOutputs = function(opts, wallet, cb) {
|
|||
|
||||
var toAddress = {};
|
||||
try {
|
||||
toAddress = new Bitcore.Address(output.toAddress);
|
||||
toAddress = new A(output.toAddress);
|
||||
} catch (ex) {
|
||||
return Errors.INVALID_ADDRESS;
|
||||
}
|
||||
|
|
|
@ -277,6 +277,8 @@ helpers.stubUtxos = function(server, wallet, amounts, opts, cb) {
|
|||
|
||||
if (!helpers._utxos) helpers._utxos = {};
|
||||
|
||||
var S = Bitcore_[wallet.coin].Script;
|
||||
|
||||
async.waterfall([
|
||||
|
||||
function(next) {
|
||||
|
@ -298,10 +300,10 @@ helpers.stubUtxos = function(server, wallet, amounts, opts, cb) {
|
|||
var scriptPubKey;
|
||||
switch (wallet.addressType) {
|
||||
case Constants.SCRIPT_TYPES.P2SH:
|
||||
scriptPubKey = Bitcore.Script.buildMultisigOut(address.publicKeys, wallet.m).toScriptHashOut();
|
||||
scriptPubKey = S.buildMultisigOut(address.publicKeys, wallet.m).toScriptHashOut();
|
||||
break;
|
||||
case Constants.SCRIPT_TYPES.P2PKH:
|
||||
scriptPubKey = Bitcore.Script.buildPublicKeyHashOut(address.address);
|
||||
scriptPubKey = S.buildPublicKeyHashOut(address.address);
|
||||
break;
|
||||
}
|
||||
should.exist(scriptPubKey);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue