Changeset View
Changeset View
Standalone View
Standalone View
test/functional/rpc_blockchain.py
Show First 20 Lines • Show All 347 Lines • ▼ Show 20 Lines | def _test_waitforblockheight(self): | ||||
# `rpc/blockchain.cpp:latestblock` incorrectly.) | # `rpc/blockchain.cpp:latestblock` incorrectly.) | ||||
# | # | ||||
b20hash = node.getblockhash(20) | b20hash = node.getblockhash(20) | ||||
b20 = node.getblock(b20hash) | b20 = node.getblock(b20hash) | ||||
def solve_and_send_block(prevhash, height, time): | def solve_and_send_block(prevhash, height, time): | ||||
b = create_block(prevhash, create_coinbase(height), time) | b = create_block(prevhash, create_coinbase(height), time) | ||||
b.solve() | b.solve() | ||||
node.p2p.send_message(msg_block(b)) | node.p2p.send_and_ping(msg_block(b)) | ||||
node.p2p.sync_with_ping() | |||||
return b | return b | ||||
b21f = solve_and_send_block(int(b20hash, 16), 21, b20['time'] + 1) | b21f = solve_and_send_block(int(b20hash, 16), 21, b20['time'] + 1) | ||||
b22f = solve_and_send_block(b21f.sha256, 22, b21f.nTime + 1) | b22f = solve_and_send_block(b21f.sha256, 22, b21f.nTime + 1) | ||||
node.invalidateblock(b22f.hash) | node.invalidateblock(b22f.hash) | ||||
def assert_waitforheight(height, timeout=2): | def assert_waitforheight(height, timeout=2): | ||||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |