Merge pull request #511 from chjj/fix_paypro_example
paypro: fix example server for no-tx argument.
This commit is contained in:
commit
0dd078a280
@ -299,6 +299,7 @@ app.post('/-/pay', function(req, res, next) {
|
|||||||
return ptx;
|
return ptx;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!argv['no-tx']) {
|
||||||
(function retry() {
|
(function retry() {
|
||||||
var timeout = setTimeout(function() {
|
var timeout = setTimeout(function() {
|
||||||
if (conn) {
|
if (conn) {
|
||||||
@ -308,20 +309,18 @@ app.post('/-/pay', function(req, res, next) {
|
|||||||
print('Sending transaction with txid: %s', id);
|
print('Sending transaction with txid: %s', id);
|
||||||
print(tx.getStandardizedObject());
|
print(tx.getStandardizedObject());
|
||||||
|
|
||||||
|
print('Broadcasting transaction...');
|
||||||
|
|
||||||
var pending = 1;
|
var pending = 1;
|
||||||
peerman.on('ack', function listener() {
|
peerman.on('ack', function listener() {
|
||||||
if (!--pending) {
|
if (!--pending) {
|
||||||
peerman.removeListener('ack', listener);
|
peerman.removeListener('ack', listener);
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
print('Transaction sent to peer successfully.');
|
print('Transaction sent to peer successfully.');
|
||||||
|
res.send(ack);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
print('Broadcasting transaction...');
|
|
||||||
|
|
||||||
if (!argv['no-tx']) {
|
|
||||||
conn.sendTx(tx);
|
conn.sendTx(tx);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
print('No BTC network connection. Retrying...');
|
print('No BTC network connection. Retrying...');
|
||||||
@ -330,8 +329,10 @@ app.post('/-/pay', function(req, res, next) {
|
|||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
})();
|
})();
|
||||||
|
} else {
|
||||||
|
print('Broadcasting transaction...');
|
||||||
res.send(ack);
|
res.send(ack);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user