From c14be202685a56471c685eee3d0ed75ed8d0a9b5 Mon Sep 17 00:00:00 2001 From: lateminer <9951982+lateminer@users.noreply.github.com> Date: Sat, 3 Feb 2024 22:51:54 +0100 Subject: [PATCH] wallet: Take into account nTime field when calculating transaction weight --- src/wallet/spend.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp index 6fbbfbace4..d4c87f1176 100644 --- a/src/wallet/spend.cpp +++ b/src/wallet/spend.cpp @@ -140,6 +140,11 @@ TxSize CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *walle // Segwit marker and flag if (is_segwit) weight += 2; + // Blackcoin: transaction weight should be increased for v1 transactions because of additional nTime field + // We assume that v1 transactions have nTime != 0 + bool is_old_tx = tx.nTime > 0; + if (is_old_tx) weight += 4 * WITNESS_SCALE_FACTOR; + // Add the size of the transaction outputs. for (const auto& txo : tx.vout) weight += GetSerializeSize(txo, PROTOCOL_VERSION) * WITNESS_SCALE_FACTOR;