mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-11-02 18:26:43 +00:00
use fractional tx virtual size
This commit is contained in:
parent
5b2e21b3d7
commit
533791edcf
2 changed files with 4 additions and 4 deletions
|
@ -303,8 +303,8 @@ public class Transaction extends ChildMessage {
|
|||
return length;
|
||||
}
|
||||
|
||||
public int getVirtualSize() {
|
||||
return (int)Math.ceil((double)getWeightUnits() / (double)WITNESS_SCALE_FACTOR);
|
||||
public double getVirtualSize() {
|
||||
return (double)getWeightUnits() / (double)WITNESS_SCALE_FACTOR;
|
||||
}
|
||||
|
||||
public int getWeightUnits() {
|
||||
|
|
|
@ -489,7 +489,7 @@ public class Wallet {
|
|||
transaction.addOutput(payment.getAmount(), payment.getAddress());
|
||||
}
|
||||
|
||||
int noChangeVSize = transaction.getVirtualSize();
|
||||
double noChangeVSize = transaction.getVirtualSize();
|
||||
long noChangeFeeRequiredAmt = (fee == null ? (long)(feeRate * noChangeVSize) : fee);
|
||||
|
||||
//Add 1 satoshi to accommodate longer signatures when feeRate equals default min relay fee to ensure fee is sufficient
|
||||
|
@ -528,7 +528,7 @@ public class Wallet {
|
|||
//Change output is required, determine new fee once change output has been added
|
||||
WalletNode changeNode = getFreshNode(KeyPurpose.CHANGE);
|
||||
TransactionOutput changeOutput = new TransactionOutput(transaction, changeAmt, getOutputScript(changeNode));
|
||||
int changeVSize = noChangeVSize + changeOutput.getLength();
|
||||
double changeVSize = noChangeVSize + changeOutput.getLength();
|
||||
long changeFeeRequiredAmt = (fee == null ? (long)(feeRate * changeVSize) : fee);
|
||||
changeFeeRequiredAmt = (feeRate == Transaction.DEFAULT_MIN_RELAY_FEE ? changeFeeRequiredAmt + 1 : changeFeeRequiredAmt);
|
||||
|
||||
|
|
Loading…
Reference in a new issue