upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/rpc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc.cpp')
-rw-r--r--src/rpc.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/rpc.cpp b/src/rpc.cpp
index 7c5ef6c..62eec7a 100644
--- a/src/rpc.cpp
+++ b/src/rpc.cpp
@@ -284,6 +284,11 @@ static bool RebuildJob()
284 // Seeded with the header, tx count and coinbase, because 284 // Seeded with the header, tx count and coinbase, because
285 // CheckBlock() weighs the whole serialized block. 285 // CheckBlock() weighs the whole serialized block.
286 unsigned int sz = ::GetSerializeSize(block, SER_DISK); 286 unsigned int sz = ::GetSerializeSize(block, SER_DISK);
287 // And the sigop budget, which CheckBlock() enforces and this
288 // builder never counted against. Same counting function
289 // CheckBlock() sums, seeded from the coinbase because it sums
290 // over all of vtx.
291 unsigned int nSigOps = block.vtx[0].GetSigOpCount();
287 while (fFoundSomething && sz < MAX_BLOCK_SIZE_GEN) 292 while (fFoundSomething && sz < MAX_BLOCK_SIZE_GEN)
288 { 293 {
289 fFoundSomething = false; 294 fFoundSomething = false;
@@ -301,8 +306,9 @@ static bool RebuildJob()
301 // nFees by reference on success, and a transaction we 306 // nFees by reference on success, and a transaction we
302 // then decline would leave the coinbase claiming a fee 307 // then decline would leave the coinbase claiming a fee
303 // this block does not collect. 308 // this block does not collect.
304 unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK); 309 unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK);
305 if (!BlockTemplateFits(sz, nTxSize)) 310 unsigned int nTxSigOps = tx.GetSigOpCount();
311 if (!BlockTemplateFits(sz, nSigOps, nTxSize, nTxSigOps))
306 continue; 312 continue;
307 map<uint256, CTxIndex> tmp(pool); 313 map<uint256, CTxIndex> tmp(pool);
308 if (!tx.ConnectInputs(txdb, tmp, CDiskTxPos(1,1,1), 0, nFees, 314 if (!tx.ConnectInputs(txdb, tmp, CDiskTxPos(1,1,1), 0, nFees,
@@ -310,7 +316,8 @@ static bool RebuildJob()
310 continue; 316 continue;
311 swap(pool, tmp); 317 swap(pool, tmp);
312 block.vtx.push_back(tx); 318 block.vtx.push_back(tx);
313 sz += nTxSize; 319 sz += nTxSize;
320 nSigOps += nTxSigOps;
314 vfAlreadyAdded[n] = true; 321 vfAlreadyAdded[n] = true;
315 fFoundSomething = true; 322 fFoundSomething = true;
316 } 323 }