Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
844f9c77
Commit
844f9c77
authored
Mar 08, 2019
by
vipwzw
Committed by
33cn
Mar 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ticket close bug
parent
020faa00
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
ticket.go
plugin/consensus/ticket/ticket.go
+7
-0
base.go
vendor/github.com/33cn/chain33/system/consensus/base.go
+7
-0
No files found.
plugin/consensus/ticket/ticket.go
View file @
844f9c77
...
...
@@ -485,6 +485,9 @@ func (client *Client) searchTargetTicket(parent, block *types.Block) (*ty.Ticket
client
.
ticketmu
.
Lock
()
defer
client
.
ticketmu
.
Unlock
()
for
ticketID
,
ticket
:=
range
client
.
ticketsMap
{
if
client
.
IsClosed
()
{
return
nil
,
nil
,
nil
,
nil
,
""
,
nil
}
if
ticket
==
nil
{
tlog
.
Warn
(
"Client searchTargetTicket ticket is nil"
,
"ticketID"
,
ticketID
)
continue
...
...
@@ -668,6 +671,10 @@ func (client *Client) updateBlock(block *types.Block, txHashList [][]byte) (*typ
// CreateBlock ticket create block func
func
(
client
*
Client
)
CreateBlock
()
{
for
{
if
client
.
IsClosed
()
{
tlog
.
Info
(
"create block stop"
)
break
}
if
!
client
.
IsMining
()
||
!
(
client
.
IsCaughtUp
()
||
client
.
Cfg
.
ForceMining
)
{
tlog
.
Debug
(
"createblock.ismining is disable or client is caughtup is false"
)
time
.
Sleep
(
time
.
Second
)
...
...
vendor/github.com/33cn/chain33/system/consensus/base.go
View file @
844f9c77
...
...
@@ -45,6 +45,7 @@ type BaseClient struct {
client
queue
.
Client
api
client
.
QueueProtocolAPI
minerStart
int32
isclosed
int32
once
sync
.
Once
Cfg
*
types
.
Consensus
currentBlock
*
types
.
Block
...
...
@@ -146,10 +147,16 @@ func (bc *BaseClient) InitBlock() {
//Close 关闭
func
(
bc
*
BaseClient
)
Close
()
{
atomic
.
StoreInt32
(
&
bc
.
minerStart
,
0
)
atomic
.
StoreInt32
(
&
bc
.
isclosed
,
1
)
bc
.
client
.
Close
()
log
.
Info
(
"consensus base closed"
)
}
//IsClosed 是否已经关闭
func
(
bc
*
BaseClient
)
IsClosed
()
bool
{
return
atomic
.
LoadInt32
(
&
bc
.
isclosed
)
==
1
}
//CheckTxDup 为了不引起交易检查时候产生的无序
func
(
bc
*
BaseClient
)
CheckTxDup
(
txs
[]
*
types
.
Transaction
)
(
transactions
[]
*
types
.
Transaction
)
{
cacheTxs
:=
types
.
TxsToCache
(
txs
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment