Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 9db86f5

Browse files
committed
fix: bitswap wantlist stats
1 parent 58f0885 commit 9db86f5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/cli/commands/bitswap/stat.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict'
22

33
const utils = require('../../utils')
4+
const CID = require('cids')
45

56
module.exports = {
67
command: 'stat',
@@ -21,6 +22,11 @@ module.exports = {
2122
}
2223

2324
stats.Wantlist = stats.Wantlist || []
25+
stats.Wantlist = stats.Wantlist.map((entry) => {
26+
const buf = new Buffer(entry.cid.hash.data)
27+
const cid = new CID(entry.cid.version, entry.cid.codec, buf)
28+
return cid.toBaseEncodedString()
29+
})
2430
stats.Peers = stats.Peers || []
2531

2632
console.log(`bitswap status

test/cli/test-bitswap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const createTempNode = require('../utils/temp-node')
1010
const repoPath = require('./index').repoPath
1111
const ipfs = require('../utils/ipfs-exec')(repoPath)
1212

13-
describe.only('bitswap', () => {
13+
describe('bitswap', () => {
1414
let node
1515

1616
before((done) => {

0 commit comments

Comments
 (0)