In coin_selector.rs, the body of Candidate::new_tr_keyspend looks like this:
pub fn new_tr_keyspend(value: u64) -> Self {
let weight = TXIN_BASE_WEIGHT + TR_KEYSPEND_SATISFACTION_WEIGHT;
Self::new(value, weight, true)
}
next, Self::new has this:
pub fn new(value: u64, satisfaction_weight: u64, is_segwit: bool) -> Candidate {
let weight = TXIN_BASE_WEIGHT + satisfaction_weight;
Candidate {
value,
weight,
input_count: 1,
is_segwit,
}
}
So TXIN_BASE_WEIGHT is counted twice.
To fix, the duplicate TXIN_BASE_WEIGHT should be removed from the body of Candidate::new_tr_keyspend.
In
coin_selector.rs, the body ofCandidate::new_tr_keyspendlooks like this:next,
Self::newhas this:So
TXIN_BASE_WEIGHTis counted twice.To fix, the duplicate
TXIN_BASE_WEIGHTshould be removed from the body ofCandidate::new_tr_keyspend.