This repository was archived by the owner on Feb 12, 2024. It is now read-only.
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
Two peers with same Identity #1316
Closed
Description
If you create two nodes in parallel, then they end up having the same Identity. When the script below is run you end up with configuration files which contain the same Identity:
$ diff /tmp/peera/config /tmp/peerb/config
4,5c4,5
< "/ip4/0.0.0.0/tcp/4012",
< "/ip4/127.0.0.1/tcp/4013/ws"
---
> "/ip4/0.0.0.0/tcp/4022",
> "/ip4/127.0.0.1/tcp/4023/ws"
7,8c7,8
< "API": "/ip4/127.0.0.1/tcp/5012",
< "Gateway": "/ip4/127.0.0.1/tcp/9091"
---
> "API": "/ip4/127.0.0.1/tcp/5022",
> "Gateway": "/ip4/127.0.0.1/tcp/9092"
I tried this on js-ipfs master (64c3bfb).
I debugged it a bit, but then I hit a dead end. I don't really understand how the initial configuration is created. It seems that some default configuration is written to disk, which is then overridden.
'use strict'
const IPFS = require('ipfs')
const configA = {
"Addresses": {
"API": "/ip4/127.0.0.1/tcp/5012",
"Gateway": "/ip4/127.0.0.1/tcp/9091",
"Swarm": [
"/ip4/0.0.0.0/tcp/4012",
"/ip4/127.0.0.1/tcp/4013/ws"
]
},
"Bootstrap": []
}
const peerA = new IPFS({
repo: '/tmp/peera',
config: configA,
init: {
emptyRepo: true
}
})
peerA.on('ready', () => {
console.log('peerA ready')
})
const configB = {
"Addresses": {
"API": "/ip4/127.0.0.1/tcp/5022",
"Gateway": "/ip4/127.0.0.1/tcp/9092",
"Swarm": [
"/ip4/0.0.0.0/tcp/4022",
"/ip4/127.0.0.1/tcp/4023/ws"
]
},
"Bootstrap": []
}
const peerB = new IPFS({
repo: '/tmp/peerb',
config: configB,
init: {
emptyRepo: true
}
})
peerB.on('ready', () => {
console.log('peerB ready')
})
Metadata
Metadata
Assignees
Labels
No labels