File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export class ETH extends EventEmitter {
23
23
_hardfork : string = 'chainstart'
24
24
_latestBlock : number = 0
25
25
_forkHash : string = ''
26
- _nextForkBlock : number = 0
26
+ _nextForkBlock : number | null = null
27
27
28
28
constructor ( version : number , peer : Peer , send : SendMethod ) {
29
29
super ( )
@@ -47,8 +47,7 @@ export class ETH extends EventEmitter {
47
47
this . _latestBlock = c . hardforkBlock ( this . _hardfork )
48
48
this . _forkHash = c . forkHash ( this . _hardfork )
49
49
// Next fork block number or 0 if none available
50
- const nextForkBlock = c . nextHardforkBlock ( this . _hardfork )
51
- this . _nextForkBlock = nextForkBlock ? nextForkBlock : 0
50
+ this . _nextForkBlock = c . nextHardforkBlock ( this . _hardfork )
52
51
}
53
52
}
54
53
@@ -182,7 +181,7 @@ export class ETH extends EventEmitter {
182
181
verbose
183
182
) } `
184
183
if ( this . _version >= 64 ) {
185
- sStr += `, ForkHash: 0x ${ status [ 5 ] ? '0x' + ( status [ 5 ] [ 0 ] as Buffer ) . toString ( 'hex' ) : '-' } `
184
+ sStr += `, ForkHash: ${ status [ 5 ] ? '0x' + ( status [ 5 ] [ 0 ] as Buffer ) . toString ( 'hex' ) : '-' } `
186
185
sStr += `, ForkNext: ${ status [ 5 ] ? buffer2int ( status [ 5 ] [ 1 ] as Buffer ) : '-' } `
187
186
}
188
187
sStr += `]`
Original file line number Diff line number Diff line change @@ -27,7 +27,10 @@ export function id2pk(id: Buffer): Buffer {
27
27
return Buffer . concat ( [ Buffer . from ( [ 0x04 ] ) , id ] )
28
28
}
29
29
30
- export function int2buffer ( v : number ) : Buffer {
30
+ export function int2buffer ( v : number | null ) : Buffer {
31
+ if ( v === null ) {
32
+ return Buffer . alloc ( 0 )
33
+ }
31
34
let hex = v . toString ( 16 )
32
35
if ( hex . length % 2 === 1 ) hex = '0' + hex
33
36
return Buffer . from ( hex , 'hex' )
You can’t perform that action at this time.
0 commit comments