Skip to content

Commit 5f3472d

Browse files
jamesdorfmanpsgreco
authored andcommitted
rpc: fix bug in 'utxo_size_inc' calculation
(cherry picked from commit dabea18)
1 parent 56d05db commit 5f3472d

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
@@ -2260,6 +2260,7 @@ static RPCHelpMan getblockstats()
22602260
if (out.nValue.IsExplicit() && out.nAsset.IsExplicit() && out.nAsset.GetAsset() == asset) {
22612261
tx_total_out += out.nValue.GetAmount();
22622262
}
2263+
utxo_size_inc += GetSerializeSize(out, PROTOCOL_VERSION) + PER_UTXO_OVERHEAD;
22632264
}
22642265
}
22652266
} 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)