/** Finds an inactive channel with the given id and returns it, or returns null. */
 @Nullable
 StoredClientChannel getUsableChannelForServerID(Sha256Hash id) {
   lock.lock();
   try {
     Set<StoredClientChannel> setChannels = mapChannels.get(id);
     for (StoredClientChannel channel : setChannels) {
       synchronized (channel) {
         // Check if the channel is usable (has money, inactive) and if so, activate it.
         log.info(
             "Considering channel {} contract {}", channel.hashCode(), channel.contract.getHash());
         if (channel.close != null || channel.valueToMe.equals(Coin.ZERO)) {
           log.info("  ... but is closed or empty");
           continue;
         }
         if (!channel.active) {
           log.info("  ... activating");
           channel.active = true;
           return channel;
         }
         log.info("  ... but is already active");
       }
     }
   } finally {
     lock.unlock();
   }
   return null;
 }
 /**
  * Notifies the set of stored states that a channel has been updated. Use to notify the wallet of
  * an update to this wallet extension.
  */
 void updatedChannel(final StoredClientChannel channel) {
   log.info("Stored client channel {} was updated", channel.hashCode());
   containingWallet.addOrUpdateExtension(this);
 }