Changeset View
Changeset View
Standalone View
Standalone View
test/functional/interface_zmq.py
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | def test_basic(self): | ||||
hash = hashblock.receive().hex() | hash = hashblock.receive().hex() | ||||
assert_equal(genhashes[x], hash) | assert_equal(genhashes[x], hash) | ||||
# The block should only have the coinbase txid. | # The block should only have the coinbase txid. | ||||
assert_equal([txid.hex()], self.nodes[1].getblock(hash)["tx"]) | assert_equal([txid.hex()], self.nodes[1].getblock(hash)["tx"]) | ||||
if self.is_wallet_compiled(): | if self.is_wallet_compiled(): | ||||
self.log.info("Wait for tx from second node") | self.log.info("Wait for tx from second node") | ||||
payment_txid = self.nodes[1].sendtoaddress( | payment_txid = self.nodes[1].sendtoaddress( | ||||
self.nodes[0].getnewaddress(), 1.0) | self.nodes[0].getnewaddress(), 1000000) | ||||
self.sync_all() | self.sync_all() | ||||
# Should receive the broadcasted txid. | # Should receive the broadcasted txid. | ||||
txid = hashtx.receive() | txid = hashtx.receive() | ||||
assert_equal(payment_txid, txid.hex()) | assert_equal(payment_txid, txid.hex()) | ||||
# Should receive the broadcasted raw transaction. | # Should receive the broadcasted raw transaction. | ||||
hex = rawtx.receive() | hex = rawtx.receive() | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | def test_reorg(self): | ||||
for socket in sockets: | for socket in sockets: | ||||
socket.connect(address) | socket.connect(address) | ||||
# Relax so that the subscriber is ready before publishing zmq messages | # Relax so that the subscriber is ready before publishing zmq messages | ||||
sleep(0.2) | sleep(0.2) | ||||
# Generate 1 block in nodes[0] with 1 mempool tx and receive all | # Generate 1 block in nodes[0] with 1 mempool tx and receive all | ||||
# notifications | # notifications | ||||
payment_txid = self.nodes[0].sendtoaddress( | payment_txid = self.nodes[0].sendtoaddress( | ||||
self.nodes[0].getnewaddress(), 1.0) | self.nodes[0].getnewaddress(), 1000000) | ||||
disconnect_block = self.nodes[0].generatetoaddress( | disconnect_block = self.nodes[0].generatetoaddress( | ||||
1, ADDRESS_BCHREG_UNSPENDABLE)[0] | 1, ADDRESS_BCHREG_UNSPENDABLE)[0] | ||||
disconnect_cb = self.nodes[0].getblock(disconnect_block)["tx"][0] | disconnect_cb = self.nodes[0].getblock(disconnect_block)["tx"][0] | ||||
assert_equal( | assert_equal( | ||||
self.nodes[0].getbestblockhash(), | self.nodes[0].getbestblockhash(), | ||||
hashblock.receive().hex()) | hashblock.receive().hex()) | ||||
assert_equal(hashtx.receive().hex(), payment_txid) | assert_equal(hashtx.receive().hex(), payment_txid) | ||||
assert_equal(hashtx.receive().hex(), disconnect_cb) | assert_equal(hashtx.receive().hex(), disconnect_cb) | ||||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |