【发布时间】:2019-01-08 21:30:07
【问题描述】:
我一直在尝试在 if/else 中提取异步值,我已经解决了一些错误,但以下是返回空括号:
router.post('/api/shill', async (req, res) => {
let checkIdLength = req.body.Id;
let checkIP = validateIP(req.body.Ip);
let checkPort = Number.isInteger(req.body.Port);
console.log(req.body.Id);
if (checkIdLength.length != 66 || checkIP != true || checkPort != true || typeof req.body.Wumbo != "boolean") {
res.status(400).send('Invalid value(s) detected');
}
else try {
challengeInvoice = getInvoice();
res.status(200).send(challengeInvoice);
} catch (e) {console.log(e)}
})
async function getInvoice() {
await lnd.addInvoice({}, (err, res) => {return res});
}
fwiw,lnd.addInvoice 绑定到 grpc 调用
【问题讨论】:
-
getInvoice不返回任何内容。