var common = require('./common')
var DHT = require('../')
var test = require('tape')

test('persist dht', function (t) {
  t.plan(1)

  var dht1 = new DHT({ bootstrap: false })
  common.failOnWarningOrError(t, dht1)

  common.addRandomNodes(dht1, DHT.K)

  dht1.on('ready', function () {
    var dht2 = new DHT({ bootstrap: dht1.toArray() })

    dht2.on('ready', function () {
      t.deepEqual(dht2.toArray(), dht1.toArray())
      dht1.destroy()
      dht2.destroy()
    })
  })

})

@@ -475,12 +475,551 @@
 %7D)%0A  %7D)%0A
+%7D)%0A%0A// https://github.com/feross/bittorrent-dht/pull/36%0Atest('bootstrap and listen to custom port', function (t) %7B%0A  t.plan(4)%0A%0A  var dht = new DHT(%7B bootstrap: %5B '1.2.3.4:1000' %5D %7D)%0A  common.failOnWarningOrError(t, dht)%0A%0A  t.ok(!dht.listening)%0A  dht.listen(12345)%0A  t.ok(!dht.listening)%0A%0A  // bootstrapping should wait until next tick, so user has a chance to%0A  // listen to a custom port%0A  dht.on('listening', function () %7B%0A    t.ok(dht.listening)%0A    t.equal(dht.port, 12345)%0A  %7D)%0A%0A  dht.on('ready', function () %7B%0A    dht.destroy()%0A  %7D)
 %0A%7D)%0A

Test to prove that #36 and #37 are not an issue