mirror of https://github.com/BTCPrivate/copay.git
commit
74541c6f7b
|
@ -1,5 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var _ = require('lodash');
|
||||
var preconditions = require('preconditions').singleton();
|
||||
|
||||
var bitcore = require('bitcore');
|
||||
|
|
|
@ -162,7 +162,7 @@ firstWallet.updateIndexes(function() {
|
|||
|
||||
amount = amount || balance - fee * bitcore.util.COIN;
|
||||
|
||||
firstWallet.createTx(destAddr, amount, '', {}, function(err, ntxid) {
|
||||
firstWallet.spend({ toAddress: destAddr, amountSat: amount }, function(err, ntxid) {
|
||||
if (err || !ntxid) {
|
||||
if (err && err.toString().match('BIG')) {
|
||||
throw new Error('Could not create tx' + err);
|
||||
|
@ -204,13 +204,13 @@ firstWallet.updateIndexes(function() {
|
|||
if (err)
|
||||
throw new Error(err);
|
||||
|
||||
var p = firstWallet.txProposals.getTxProposal(ntxid);
|
||||
var p = firstWallet.txProposals.get(ntxid);
|
||||
if (p.builder.isFullySigned()) {
|
||||
console.log('\t FULLY SIGNED. BROADCASTING NOW....');
|
||||
var tx = p.builder.build();
|
||||
var txHex = tx.serialize().toString('hex');
|
||||
//console.log('\t RAW TX: ', txHex);
|
||||
firstWallet.sendTx(ntxid, function(txid) {
|
||||
firstWallet.broadcastToBitcoinNetwork(ntxid, function(txid) {
|
||||
console.log('\t ####### SENT TXID:', txid);
|
||||
process.exit(1);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue