add quorum check and confimation

This commit is contained in:
Matias Alejo Garcia 2014-10-30 11:24:34 -03:00
parent b402a5a105
commit c427d59cfd
1 changed files with 29 additions and 20 deletions

View File

@ -108,8 +108,14 @@ firstWallet.updateIndexes(function() {
console.log('\n\n\n\n### TOTAL BALANCE: %d SATOSHIS', balance); //TODO
console.log('Balance per address:', balanceByAddr); //TODO
// rl.question("Should we swipe the wallet? (`yes` to continue)", function(answer) {
// });
if (!balance) {
console.log('Could not find any balance from the generated wallet'); //TODO
process.exit(1);
}
rl.question("Should we swipe the wallet? (`yes` to continue)", function(answer) {
if (answer!== 'yes')
process.exit(1);
var amount = balance - DFLT_FEE;
firstWallet.createTx(destAddr, amount, '', {}, function(err, ntxid) {
@ -122,8 +128,10 @@ firstWallet.updateIndexes(function() {
w[i].sign(ntxid, function(err) {
console.log('\t Signed!');
firstWallet.txProposals = firstWallet.txProposals;
if (i == l - 1){
console.log('\t ALL SIGNED');
var p = firstWallet.txProposals.getTxProposal(ntxid);
if (p.builder.isFullySigned()) {
console.log('\t FULLY SIGNED. BROADCASTING NOW....');
firstWallet.sendTx(ntxid, function(txid) {
console.log('\t ####### SENT TXID:', txid);
process.exit(1);
@ -134,3 +142,4 @@ firstWallet.updateIndexes(function() {
});
});
});
});