Browse Source

add BCH createTX tests

feat/estimateFee-limit
matiu 7 years ago
parent
commit
5186392558
  1. 3
      lib/server.js
  2. 6
      test/integration/helpers.js
  3. 1572
      test/integration/server.js

3
lib/server.js

@ -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;
}

6
test/integration/helpers.js

@ -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);

1572
test/integration/server.js

File diff suppressed because it is too large
Loading…
Cancel
Save