Skip to content

Commit 4fb3706

Browse files
committed
fixup! discount: assert on witness size
1 parent a67b08f commit 4fb3706

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/policy/discount.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ static inline int64_t GetDiscountVirtualTransactionSize(const CTransaction& tx,
2626
const CTxOut& output = tx.vout[i];
2727
if (i < tx.witness.vtxoutwit.size()) {
2828
// subtract the weight of the output witness, except the 2 bytes used to serialize the empty proofs
29-
int64_t witness_size = ::GetSerializeSize(tx.witness.vtxoutwit[i], PROTOCOL_VERSION) - 2;
30-
assert(witness_size >= 0);
31-
weight -= witness_size;
29+
size_t witness_size = ::GetSerializeSize(tx.witness.vtxoutwit[i], PROTOCOL_VERSION);
30+
assert(witness_size >= 2);
31+
weight -= (witness_size - 2);
3232
}
3333
if (output.nValue.IsCommitment()) {
3434
// subtract the weight difference of amount commitment (33) vs explicit amount (9)

test/functional/feature_discount_ct_ordering.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ def run_test(self):
6969
info = node1.getaddressinfo(addr)
7070
txid = node0.sendtoaddress(info['unconfidential'], 1.0, "", "", False, None, None, None, None, None, None, feerate)
7171
tx = node0.gettransaction(txid, True, True)
72-
print(tx['hex'])
7372
decoded = tx['decoded']
7473
vin = decoded['vin']
7574
vout = decoded['vout']
@@ -146,7 +145,6 @@ def run_test(self):
146145
self.sync_mempools([node1, node2])
147146
tx = node1.gettransaction(txid, True, True)
148147
decoded = tx['decoded']
149-
print(decoded['fee'])
150148
assert_equal(decoded['fee'][bitcoin], Decimal('0.00000820'))
151149

152150
# check that txs in the block template are in decreasing feerate according to their discount size

0 commit comments

Comments
 (0)