All lessons · CKB node, RPC and indexer · Start here · Glossary
Simulating a real CKB reorg with two devnet nodes over P2PAdvancedFrom one fix
From one fix · Check: right · Checked 2026-11-19
To exercise genuine fork choice on a Dummy devnet, partition two nodes with set_network_active(false) plus remove_node, wait until get_peers is empty on both, then mine a longer competing branch on one node with generate_block. Reconnect with set_network_active(true) and add_node(node_id, /ip4/.../tcp/port), and wait until both nodes report the same get_tip_header hash and the same tx_pool_info tip_hash before checking reorg recovery.
Why it matters: Without a confirmed partition the peer simply syncs the main branch and no competing fork forms. Without waiting for both the tip hash and tx_pool_info tip_hash to converge, reorg checks such as liveness, recovery and dependency rejection run against a node that has not yet switched branches or refreshed its pool.
Pattern
rpc::call_at(peer, "add_node", json!([info["node_id"], address]))?;Taken from the commit, shortened.
- Concepts
- Testing and devnet, Network and RPC reliability
- Evidence
- From one fix: from one project, checked against its commit
- First seen
- 2026-10-10
- Last changed
- 2026-10-10
- Last checked
- 2026-11-19
- Check against the commit
- right: the lesson follows from its commit and still holds in the code today
Sources (2)
- 2026-10-10 · Tactus-Labs/tactus-o1 · more from this project
- 2026-10-10 · Tactus-Labs/tactus-o1 · more from this project
More about CKB node, RPC and indexer
- get_transaction returns an object with a null transaction for rejected and unknown txs
- CKB log subscription notifications may carry params.result as a JSON string
- Wait for tx_pool_info tip to match chain tip before submitting on devnet
Do you maintain a project this lesson came from? Confirm or correct it
Cite this lesson
LusoCryptoLabs, "Simulating a real CKB reorg with two devnet nodes over P2P", CKB lessons, https://pulse.lusocryptolabs.com/learned/node/simulating-a-real-ckb-reorg-with-two-devnet-nodes-over-p2p, CC BY 4.0, last changed 2026-10-10.