Changeset View
Changeset View
Standalone View
Standalone View
test/functional/bipdersig-p2p.py
Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
block = create_block( | block = create_block( | ||||
int(tip, 16), create_coinbase(DERSIG_HEIGHT), block_time) | int(tip, 16), create_coinbase(DERSIG_HEIGHT), block_time) | ||||
block.nVersion = 2 | block.nVersion = 2 | ||||
block.rehash() | block.rehash() | ||||
block.solve() | block.solve() | ||||
node0.send_and_ping(msg_block(block)) | node0.send_and_ping(msg_block(block)) | ||||
assert_equal(self.nodes[0].getbestblockhash(), tip) | assert_equal(self.nodes[0].getbestblockhash(), tip) | ||||
assert wait_until(lambda: "reject" in node0.last_message.keys()) | wait_until(lambda: "reject" in node0.last_message.keys(), | ||||
lock=mininode_lock) | |||||
with mininode_lock: | with mininode_lock: | ||||
assert_equal(node0.last_message["reject"].code, REJECT_OBSOLETE) | assert_equal(node0.last_message["reject"].code, REJECT_OBSOLETE) | ||||
assert_equal( | assert_equal( | ||||
node0.last_message["reject"].reason, b'bad-version(0x00000002)') | node0.last_message["reject"].reason, b'bad-version(0x00000002)') | ||||
assert_equal(node0.last_message["reject"].data, block.sha256) | assert_equal(node0.last_message["reject"].data, block.sha256) | ||||
del node0.last_message["reject"] | del node0.last_message["reject"] | ||||
self.log.info( | self.log.info( | ||||
Show All 9 Lines | def run_test(self): | ||||
block.vtx.append(spendtx) | block.vtx.append(spendtx) | ||||
block.hashMerkleRoot = block.calc_merkle_root() | block.hashMerkleRoot = block.calc_merkle_root() | ||||
block.rehash() | block.rehash() | ||||
block.solve() | block.solve() | ||||
node0.send_and_ping(msg_block(block)) | node0.send_and_ping(msg_block(block)) | ||||
assert_equal(self.nodes[0].getbestblockhash(), tip) | assert_equal(self.nodes[0].getbestblockhash(), tip) | ||||
assert wait_until(lambda: "reject" in node0.last_message.keys()) | wait_until(lambda: "reject" in node0.last_message.keys(), | ||||
lock=mininode_lock) | |||||
with mininode_lock: | with mininode_lock: | ||||
# We can receive different reject messages depending on whether | # We can receive different reject messages depending on whether | ||||
# bitcoind is running with multiple script check threads. If script | # bitcoind is running with multiple script check threads. If script | ||||
# check threads are not in use, then transaction script validation | # check threads are not in use, then transaction script validation | ||||
# happens sequentially, and bitcoind produces more specific reject | # happens sequentially, and bitcoind produces more specific reject | ||||
# reasons. | # reasons. | ||||
assert node0.last_message["reject"].code in [ | assert node0.last_message["reject"].code in [ | ||||
REJECT_INVALID, REJECT_NONSTANDARD] | REJECT_INVALID, REJECT_NONSTANDARD] | ||||
Show All 22 Lines |