mirror of
https://github.com/corda/corda.git
synced 2025-06-17 06:38:21 +00:00
CORDA-540: Ensure that registration of a test node was a success prior to performing further testing with it (#1379)
Registration may fail due to low level serialization problems especially when running in AMQP mode Also some minor improvements for exceptions reporting and test coverage
This commit is contained in:
@ -605,8 +605,8 @@ abstract class AbstractNode(open val configuration: NodeConfiguration,
|
||||
val address: SingleMessageRecipient = networkMapAddress ?:
|
||||
network.getAddressOfParty(PartyInfo.Node(info)) as SingleMessageRecipient
|
||||
// Register for updates, even if we're the one running the network map.
|
||||
return sendNetworkMapRegistration(address).flatMap { (error) ->
|
||||
check(error == null) { "Unable to register with the network map service: $error" }
|
||||
return sendNetworkMapRegistration(address).flatMap { response: RegistrationResponse ->
|
||||
check(response.error == null) { "Unable to register with the network map service: ${response.error}" }
|
||||
// The future returned addMapService will complete on the same executor as sendNetworkMapRegistration, namely the one used by net
|
||||
services.networkMapCache.addMapService(network, address, true, null)
|
||||
}
|
||||
|
@ -330,7 +330,9 @@ open class Node(override val configuration: FullNodeConfiguration,
|
||||
|
||||
_startupComplete.set(Unit)
|
||||
}
|
||||
}, {})
|
||||
},
|
||||
{ th -> logger.error("Unexpected exception", th)}
|
||||
)
|
||||
shutdownHook = addShutdownHook {
|
||||
stop()
|
||||
}
|
||||
|
@ -117,7 +117,10 @@ open class NodeStartup(val args: Array<String>) {
|
||||
logger.error("Shell failed to start", e)
|
||||
}
|
||||
}
|
||||
}, {})
|
||||
},
|
||||
{
|
||||
th -> logger.error("Unexpected exception during registration", th)
|
||||
})
|
||||
node.run()
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@ import net.corda.node.services.network.NetworkMapService.Companion.SUBSCRIPTION_
|
||||
import net.corda.node.utilities.AddOrRemove
|
||||
import net.corda.node.utilities.AddOrRemove.ADD
|
||||
import net.corda.node.utilities.AddOrRemove.REMOVE
|
||||
import java.io.IOException
|
||||
import java.security.PublicKey
|
||||
import java.security.SignatureException
|
||||
import java.time.Instant
|
||||
@ -243,6 +244,10 @@ abstract class AbstractNetworkMapService(services: ServiceHubInternal,
|
||||
request.wireReg.verified()
|
||||
} catch (e: SignatureException) {
|
||||
return RegistrationResponse("Invalid signature on request")
|
||||
} catch (e: IOException) {
|
||||
val msg = "Unexpected IO exception: ${e.message}"
|
||||
logger.error(msg, e)
|
||||
return RegistrationResponse(msg)
|
||||
}
|
||||
|
||||
val node = change.node
|
||||
|
Reference in New Issue
Block a user