mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-12-25 01:26:45 +00:00
fix input vbytes type from int to double
This commit is contained in:
parent
8484dd397b
commit
38b04b8e0b
2 changed files with 13 additions and 6 deletions
|
@ -1320,7 +1320,7 @@ public enum ScriptType {
|
|||
//Start with length of output
|
||||
int outputVbytes = output.getLength();
|
||||
//Add length of spending input (with or without discount depending on script type)
|
||||
int inputVbytes = getInputVbytes();
|
||||
double inputVbytes = getInputVbytes();
|
||||
|
||||
//Return fee rate in sats/vByte multiplied by the calculated output and input vByte lengths
|
||||
return (long)(feeRate * outputVbytes + longTermFeeRate * inputVbytes);
|
||||
|
@ -1333,17 +1333,17 @@ public enum ScriptType {
|
|||
*
|
||||
* @return The number of vBytes required for an input of this script type
|
||||
*/
|
||||
public int getInputVbytes() {
|
||||
public double getInputVbytes() {
|
||||
if(P2SH_P2WPKH.equals(this)) {
|
||||
return (32 + 4 + 1 + 13 + (107 / WITNESS_SCALE_FACTOR) + 4);
|
||||
return (32 + 4 + 1 + 13 + ((double)107 / WITNESS_SCALE_FACTOR) + 4);
|
||||
} else if(P2SH_P2WSH.equals(this)) {
|
||||
return (32 + 4 + 1 + 35 + (107 / WITNESS_SCALE_FACTOR) + 4);
|
||||
return (32 + 4 + 1 + 35 + ((double)107 / WITNESS_SCALE_FACTOR) + 4);
|
||||
} else if(P2TR.equals(this)) {
|
||||
//Assume a default keypath spend
|
||||
return (32 + 4 + 1 + (66 / WITNESS_SCALE_FACTOR) + 4);
|
||||
return (32 + 4 + 1 + ((double)66 / WITNESS_SCALE_FACTOR) + 4);
|
||||
} else if(Arrays.asList(WITNESS_TYPES).contains(this)) {
|
||||
//Return length of spending input with 75% discount to script size
|
||||
return (32 + 4 + 1 + (107 / WITNESS_SCALE_FACTOR) + 4);
|
||||
return (32 + 4 + 1 + ((double)107 / WITNESS_SCALE_FACTOR) + 4);
|
||||
} else if(Arrays.asList(NON_WITNESS_TYPES).contains(this)) {
|
||||
//Return length of spending input with no discount
|
||||
return (32 + 4 + 1 + 107 + 4);
|
||||
|
|
|
@ -59,6 +59,13 @@ public class PresetUtxoSelector extends SingleSetUtxoSelector {
|
|||
return excludedUtxos;
|
||||
}
|
||||
|
||||
public TxoFilter asExcludeTxoFilter() {
|
||||
List<BlockTransactionHashIndex> utxos = new ArrayList<>();
|
||||
utxos.addAll(presetUtxos);
|
||||
utxos.addAll(excludedUtxos);
|
||||
return new ExcludeTxoFilter(utxos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shuffleInputs() {
|
||||
return !maintainOrder;
|
||||
|
|
Loading…
Reference in a new issue