Todas as lições · CKB node, RPC and indexer · Começa aqui · Glossário
CKB log subscription notifications may carry params.result as a JSON stringPráticoDe uma correção
De uma correção · Verificação: certa · Verificada em 2026-11-19
When subscribing to the CKB node's "log" topic over the TCP subscription RPC, the notification's params.result can be a JSON-encoded string of the log entry (message, level, target, date) rather than an object. Parse it with JSON.parse when it is a string, and skip malformed payloads instead of stopping the stream; otherwise script debug output (target ckb_script::verify) is silently dropped.
Porque importa: A client that only accepts an object in params.result discards every log notification CKB sends as a JSON string, so script debug output from ckb_script::verify never reaches the developer.
Padrão
if (typeof result === 'string') { try { result = JSON.parse(result); } catch { return null; } }Tirado do commit, encurtado.
Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- ckb-devrel/offckb:
tests/cli-startup.test.ts,tests/log-subscription.test.ts
- Conceitos
- Network and RPC reliability, Testing and devnet
- Evidência
- De uma correção: de um projeto, verificada contra o commit
- Vista pela primeira vez
- 2026-11-09
- Última mudança
- 2026-11-09
- Ú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 (1)
- 2026-11-09 · ckb-devrel/offckb · mais deste projeto
Mais sobre CKB node, RPC and indexer
- get_transaction returns an object with a null transaction for rejected and unknown txs
- 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, "CKB log subscription notifications may carry params.result as a JSON string", CKB lessons, https://pulse.lusocryptolabs.com/learned/node/ckb-log-subscription-notifications-may-carry-params-result-a, CC BY 4.0, last changed 2026-11-09.