mirror of
https://github.com/muun/recovery.git
synced 2025-11-11 22:40:16 -05:00
Update project structure and build process
This commit is contained in:
35
libwallet/newop/fee_window.go
Normal file
35
libwallet/newop/fee_window.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package newop
|
||||
|
||||
import "github.com/muun/libwallet/operation"
|
||||
|
||||
// FeeWindow holds a map of target block to fee rate for a given time
|
||||
type FeeWindow struct {
|
||||
FastConfTarget int64
|
||||
MediumConfTarget int64
|
||||
SlowConfTarget int64
|
||||
TargetedFees map[uint]float64
|
||||
}
|
||||
|
||||
func (w *FeeWindow) PutTargetedFees(target int64, feeRateInSatsPerVByte float64) {
|
||||
if w.TargetedFees == nil {
|
||||
w.TargetedFees = make(map[uint]float64)
|
||||
}
|
||||
w.TargetedFees[uint(target)] = feeRateInSatsPerVByte
|
||||
}
|
||||
|
||||
func (w *FeeWindow) GetTargetedFees(target int64) float64 {
|
||||
if w.TargetedFees == nil {
|
||||
return 0
|
||||
}
|
||||
return w.TargetedFees[uint(target)]
|
||||
}
|
||||
|
||||
func (w *FeeWindow) nextHighestBlock(feeRate float64) int64 {
|
||||
return int64(w.toInternalType().NextHighestBlock(feeRate))
|
||||
}
|
||||
|
||||
func (w *FeeWindow) toInternalType() *operation.FeeWindow {
|
||||
return &operation.FeeWindow{
|
||||
TargetedFees: w.TargetedFees,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user