MCPcopy Create free account
hub / github.com/ElementsProject/elements / block_submit

Method block_submit

test/functional/feature_nulldummy.py:123–138  ·  view source on GitHub ↗
(self, node, txs, *, with_witness=False, accept)

Source from the content-addressed store, hash-verified

121 self.block_submit(self.nodes[0], test6txs, with_witness=True, accept=True)
122
123 def block_submit(self, node, txs, *, with_witness=False, accept):
124 tmpl = node.getblocktemplate(NORMAL_GBT_REQUEST_PARAMS)
125 assert_equal(tmpl['previousblockhash'], self.lastblockhash)
126 assert_equal(tmpl['height'], self.lastblockheight + 1)
127 block = create_block(tmpl=tmpl, ntime=self.lastblocktime + 1, txlist=txs)
128 if with_witness:
129 add_witness_commitment(block)
130 block.solve()
131 assert_equal(None if accept else NULLDUMMY_ERROR, node.submitblock(block.serialize().hex()))
132 if accept:
133 assert_equal(node.getbestblockhash(), block.hash)
134 self.lastblockhash = block.hash
135 self.lastblocktime += 1
136 self.lastblockheight += 1
137 else:
138 assert_equal(node.getbestblockhash(), self.lastblockhash)
139
140
141if __name__ == '__main__':

Callers 1

run_testMethod · 0.95

Calls 6

assert_equalFunction · 0.90
create_blockFunction · 0.90
add_witness_commitmentFunction · 0.90
hexMethod · 0.80
solveMethod · 0.45
serializeMethod · 0.45

Tested by

no test coverage detected