mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-04 21:36:45 +00:00
use and display fractional tx virtual size, indicate sizes on unfinalized txes may change
This commit is contained in:
parent
7ed75fc83d
commit
0070cbfb1e
4 changed files with 18 additions and 7 deletions
2
drongo
2
drongo
|
@ -1 +1 @@
|
||||||
Subproject commit 5b2e21b3d7cc5d6dff730baeec5efbb419f3555c
|
Subproject commit 533791edcf38a6ca05857483df15a5c54a4554f0
|
|
@ -183,7 +183,7 @@ public class EntryCell extends TreeTableCell<Entry, Entry> {
|
||||||
|
|
||||||
long changeTotal = ourOutputs.stream().mapToLong(TransactionOutput::getValue).sum();
|
long changeTotal = ourOutputs.stream().mapToLong(TransactionOutput::getValue).sum();
|
||||||
Transaction tx = blockTransaction.getTransaction();
|
Transaction tx = blockTransaction.getTransaction();
|
||||||
int vSize = tx.getVirtualSize();
|
double vSize = tx.getVirtualSize();
|
||||||
int inputSize = tx.getInputs().get(0).getLength() + (tx.getInputs().get(0).hasWitness() ? tx.getInputs().get(0).getWitness().getLength() / Transaction.WITNESS_SCALE_FACTOR : 0);
|
int inputSize = tx.getInputs().get(0).getLength() + (tx.getInputs().get(0).hasWitness() ? tx.getInputs().get(0).getWitness().getLength() / Transaction.WITNESS_SCALE_FACTOR : 0);
|
||||||
List<BlockTransactionHashIndex> walletUtxos = new ArrayList<>(transactionEntry.getWallet().getWalletUtxos().keySet());
|
List<BlockTransactionHashIndex> walletUtxos = new ArrayList<>(transactionEntry.getWallet().getWalletUtxos().keySet());
|
||||||
Collections.shuffle(walletUtxos);
|
Collections.shuffle(walletUtxos);
|
||||||
|
|
|
@ -397,7 +397,7 @@ public class TransactionDiagram extends GridPane {
|
||||||
|
|
||||||
String txDesc = "Transaction";
|
String txDesc = "Transaction";
|
||||||
Label txLabel = new Label(txDesc);
|
Label txLabel = new Label(txDesc);
|
||||||
Tooltip tooltip = new Tooltip(walletTx.getTransaction().getLength() + " bytes\n" + walletTx.getTransaction().getVirtualSize() + " vBytes");
|
Tooltip tooltip = new Tooltip(walletTx.getTransaction().getLength() + " bytes\n" + String.format("%.2f", walletTx.getTransaction().getVirtualSize()) + " vBytes");
|
||||||
tooltip.setShowDelay(new Duration(TOOLTIP_SHOW_DELAY));
|
tooltip.setShowDelay(new Duration(TOOLTIP_SHOW_DELAY));
|
||||||
tooltip.getStyleClass().add("transaction-tooltip");
|
tooltip.getStyleClass().add("transaction-tooltip");
|
||||||
txLabel.setTooltip(tooltip);
|
txLabel.setTooltip(tooltip);
|
||||||
|
|
|
@ -29,6 +29,7 @@ import javafx.collections.ObservableMap;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.input.Clipboard;
|
import javafx.scene.input.Clipboard;
|
||||||
import javafx.scene.input.ClipboardContent;
|
import javafx.scene.input.ClipboardContent;
|
||||||
|
@ -451,7 +452,7 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
|
|
||||||
private void updateSize() {
|
private void updateSize() {
|
||||||
size.setText(headersForm.getTransaction().getSize() + " B");
|
size.setText(headersForm.getTransaction().getSize() + " B");
|
||||||
virtualSize.setText(headersForm.getTransaction().getVirtualSize() + " vB");
|
virtualSize.setText(String.format("%.2f", headersForm.getTransaction().getVirtualSize()) + " vB");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Long calculateFee(Map<Sha256Hash, BlockTransaction> inputTransactions) {
|
private Long calculateFee(Map<Sha256Hash, BlockTransaction> inputTransactions) {
|
||||||
|
@ -599,11 +600,21 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
private void updateTxId() {
|
private void updateTxId() {
|
||||||
id.setText(headersForm.getTransaction().calculateTxId(false).toString());
|
id.setText(headersForm.getTransaction().calculateTxId(false).toString());
|
||||||
if(!headersForm.isTransactionFinalized()) {
|
if(!headersForm.isTransactionFinalized()) {
|
||||||
if(!id.getStyleClass().contains(UNFINALIZED_TXID_CLASS)) {
|
addStyleClass(id, UNFINALIZED_TXID_CLASS);
|
||||||
id.getStyleClass().add(UNFINALIZED_TXID_CLASS);
|
addStyleClass(size, UNFINALIZED_TXID_CLASS);
|
||||||
}
|
addStyleClass(virtualSize, UNFINALIZED_TXID_CLASS);
|
||||||
|
addStyleClass(feeRate, UNFINALIZED_TXID_CLASS);
|
||||||
} else {
|
} else {
|
||||||
id.getStyleClass().remove(UNFINALIZED_TXID_CLASS);
|
id.getStyleClass().remove(UNFINALIZED_TXID_CLASS);
|
||||||
|
size.getStyleClass().remove(UNFINALIZED_TXID_CLASS);
|
||||||
|
virtualSize.getStyleClass().remove(UNFINALIZED_TXID_CLASS);
|
||||||
|
feeRate.getStyleClass().remove(UNFINALIZED_TXID_CLASS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addStyleClass(Node node, String styleClass) {
|
||||||
|
if(!node.getStyleClass().contains(styleClass)) {
|
||||||
|
node.getStyleClass().add(styleClass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue