Merge pull request #2241 from isocolsky/fixed_swipe

ACK
This commit is contained in:
Matias Pando 2014-12-22 17:26:52 -03:00
commit 74541c6f7b
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,6 @@
'use strict';
var _ = require('lodash');
var preconditions = require('preconditions').singleton();
var bitcore = require('bitcore');

View File

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