11import {
22 type JsonRpcBlock ,
3- type JsonRpcTransaction ,
43 JsonRpcTransformers ,
54} from "@ckb-ccc/core/advancedBarrel" ;
65import { WebSocket } from "ws" ;
76import type { DB } from "../db" ;
87import { logger } from "../util/logger" ;
98import type {
109 JsonRpcPoolTransactionEntry ,
11- JsonRpcTransactionView ,
10+ PoolTransactionReject ,
1211} from "./type" ;
1312
1413export interface WebsocketTopicSubscriber {
@@ -100,10 +99,10 @@ export class Subscriber {
10099 sub_id : undefined ,
101100 handler : ( [ tx , reason ] : [
102101 JsonRpcPoolTransactionEntry ,
103- string ,
102+ PoolTransactionReject ,
104103 ] ) => {
105104 logger . debug (
106- `new rejected tx: ${ tx . transaction . hash . slice ( 0 , 22 ) } , reason: ${ reason } ` ,
105+ `new rejected tx: ${ tx . transaction . hash . slice ( 0 , 22 ) } , reason: ${ JSON . stringify ( reason ) } ` ,
107106 ) ;
108107 this . db . updateMempoolRejectedTransaction ( tx , reason ) ;
109108 } ,
@@ -115,7 +114,7 @@ export class Subscriber {
115114 run ( ) {
116115 const topics = this . createTopicSubscriber ( ) ;
117116 this . ws . on ( "open" , ( ) => {
118- logger . info ( " Connected to CKB node " , this . ckbRpcUrl ) ;
117+ logger . info ( ` Connected to CKB node ${ this . ckbRpcUrl } ` ) ;
119118 for ( const topic of topics ) {
120119 this . ws . send (
121120 JSON . stringify ( {
@@ -159,7 +158,7 @@ export class Subscriber {
159158 } ) ;
160159
161160 this . ws . on ( "close" , ( ) => {
162- logger . info ( " Disconnected from CKB node" ) ;
161+ logger . info ( ` Disconnected from CKB node ${ this . ckbRpcUrl } ` ) ;
163162 } ) ;
164163 }
165164}
0 commit comments