1

尝试连接到节点时出现错误。IPFS 实例是在一个类中创建的,带有一个 JavaScript 工厂函数。连接函数如下所示:

async connectToPeer(multiaddr, protocol = "/p2p-circuit/ipfs/") {
    try {
        console.log("swarm.connect: ", protocol + multiaddr);
        await this.node.swarm.connect(protocol + multiaddr);
    } catch (e) {
        throw(e);
    }
}

这将传递给 swarm.connet:/p2p-circuit/ipfs/QmWxWkrCcgNBG2uf1HSVAwb9RzcSYYC2d6CRsfJcqrz2FX

这是我得到的错误:

(node:24449) UnhandledPromiseRejectionWarning: AggregateError: 
    Error: Invalid version, must be a number equal to 1 or 0
        at Function.validateCID (/home/user/orbit-playground/music-app-no-react/node_modules/cids/src/index.js:312:13)
        at new CID (/home/user/orbit-playground/music-app-no-react/node_modules/cids/src/index.js:151:9)
        at new CID (/home/user/orbit-playground/music-app-no-react/node_modules/class-is/index.js:15:17)
        at Function.exports.createFromCID (/home/user/orbit-playground/music-app-no-react/node_modules/peer-id/src/index.js:248:32)
        at ClassIsWrapper.dial (/home/user/orbit-playground/music-app-no-react/node_modules/libp2p/src/circuit/index.js:107:30)
        at TransportManager.dial (/home/user/orbit-playground/music-app-no-react/node_modules/libp2p/src/transport-manager.js:89:30)
        at DialRequest.dialAction (/home/user/orbit-playground/music-app-no-react/node_modules/libp2p/src/dialer/index.js:149:36)
        at pAny.addrs.map (/home/user/orbit-playground/music-app-no-react/node_modules/libp2p/src/dialer/dial-request.js:58:29)
    at maybeSettle (/home/user/orbit-playground/music-app-no-react/node_modules/p-some/index.js:31:11)
    at /home/user/orbit-playground/music-app-no-react/node_modules/p-some/index.js:69:23

它能够连接到对等点,如果我列出连接的对等点,则列表不为空。

4

0 回答 0