Skip to content

Commit b117eb4

Browse files
committed
Merge ElementsProject#747: feature_blocksign.py: Allot for possibility of non-empty block 0.5RTT
fcc7051 feature_blocksign.py: Allot for possibility of non-empty block 0.5RTT (Gregory Sanders) Pull request description: The way the test is run, the last node(non-signer) can actually become the block producer. This, in conjunction with its p2p connection to node 0, means that when node 0 is doing it's compact block back and forth, it can actually create a complete block in 0.5 RTT even if transactions were generated for that block. Allow this to happen. This may have been a bug in that the non-signer shouldn't have been making blocks, but this is actually more interesting behavior to test, where sometimes partially-complete compact blocks are made, sometimes full, sometimes empty. This exercises more code paths, and so I'm just making sure this succeeds instead, and assert it only succeeds in the expected situation. Tree-SHA512: f6267208c51344a26636fce4635297f050e2989ec231d2d21463e9a987b58d0a8635bea057b60216fa709ca094cf741ce8acfc0b1d321b6498409c73a19c8fd1
2 parents 06209ba + fcc7051 commit b117eb4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/functional/feature_blocksign.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,19 @@ def mine_block(self, make_transactions):
116116
# miner makes a block
117117
block = miner.getnewblockhex()
118118

119-
# other signing nodes get fed compact blocks
119+
# All nodes get compact blocks, first node may get complete
120+
# block in 0.5 RTT even with transactions thanks to p2p connection
121+
# with non-signing node being miner
120122
for i in range(self.num_keys):
121123
if i == mineridx:
122124
continue
123125
sketch = miner.getcompactsketch(block)
124126
compact_response = self.nodes[i].consumecompactsketch(sketch)
125-
if make_transactions:
127+
if "block_tx_req" in compact_response:
126128
block_txn = self.nodes[i].consumegetblocktxn(block, compact_response["block_tx_req"])
127129
final_block = self.nodes[i].finalizecompactblock(sketch, block_txn, compact_response["found_transactions"])
128130
else:
131+
assert (mineridx == 4 and i == 0) or not make_transactions
129132
# If there's only coinbase, it should succeed immediately
130133
final_block = compact_response["blockhex"]
131134
# Block should be complete, sans signatures

0 commit comments

Comments
 (0)