Skip to content

Commit b1f2d4b

Browse files
jamesdorfmanpsgreco
authored andcommitted
rpc: fix bug in 'utxo_size_inc' calculation
(cherry picked from commit dabea18)
1 parent 61e4941 commit b1f2d4b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/rpc/blockchain.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2261,6 +2261,7 @@ static RPCHelpMan getblockstats()
22612261
if (out.nValue.IsExplicit() && out.nAsset.IsExplicit() && out.nAsset.GetAsset() == asset) {
22622262
tx_total_out += out.nValue.GetAmount();
22632263
}
2264+
utxo_size_inc += GetSerializeSize(out, PROTOCOL_VERSION) + PER_UTXO_OVERHEAD;
22642265
}
22652266
}
22662267
} else {

test/functional/data/rpc_getblockstats.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
"totalfee": 0,
143143
"txs": 1,
144144
"utxo_increase": 2,
145-
"utxo_size_inc": 0
145+
"utxo_size_inc": 233
146146
},
147147
{
148148
"avgfee": 6720,
@@ -179,7 +179,7 @@
179179
"totalfee": 6720,
180180
"txs": 2,
181181
"utxo_increase": 4,
182-
"utxo_size_inc": -110
182+
"utxo_size_inc": 424
183183
},
184184
{
185185
"avgfee": 32320,
@@ -216,7 +216,7 @@
216216
"totalfee": 96960,
217217
"txs": 4,
218218
"utxo_increase": 8,
219-
"utxo_size_inc": -326
219+
"utxo_size_inc": 810
220220
}
221221
]
222222
}

0 commit comments

Comments
 (0)