func (h *Host) managedRPCSettings(conn net.Conn) error {
	conn.SetDeadline(time.Now().Add(modules.NegotiateSettingsTime))
	var hes modules.HostExternalSettings
	var secretKey crypto.SecretKey
	h.mu.Lock()
	secretKey = h.secretKey
	hes = h.externalSettings()
	h.mu.Unlock()
	err := crypto.WriteSignedObject(conn, hes, secretKey)
	if err != nil {
		return ErrorConnection("failed WriteSignedObject during RPCSettings: " + err.Error())
	}
	return nil
}
managedRPCSettings is an rpc that returns the host's settings.
package host
import (
	"net"
	"time"
	"github.com/NebulousLabs/Sia/build"
	"github.com/NebulousLabs/Sia/crypto"
	"github.com/NebulousLabs/Sia/modules"
)
func (h *Host) capacity() (total, remaining uint64) {
	sfs := h.StorageFolders()
	for _, sf := range sfs {
		total += sf.Capacity
		remaining += sf.CapacityRemaining
	}
	return total, remaining
}
func (h *Host) externalSettings() modules.HostExternalSettings {
	h.revisionNumber++
	totalStorage, remainingStorage := h.capacity()
	var netAddr modules.NetAddress
	if h.settings.NetAddress != "" {
		netAddr = h.settings.NetAddress
	} else {
		netAddr = h.autoAddress
	}
	_, maxFee := h.tpool.FeeEstimation()
	contractPrice := maxFee.Mul64(10e3)  
	if contractPrice.Cmp(h.settings.MinContractPrice) < 0 {
		contractPrice = h.settings.MinContractPrice
	}
	return modules.HostExternalSettings{
		AcceptingContracts:   h.settings.AcceptingContracts,
		MaxDownloadBatchSize: h.settings.MaxDownloadBatchSize,
		MaxDuration:          h.settings.MaxDuration,
		MaxReviseBatchSize:   h.settings.MaxReviseBatchSize,
		NetAddress:           netAddr,
		RemainingStorage:     remainingStorage,
		SectorSize:           modules.SectorSize,
		TotalStorage:         totalStorage,
		UnlockHash:           h.unlockHash,
		WindowSize:           h.settings.WindowSize,
		Collateral:    h.settings.Collateral,
		MaxCollateral: h.settings.MaxCollateral,
		ContractPrice:          contractPrice,
		DownloadBandwidthPrice: h.settings.MinDownloadBandwidthPrice,
		StoragePrice:           h.settings.MinStoragePrice,
		UploadBandwidthPrice:   h.settings.MinUploadBandwidthPrice,
		RevisionNumber: h.revisionNumber,
		Version:        build.Version,
	}
}