Todas as lições · CKB node, RPC and indexer · Começa aqui · Glossário
get_transaction returns an object with a null transaction for rejected and unknown txsPráticoVista outra vez
Vista outra vez · Verificação: certa · Verificada em 2026-11-19
The CKB node's get_transaction RPC does not return a null result for rejected or unknown hashes: it returns an object whose transaction field is null and whose tx_status.status is "rejected" (with tx_status.reason holding the rejection reason) or "unknown". Check res.transaction, not just res, before reading outputs, surface tx_status.reason to users, and make test mocks return this shape rather than result null.
Porque importa: Code that treats only a null result as 'not found' misreads unknown or rejected hashes: it crashes or misbehaves on the null transaction field, hides the node's rejection reason, and test mocks returning null guard against a shape real nodes never send.
Joined with toastmanAu/openswap@4dbe3232c3.
Padrão
if (res.tx_status.status === "rejected") return { hash, status: "rejected", reason: res.tx_status.reason ?? null, rejected: true };Tirado do commit, encurtado.
Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- toastmanAu/openswap:
frontend/test/fixtures.ts
- Conceitos
- Network and RPC reliability, Testing and devnet
- Evidência
- Vista outra vez: vista em dois ou mais projetos
- Vista pela primeira vez
- 2026-10-30
- Última mudança
- 2026-10-30
- Última verificação
- 2026-11-19
- Verificação contra o commit
- certa: a lição sai do commit e continua a valer no código de hoje
Fontes (2)
- 2026-10-30 · wildanrhmn/ckb-devnet-explorer · mais deste projeto
- 2026-10-22 · toastmanAu/openswap · mais deste projeto
Mais sobre CKB node, RPC and indexer
- CKB log subscription notifications may carry params.result as a JSON string
- Simulating a real CKB reorg with two devnet nodes over P2P
- Wait for tx_pool_info tip to match chain tip before submitting on devnet
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
LusoCryptoLabs, "get_transaction returns an object with a null transaction for rejected and unknown txs", CKB lessons, https://pulse.lusocryptolabs.com/learned/node/get-transaction-returns-an-object-with-a-null-transaction-fo, CC BY 4.0, last changed 2026-10-30.