- Fixed: lastItem give tx details instead of txid
This commit is contained in:
sairajzero 2023-02-05 23:36:25 +05:30
parent 20eb50b281
commit 49356ef46c

View File

@ -316,9 +316,12 @@ AddressController.prototype.multitxs = function(req, res) {
return self.common.handleErrors(err, res);
}
var lastItem = items.find(a => a.confirmations !== 0), //assuming items is recent tx first order
lastItem = typeof lastItem === 'object' ? lastItem.txid: undefined
var ret = {
totalItems: result.totalCount,
lastItem: items.find(a => a.confirmations !== 0), //assuming items is recent tx first order
lastItem: lastItem,
//from: options.from,
//to: Math.min(options.to, result.totalCount),
items: items
@ -352,20 +355,20 @@ AddressController.prototype.multitxs_ws = function(ws, req) {
return self.common.handleErrors_ws(err, ws, false);
}
self.txController.transformTransaction(tx, transformOptions, function(err, data){
self.txController.transformTransaction(data, transformOptions, function(err, tx){
if(err) {
return self.common.handleErrors_ws(err, ws, false);
}
//finding the last key (useful for `after` option on next request call)
if(data.confirmations)
if(lastItem.height < data.blockheight || (lastItem.height == data.blockheight && lastItem.id < data.txid)){
lastItem.id = data.txid;
lastItem.height = data.blockheight;
if(tx.confirmations)
if(lastItem.height < tx.blockheight || (lastItem.height == tx.blockheight && lastItem.id < tx.txid)){
lastItem.id = tx.txid;
lastItem.height = tx.blockheight;
}
ws.send({data})
ws.send({data: tx})
});