sweeper/tx_input_set: add logging for input set construction
This commit is contained in:
parent
6150995b46
commit
83f9aaec98
@ -293,10 +293,10 @@ func (t *txInputSet) add(input input.Input, constraints addConstraints) bool {
|
|||||||
// minimizing any negative externalities we cause for the Bitcoin system as a
|
// minimizing any negative externalities we cause for the Bitcoin system as a
|
||||||
// whole.
|
// whole.
|
||||||
func (t *txInputSet) addPositiveYieldInputs(sweepableInputs []txInput) {
|
func (t *txInputSet) addPositiveYieldInputs(sweepableInputs []txInput) {
|
||||||
for _, input := range sweepableInputs {
|
for i, inp := range sweepableInputs {
|
||||||
// Apply relaxed constraints for force sweeps.
|
// Apply relaxed constraints for force sweeps.
|
||||||
constraints := constraintsRegular
|
constraints := constraintsRegular
|
||||||
if input.parameters().Force {
|
if inp.parameters().Force {
|
||||||
constraints = constraintsForce
|
constraints = constraintsForce
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,16 +304,26 @@ func (t *txInputSet) addPositiveYieldInputs(sweepableInputs []txInput) {
|
|||||||
// succeed because it wouldn't increase the output value,
|
// succeed because it wouldn't increase the output value,
|
||||||
// return. Assuming inputs are sorted by yield, any further
|
// return. Assuming inputs are sorted by yield, any further
|
||||||
// inputs wouldn't increase the output value either.
|
// inputs wouldn't increase the output value either.
|
||||||
if !t.add(input, constraints) {
|
if !t.add(inp, constraints) {
|
||||||
|
var rem []input.Input
|
||||||
|
for j := i; j < len(sweepableInputs); j++ {
|
||||||
|
rem = append(rem, sweepableInputs[j])
|
||||||
|
}
|
||||||
|
log.Debugf("%d negative yield inputs not added to "+
|
||||||
|
"input set: %v", len(rem),
|
||||||
|
inputTypeSummary(rem))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Debugf("Added positive yield input %v to input set",
|
||||||
|
inputTypeSummary([]input.Input{inp}))
|
||||||
}
|
}
|
||||||
|
|
||||||
// We managed to add all inputs to the set.
|
// We managed to add all inputs to the set.
|
||||||
}
|
}
|
||||||
|
|
||||||
// tryAddWalletInputsIfNeeded retrieves utxos from the wallet and tries adding as
|
// tryAddWalletInputsIfNeeded retrieves utxos from the wallet and tries adding
|
||||||
// many as required to bring the tx output value above the given minimum.
|
// as many as required to bring the tx output value above the given minimum.
|
||||||
func (t *txInputSet) tryAddWalletInputsIfNeeded() error {
|
func (t *txInputSet) tryAddWalletInputsIfNeeded() error {
|
||||||
// If we've already have enough to pay the transaction fees and have at
|
// If we've already have enough to pay the transaction fees and have at
|
||||||
// least one output materialize, no action is needed.
|
// least one output materialize, no action is needed.
|
||||||
|
Loading…
Reference in New Issue
Block a user