ENT-2014 Deletes of NodeInfo can fail to propagate leading to infinite retries (#1101)

* ENT-2014 Deletes of NodeInfo can fail to propagate leading to infinite retries
ENT-1880 Move identity key generation to network registration process

(cherry picked from commit c3ac203)
This commit is contained in:
Patrick Kuo
2018-06-28 15:10:52 +01:00
committed by Patrick
parent d5b5825c09
commit 8df18e954f
6 changed files with 62 additions and 18 deletions

View File

@ -8,8 +8,6 @@ import net.corda.core.node.NetworkParameters
import net.corda.core.node.NodeInfo
import net.corda.core.serialization.serialize
import net.corda.core.utilities.NetworkHostAndPort
import net.corda.core.utilities.contextLogger
import net.corda.core.utilities.days
import net.corda.nodeapi.internal.SignedNodeInfo
import net.corda.nodeapi.internal.createDevNetworkMapCa
import net.corda.nodeapi.internal.crypto.CertificateAndKeyPair
@ -128,7 +126,12 @@ class NetworkMapServer(private val pollInterval: Duration,
val hash = signedNodeInfo.raw.hash
val nodeInfo = signedNodeInfo.verified()
val privateNetwork = nodeNamesUUID[nodeInfo.legalIdentities[0].name]
networkMaps.computeIfAbsent(privateNetwork, { mutableSetOf() }).add(hash)
val map = networkMaps.computeIfAbsent(privateNetwork) { mutableSetOf() }
map.add(hash)
nodeInfoMap.filter { it.value.verified().legalIdentities.first().name == signedNodeInfo.verified().legalIdentities.first().name }.forEach { t, _ ->
nodeInfoMap.remove(t)
map.remove(t)
}
nodeInfoMap[hash] = signedNodeInfo
ok()
} catch (e: Exception) {