fix tx broadcast
This commit is contained in:
parent
f5d8891317
commit
1e4a6179de
@ -17,24 +17,25 @@ module.exports.init = function(app, io_ext) {
|
|||||||
|
|
||||||
module.exports.broadcastTx = function(tx) {
|
module.exports.broadcastTx = function(tx) {
|
||||||
if (ios) {
|
if (ios) {
|
||||||
var t = {};
|
var t;
|
||||||
if (typeof tx === 'string') {
|
if (typeof tx === 'string') {
|
||||||
|
|
||||||
console.log('[socket.js.22]',tx); //TODO
|
|
||||||
t = {
|
t = {
|
||||||
txid: tx
|
txid: tx
|
||||||
};
|
};
|
||||||
} else {
|
}
|
||||||
t = tx;
|
|
||||||
|
else {
|
||||||
|
t = {
|
||||||
|
txid: tx.txid,
|
||||||
|
size: tx.size,
|
||||||
|
};
|
||||||
// Outputs
|
// Outputs
|
||||||
var valueOut = 0;
|
var valueOut = 0;
|
||||||
t.vout.forEach(function(o) {
|
tx.vout.forEach(function(o) {
|
||||||
valueOut += o.value * util.COIN;
|
valueOut += o.value * util.COIN;
|
||||||
});
|
});
|
||||||
|
|
||||||
t.valueOut = parseInt(valueOut) / util.COIN;
|
t.valueOut = parseInt(valueOut) / util.COIN;
|
||||||
|
|
||||||
console.log('[socket.js.36]',t); //TODO
|
|
||||||
}
|
}
|
||||||
ios.sockets. in ('inv').emit('tx', t);
|
ios.sockets. in ('inv').emit('tx', t);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -265,7 +265,6 @@ function spec() {
|
|||||||
|
|
||||||
Sync.prototype.handleNewTx = function(data) {
|
Sync.prototype.handleNewTx = function(data) {
|
||||||
if (this.opts.shouldBroadcast) {
|
if (this.opts.shouldBroadcast) {
|
||||||
console.log('[Sync.js.268:shouldBroadcast:]', data.tx); //TODO
|
|
||||||
sockets.broadcastTx(data.tx);
|
sockets.broadcastTx(data.tx);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user