@@ -1704,40 +1704,49 @@ func (r *rpcServer) NewAddr(ctx context.Context,
17041704 "courier=%v, addr_version=%v, asset_version=%v" , & specifier ,
17051705 req .Amt , courierAddr , addrVersion , assetVersion )
17061706
1707- // Addresses with version 2 must use the new authmailbox proof courier
1707+ // Addresses with version 2 must use the new auth mailbox proof courier
17081708 // type.
1709- protocol := courierAddr .Scheme
17101709 switch {
17111710 case addrVersion == address .V2 &&
1712- protocol == proof .UniverseRpcCourierType :
1711+ courierAddr . Scheme == proof .UniverseRpcCourierType :
17131712
17141713 // We assume that any proof courier running an RPC universe
17151714 // server will upgrade soon to support the new auth mailbox
17161715 // courier type, so we bump the protocol/scheme to the combined
17171716 // one.
17181717 courierAddr .Scheme = proof .AuthMailboxUniRpcCourierType
17191718
1720- // Let's make sure the proof courier actually supports the
1721- // auth mailbox courier type.
1722- err := proof .CheckUniverseRpcCourierConnection (
1723- ctx , proofCourierCheckTimeout , courierAddr ,
1724- )
1725- if err != nil {
1726- return nil , err
1727- }
1728-
17291719 case addrVersion == address .V2 &&
1730- protocol == proof .AuthMailboxUniRpcCourierType :
1720+ courierAddr . Scheme == proof .AuthMailboxUniRpcCourierType :
17311721
17321722 // Great, nothing to do here, this is the courier type we want.
17331723
1734- case addrVersion == address .V2 && protocol == proof .HashmailCourierType :
1724+ case addrVersion == address .V2 &&
1725+ courierAddr .Scheme == proof .HashmailCourierType :
1726+
17351727 return nil , fmt .Errorf ("%w: address version %d must use the " +
17361728 "'%s' proof courier type" ,
17371729 address .ErrInvalidProofCourierAddr , addrVersion ,
17381730 proof .AuthMailboxUniRpcCourierType )
17391731 }
17401732
1733+ // If the courier is an (auth mailbox) universe RPC type we will check
1734+ // that we can connect to it.
1735+ connCheckScheme := courierAddr .Scheme == proof .UniverseRpcCourierType ||
1736+ courierAddr .Scheme == proof .AuthMailboxUniRpcCourierType
1737+ if ! req .SkipProofCourierConnCheck && connCheckScheme {
1738+ rpcsLog .DebugS (ctx , "Checking connection to universe server " +
1739+ "RPC" , "courier_addr" , courierAddr .String ())
1740+
1741+ err := proof .CheckUniverseRpcCourierConnection (
1742+ ctx , proofCourierCheckTimeout , courierAddr ,
1743+ )
1744+ if err != nil {
1745+ return nil , fmt .Errorf ("connection check failed for " +
1746+ "universe server RPC proof courier: %w" , err )
1747+ }
1748+ }
1749+
17411750 var addr * address.AddrWithKeyInfo
17421751 switch {
17431752 // No key was specified, we'll let the address book derive them.
0 commit comments