code: func (b *estimateFeeSet) estimateFee(confirmations int) SatoshiPerByte {
  	if confirmations <= 0 {
  		return SatoshiPerByte(math.Inf(1))
  	}
  
  	if confirmations > estimateFeeDepth {
  		return 0
  	}
  
  	// We don't have any transactions!
  	if len(b.feeRate) == 0 {
  		return 0
  	}
  
  	var min, max int = 0, 0
  	for i := 0; i < confirmations-1; i++ {
  		min += int(b.bin[i])
  	}
  
  	max = min + int(b.bin[confirmations-1]) - 1
  	if max < min {
  		max = min
  	}
  	feeIndex := (min + max) / 2
  	if feeIndex >= len(b.feeRate) {
  		feeIndex = len(b.feeRate) - 1
  	}
  
  	return b.feeRate[feeIndex]
  }
docs: // estimateFee returns the estimated fee for a transaction
  // to confirm in confirmations blocks from now, given
  // the data set we have collected.