Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ type Config struct {
Proxy proxy.Dialer

// The default fee-per-byte for each level
LowFee uint64
MediumFee uint64
HighFee uint64
SuperLowFee uint64
LowFee uint64
MediumFee uint64
HighFee uint64

// The highest allowable fee-per-byte
MaxFee uint64
Expand Down
35 changes: 20 additions & 15 deletions fees.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,34 @@ type feeCache struct {
}

type Fees struct {
Priority uint64 `json:"priority"`
Normal uint64 `json:"normal"`
Economic uint64 `json:"economic"`
Priority uint64 `json:"priority"`
Normal uint64 `json:"normal"`
Economic uint64 `json:"economic"`
SuperEconomic uint64 `json:"superEconomic"`
}

type FeeProvider struct {
maxFee uint64
priorityFee uint64
normalFee uint64
economicFee uint64
feeAPI string
maxFee uint64
priorityFee uint64
normalFee uint64
economicFee uint64
superEconomicFee uint64
feeAPI string

httpClient httpClient

cache *feeCache
}

func NewFeeProvider(maxFee, priorityFee, normalFee, economicFee uint64, feeAPI string, proxy proxy.Dialer) *FeeProvider {
func NewFeeProvider(maxFee, priorityFee, normalFee, economicFee, superEconomicFee uint64, feeAPI string, proxy proxy.Dialer) *FeeProvider {
fp := FeeProvider{
maxFee: maxFee,
priorityFee: priorityFee,
normalFee: normalFee,
economicFee: economicFee,
feeAPI: feeAPI,
cache: new(feeCache),
maxFee: maxFee,
priorityFee: priorityFee,
normalFee: normalFee,
economicFee: economicFee,
superEconomicFee: superEconomicFee,
feeAPI: feeAPI,
cache: new(feeCache),
}
dial := net.Dial
if proxy != nil {
Expand Down Expand Up @@ -84,6 +87,8 @@ func (fp *FeeProvider) GetFeePerByte(feeLevel wallet.FeeLevel) uint64 {
return fp.selectFee(fees.Normal, wallet.PRIOIRTY)
case wallet.ECONOMIC:
return fp.selectFee(fees.Economic, wallet.PRIOIRTY)
case wallet.SUPER_ECONOMIC:
return fp.selectFee(fees.SuperEconomic, wallet.PRIOIRTY)
case wallet.FEE_BUMP:
return fp.selectFee(fees.Priority, wallet.PRIOIRTY)
default:
Expand Down
1 change: 1 addition & 0 deletions wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func NewSPVWallet(config *Config) (*SPVWallet, error) {
config.HighFee,
config.MediumFee,
config.LowFee,
config.SuperLowFee,
config.FeeAPI.String(),
config.Proxy,
),
Expand Down