sweep: add new interface method Immediate
This prepares the following commit where we now let the fee bumpr decides whether to broadcast immediately or not.
This commit is contained in:
5 files changed
+36
No files matched your search
@@ -64,6 +64,13 @@ type InputSet interface {
|
||||
// StartingFeeRate returns the max starting fee rate found in the
|
||||
// inputs.
|
||||
StartingFeeRate() fn.Option[chainfee.SatPerKWeight]
|
||||
|
||||
// Immediate returns a boolean to indicate whether the tx made from
|
||||
// this input set should be published immediately.
|
||||
//
|
||||
// TODO(yy): create a new method `Params` to combine the informational
|
||||
// methods DeadlineHeight, Budget, StartingFeeRate and Immediate.
|
||||
Immediate() bool
|
||||
}
|
||||
|
||||
// createWalletTxInput converts a wallet utxo into an object that can be added
|
||||
@@ -414,3 +421,18 @@ func (b *BudgetInputSet) StartingFeeRate() fn.Option[chainfee.SatPerKWeight] {
|
||||
|
||||
return startingFeeRate
|
||||
}
|
||||
|
||||
// Immediate returns whether the inputs should be swept immediately.
|
||||
//
|
||||
// NOTE: part of the InputSet interface.
|
||||
func (b *BudgetInputSet) Immediate() bool {
|
||||
for _, inp := range b.inputs {
|
||||
// As long as one of the inputs is immediate, the whole set is
|
||||
// immediate.
|
||||
if inp.params.Immediate {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
Reference in new issue
Block a user