Transaction tracking revamped.

Blockchain block arrow.
This commit is contained in:
Simon Lindh
2020-02-19 23:50:23 +07:00
committed by wiz
parent 34645908e9
commit f3cfa038d3
15 changed files with 232 additions and 145 deletions

View File

@@ -90,8 +90,12 @@ class Server {
client['want-stats'] = parsedMessage.data.indexOf('stats') > -1;
}
if (parsedMessage && parsedMessage.txId && /^[a-fA-F0-9]{64}$/.test(parsedMessage.txId)) {
client['txId'] = parsedMessage.txId;
if (parsedMessage && parsedMessage['track-tx']) {
if (/^[a-fA-F0-9]{64}$/.test(parsedMessage['track-tx'])) {
client['track-tx'] = parsedMessage['track-tx'];
} else {
client['track-tx'] = null;
}
}
if (parsedMessage.action === 'init') {
@@ -139,8 +143,8 @@ class Server {
return;
}
if (client['txId'] && txIds.indexOf(client['txId']) > -1) {
client['txId'] = null;
if (client['track-tx'] && txIds.indexOf(client['track-tx']) > -1) {
client['track-tx'] = null;
client.send(JSON.stringify({
'block': block,
'txConfirmed': true,