@@ -34,24 +34,30 @@ type BlockListener struct {
34
34
dynamicArbiterHeight uint64
35
35
}
36
36
37
- func (l * BlockListener ) NotifyBlock (block * util.Block ) {
38
- if block .Height <= l .blockNumber {
39
- log .Warn ("BlockListener handle block " , "height" , l .blockNumber )
40
- return
41
- }
42
- l .blockNumber = block .Height
43
- l .StoreAuxBlock (block )
44
- log .Info ("BlockListener handle block " , "height" , l .blockNumber , "l.dynamicArbiterHeight " , l .dynamicArbiterHeight )
37
+ func (l * BlockListener ) NotifyBlock (block * util.Block , isCurrent bool ) {
38
+ if isCurrent {
39
+ if block .Height <= l .blockNumber {
40
+ log .Warn ("BlockListener handle block " , "height" , l .blockNumber )
41
+ return
42
+ }
43
+ l .blockNumber = block .Height
44
+ l .StoreAuxBlock (block )
45
+ log .Info ("BlockListener handle block " , "height" , l .blockNumber , "l.dynamicArbiterHeight " , l .dynamicArbiterHeight )
45
46
46
- if uint64 (l .blockNumber ) < l .dynamicArbiterHeight {
47
- return
47
+ if uint64 (l .blockNumber ) < l .dynamicArbiterHeight {
48
+ return
49
+ }
50
+
51
+ l .onBlockHandled (l .param .block )
48
52
}
49
53
50
- l .onBlockHandled (l .param .block )
51
54
if l .handle != nil {
52
55
l .handle (l .param .block )
53
56
}
54
- events .Notify (dpos .ETOnSPVHeight , l .blockNumber )
57
+
58
+ if isCurrent {
59
+ events .Notify (dpos .ETOnSPVHeight , l .blockNumber )
60
+ }
55
61
}
56
62
57
63
func (l * BlockListener ) BlockHeight () uint32 {
0 commit comments