当我尝试获取密钥的历史记录时,我正在 Fabric 2.1 上处理 Nodejs 链代码。它正确返回“时间戳”和“值”,但迭代器中的 tx_id 始终未定义。有没有人成功检索到关联的交易ID??
async getAllResults(iterator, isHistory) {
let allResults = [];
while (true) {
let res = await iterator.next();
if (res.value && res.value.value.toString()) {
let jsonRes = {};
console.log(res.value.toString('utf8'));
console.log(res.value.tx_id);
console.log(res.value.value.toString('utf8'));
日志:
dev-peer0.org1.example.com-mycc_7-7cd3dda|[object Object]
dev-peer0.org1.example.com-mycc_7-7cd3dda|undefined
dev-peer0.org1.example.com-mycc_7-7cd3dda|{"entityType":"product","model":"somemodel","name":"bike","newdata":"somedata","owner":"e7854d50-8793-449a-a903-d740d8d5952b","txDate":"Wed Jul 29 2020"}