Closed webtech2412 closed 1 month ago
It sounds like you are using ripple-lib. What version?
Also, those are not "random" values, that is a disjoint range of complete ledgers. The gaps in between the completed ledgers represent times when your server fell out of sync with the rest of the network. Usually that indicates that your hardware or network connection is not powerful enough to run rippled
. See Usual Causes of Syncing Issues for that.
It's possible that the reason you're seeing this error message in particular may be that ripple-lib is not handling the disjoint sequence correctly. @intelliot, can you take a look at that?
@mDuo13 I have setup mainnet private node and using ripple-lib V1.7.0
Here is my method to get a deposit history. I am not able to pass the correct min and max ledger value. error [ValidationError(instance.options.maxLedgerVersion is not exactly one from [subschema 0],[subschema 1])]
"deposit_history": (req, res) => { if (!req.body.destTags || !req.body.addr) { return commonFile.responseHandler(res, 400, "Parameters missing.") } let xrp_address = req.body.addr, tags = Number(req.body.destTags) let transDet = [] api.connect().then(() => { return api.getServerInfo().then(info => { let max = 0, min = 0; min = Number(info.completeLedgers.split('-')[0]) max = Number(info.completeLedgers.split('-')[1]) const address = xrp_address; let options = { minLedgerVersion: min, maxLedgerVersion: max } return api.getTransactions(address, options).then(transaction => { transaction.forEach((miniTransaction) => { if (miniTransaction.type === "payment" && miniTransaction.specification.destination.address === xrp_address && miniTransaction.specification.destination.tag === tags) { transDet.push({ transaction_hash: miniTransaction.id, balance: miniTransaction.outcome.deliveredAmount.value, created_at: new Date(miniTransaction.outcome.timestamp), from: miniTransaction.specification.source.address, to: miniTransaction.specification.destination.address }) }
})
});
});
}).then(() => {
return api.disconnect();
}).then(() => {
return commonFile.responseHandler(res, 200, "Txns found successfully.", transDet)
}).catch(error => {
return commonFile.responseHandler(res, 500, "Error loading Ledger: Txns cannot be found.")
});
},
Looks like the problem is in your code, here:
min = Number(info.completeLedgers.split('-')[0])
max = Number(info.completeLedgers.split('-')[1])
You can't split the complete ledgers on -
if your server is reporting a disjoint sequence. You have to either look at the entire disjoint sequence or just the final continuous segment of it.
Yes, I can do that but the values returned by the server is not having fix pattern so I am not able to pass correct values Values returned by Server completeLedger ="54873243-54888233,54888334-54888352,54888587-54888604,54888706-54888755,54888921-54888922,54889023-54889061,54889170-54889190,54889347-54889402,54889506-54889562,54889665-54889950,54890141-54890169,54890448-54890460,54890561-54890582,54890694-54890732,54890868-54891060,54891231-54898249"
and some time "completeLedgers": "54873243-54888233,54888334",.
How shall in pass min and max values from here?
In your first example, the last contiguous segment is 54891231-54898249. You can pass 54891231 as min and 54898249 as max. In the second case the last contiguous segment is only one ledger long so both min and max would have to be 54888334.
Of course, that means it'll only search those ledgers. To get more reliable information, you have to ask a more reliable rippled server, or make your server more reliable. Most likely your rippled server doesn't have sufficient I/O or reliable enough network connection. Usual Causes of Syncing Issues describes this in more detail.
I am facing the same issue, i have set up full node on my server. Everything is working but getTansactions is throwing error error - error [ValidationError(instance.options.maxLedgerVersion is not exactly one from [subschema 0],[subschema 1])]
I tried passing "minLedgerVersion" from my getserverinfo function using the completeLedger values but it is not working and giving MissingLedgerHistoryError(Server is missing ledger history in the specified range)]
I observe completeLedger is giving me random values. I tried to split and use min/max ledger version but that is not working as the format is getting changed Somitime it give like this completeLedger ="54873243-54888233,54888334-54888352,54888587-54888604,54888706-54888755,54888921-54888922,54889023-54889061,54889170-54889190,54889347-54889402,54889506-54889562,54889665-54889950,54890141-54890169,54890448-54890460,54890561-54890582,54890694-54890732,54890868-54891060,54891231-54898249"
and some time "completeLedgers": "54873243-54888233,54888334",
How i can resolved this. getTransactions is supposed to work with address only and options are optional but it is not working. Please help.