Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
burrow
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hang Yu
burrow
Commits
5149db8e
Commit
5149db8e
authored
8 years ago
by
Silas Davis
Browse files
Options
Downloads
Patches
Plain Diff
update code to work against newer tendermint protobuf etc
parent
e4f8c940
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
consensus/tendermint/local_client.go
+22
-22
22 additions, 22 deletions
consensus/tendermint/local_client.go
consensus/tendermint/tendermint.go
+103
-104
103 additions, 104 deletions
consensus/tendermint/tendermint.go
consensus/tmsp/server.go
+36
-35
36 additions, 35 deletions
consensus/tmsp/server.go
with
161 additions
and
161 deletions
consensus/tendermint/local_client.go
+
22
−
22
View file @
5149db8e
...
...
@@ -26,7 +26,7 @@ import (
"sync"
tmsp_client
"github.com/tendermint/tmsp/client"
tmsp_types
"github.com/tendermint/tmsp/types"
tmsp_types
"github.com/tendermint/tmsp/types"
manager_types
"github.com/eris-ltd/eris-db/manager/types"
)
...
...
@@ -68,13 +68,13 @@ func (app *localClient) Stop() bool {
func
(
app
*
localClient
)
FlushAsync
()
*
tmsp_client
.
ReqRes
{
// Do nothing
return
newLocalReqRes
(
tmsp_types
.
RequestFlush
(),
nil
)
return
newLocalReqRes
(
tmsp_types
.
To
RequestFlush
(),
nil
)
}
func
(
app
*
localClient
)
EchoAsync
(
msg
string
)
*
tmsp_client
.
ReqRes
{
return
app
.
callback
(
tmsp_types
.
RequestEcho
(
msg
),
tmsp_types
.
ResponseEcho
(
msg
),
tmsp_types
.
To
RequestEcho
(
msg
),
tmsp_types
.
To
ResponseEcho
(
msg
),
)
}
...
...
@@ -83,8 +83,8 @@ func (app *localClient) InfoAsync() *tmsp_client.ReqRes {
info
:=
app
.
Application
.
Info
()
app
.
mtx
.
Unlock
()
return
app
.
callback
(
tmsp_types
.
RequestInfo
(),
tmsp_types
.
ResponseInfo
(
info
),
tmsp_types
.
To
RequestInfo
(),
tmsp_types
.
To
ResponseInfo
(
info
),
)
}
...
...
@@ -93,8 +93,8 @@ func (app *localClient) SetOptionAsync(key string, value string) *tmsp_client.Re
log
:=
app
.
Application
.
SetOption
(
key
,
value
)
app
.
mtx
.
Unlock
()
return
app
.
callback
(
tmsp_types
.
RequestSetOption
(
key
,
value
),
tmsp_types
.
ResponseSetOption
(
log
),
tmsp_types
.
To
RequestSetOption
(
key
,
value
),
tmsp_types
.
To
ResponseSetOption
(
log
),
)
}
...
...
@@ -103,8 +103,8 @@ func (app *localClient) AppendTxAsync(tx []byte) *tmsp_client.ReqRes {
res
:=
app
.
Application
.
AppendTx
(
tx
)
app
.
mtx
.
Unlock
()
return
app
.
callback
(
tmsp_types
.
RequestAppendTx
(
tx
),
tmsp_types
.
ResponseAppendTx
(
res
.
Code
,
res
.
Data
,
res
.
Log
),
tmsp_types
.
To
RequestAppendTx
(
tx
),
tmsp_types
.
To
ResponseAppendTx
(
res
.
Code
,
res
.
Data
,
res
.
Log
),
)
}
...
...
@@ -113,8 +113,8 @@ func (app *localClient) CheckTxAsync(tx []byte) *tmsp_client.ReqRes {
res
:=
app
.
Application
.
CheckTx
(
tx
)
app
.
mtx
.
Unlock
()
return
app
.
callback
(
tmsp_types
.
RequestCheckTx
(
tx
),
tmsp_types
.
ResponseCheckTx
(
res
.
Code
,
res
.
Data
,
res
.
Log
),
tmsp_types
.
To
RequestCheckTx
(
tx
),
tmsp_types
.
To
ResponseCheckTx
(
res
.
Code
,
res
.
Data
,
res
.
Log
),
)
}
...
...
@@ -123,8 +123,8 @@ func (app *localClient) QueryAsync(tx []byte) *tmsp_client.ReqRes {
res
:=
app
.
Application
.
Query
(
tx
)
app
.
mtx
.
Unlock
()
return
app
.
callback
(
tmsp_types
.
RequestQuery
(
tx
),
tmsp_types
.
ResponseQuery
(
res
.
Code
,
res
.
Data
,
res
.
Log
),
tmsp_types
.
To
RequestQuery
(
tx
),
tmsp_types
.
To
ResponseQuery
(
res
.
Code
,
res
.
Data
,
res
.
Log
),
)
}
...
...
@@ -133,8 +133,8 @@ func (app *localClient) CommitAsync() *tmsp_client.ReqRes {
res
:=
app
.
Application
.
Commit
()
app
.
mtx
.
Unlock
()
return
app
.
callback
(
tmsp_types
.
RequestCommit
(),
tmsp_types
.
ResponseCommit
(
res
.
Code
,
res
.
Data
,
res
.
Log
),
tmsp_types
.
To
RequestCommit
(),
tmsp_types
.
To
ResponseCommit
(
res
.
Code
,
res
.
Data
,
res
.
Log
),
)
}
...
...
@@ -144,8 +144,8 @@ func (app *localClient) InitChainAsync(validators []*tmsp_types.Validator) *tmsp
bcApp
.
InitChain
(
validators
)
}
reqRes
:=
app
.
callback
(
tmsp_types
.
RequestInitChain
(
validators
),
tmsp_types
.
ResponseInitChain
(),
tmsp_types
.
To
RequestInitChain
(
validators
),
tmsp_types
.
To
ResponseInitChain
(),
)
app
.
mtx
.
Unlock
()
return
reqRes
...
...
@@ -158,8 +158,8 @@ func (app *localClient) BeginBlockAsync(height uint64) *tmsp_client.ReqRes {
}
app
.
mtx
.
Unlock
()
return
app
.
callback
(
tmsp_types
.
RequestBeginBlock
(
height
),
tmsp_types
.
ResponseBeginBlock
(),
tmsp_types
.
To
RequestBeginBlock
(
height
),
tmsp_types
.
To
ResponseBeginBlock
(),
)
}
...
...
@@ -171,8 +171,8 @@ func (app *localClient) EndBlockAsync(height uint64) *tmsp_client.ReqRes {
}
app
.
mtx
.
Unlock
()
return
app
.
callback
(
tmsp_types
.
RequestEndBlock
(
height
),
tmsp_types
.
ResponseEndBlock
(
validators
),
tmsp_types
.
To
RequestEndBlock
(
height
),
tmsp_types
.
To
ResponseEndBlock
(
validators
),
)
}
...
...
This diff is collapsed.
Click to expand it.
consensus/tendermint/tendermint.go
+
103
−
104
View file @
5149db8e
...
...
@@ -20,27 +20,27 @@
package
tendermint
import
(
"fmt"
"path"
"strings"
"sync"
node
"github.com/tendermint/
tendermint/node
"
proxy
"github.com/tendermint/tendermint/
proxy
"
p2p
"github.com/tendermint/
go-p2p
"
tendermint_types
"github.com/tendermint/tendermint/types"
log
"github.com/eris-ltd/eris-logger"
config
"github.com/eris-ltd/eris-db/config"
definitions
"github.com/eris-ltd/eris-db/definitions"
manager_types
"github.com/eris-ltd/eris-db/manager/types"
// files "github.com/eris-ltd/eris-db/files"
"fmt"
"path"
"strings"
"sync"
p2p
"github.com/tendermint/
go-p2p
"
node
"github.com/tendermint/tendermint/
node
"
proxy
"github.com/tendermint/
tendermint/proxy
"
tendermint_types
"github.com/tendermint/tendermint/types"
log
"github.com/eris-ltd/eris-logger"
config
"github.com/eris-ltd/eris-db/config"
definitions
"github.com/eris-ltd/eris-db/definitions"
manager_types
"github.com/eris-ltd/eris-db/manager/types"
// files "github.com/eris-ltd/eris-db/files"
)
type
TendermintNode
struct
{
tmintNode
*
node
.
Node
tmintConfig
*
TendermintConfig
tmintNode
*
node
.
Node
tmintConfig
*
TendermintConfig
}
// NOTE [ben] Compiler check to ensure TendermintNode successfully implements
...
...
@@ -48,94 +48,93 @@ type TendermintNode struct {
var
_
definitions
.
ConsensusEngine
=
(
*
TendermintNode
)(
nil
)
func
NewTendermintNode
(
moduleConfig
*
config
.
ModuleConfig
,
application
manager_types
.
Application
)
(
*
TendermintNode
,
error
)
{
// re-assert proper configuration for module
if
moduleConfig
.
Version
!=
GetTendermintVersion
()
.
GetMinorVersionString
()
{
return
nil
,
fmt
.
Errorf
(
"Version string %s did not match %s"
,
moduleConfig
.
Version
,
GetTendermintVersion
()
.
GetMinorVersionString
())
}
// loading the module has ensured the working and data directory
// for tendermint have been created, but the config files needs
// to be written in tendermint's root directory.
// NOTE: [ben] as elsewhere Sub panics if config file does not have this
// subtree. To shield in go-routine, or PR to viper.
tendermintConfigViper
:=
moduleConfig
.
Config
.
Sub
(
"configuration"
)
if
tendermintConfigViper
==
nil
{
return
nil
,
fmt
.
Errorf
(
"Failed to extract Tendermint configuration subtree."
)
}
// wrap a copy of the viper config in a tendermint/go-config interface
tmintConfig
:=
GetTendermintConfig
(
tendermintConfigViper
)
// complete the tendermint configuration with default flags
tmintConfig
.
AssertTendermintDefaults
(
moduleConfig
.
ChainId
,
moduleConfig
.
WorkDir
,
moduleConfig
.
DataDir
,
moduleConfig
.
RootDir
)
privateValidatorFilePath
:=
path
.
Join
(
moduleConfig
.
RootDir
,
moduleConfig
.
Config
.
GetString
(
"private_validator_file"
))
if
moduleConfig
.
Config
.
GetString
(
"private_validator_file"
)
==
""
{
return
nil
,
fmt
.
Errorf
(
"No private validator file provided."
)
}
// override tendermint configurations to force consistency with overruling
// settings
tmintConfig
.
AssertTendermintConsistency
(
moduleConfig
,
privateValidatorFilePath
)
log
.
WithFields
(
log
.
Fields
{
"chainId"
:
tmintConfig
.
GetString
(
"chain_id"
),
"genesisFile"
:
tmintConfig
.
GetString
(
"genesis_file"
),
"nodeLocalAddress"
:
tmintConfig
.
GetString
(
"node_laddr"
),
"moniker"
:
tmintConfig
.
GetString
(
"moniker"
),
"seeds"
:
tmintConfig
.
GetString
(
"seeds"
),
"fastSync"
:
tmintConfig
.
GetBool
(
"fast_sync"
),
"rpcLocalAddress"
:
tmintConfig
.
GetString
(
"rpc_laddr"
),
"databaseDirectory"
:
tmintConfig
.
GetString
(
"db_dir"
),
"privateValidatorFile"
:
tmintConfig
.
GetString
(
"priv_validator_file"
),
"privValFile"
:
moduleConfig
.
Config
.
GetString
(
"private_validator_file"
),
})
.
Debug
(
"Loaded Tendermint sub-configuration"
)
// TODO: [ben] do not "or Generate Validator keys", rather fail directly
// TODO: [ben] implement the signer for Private validator over eris-keys
// TODO: [ben] copy from rootDir to tendermint workingDir;
privateValidator
:=
tendermint_types
.
LoadOrGenPrivValidator
(
path
.
Join
(
moduleConfig
.
RootDir
,
moduleConfig
.
Config
.
GetString
(
"private_validator_file"
)))
newNode
:=
node
.
NewNode
(
tmintConfig
,
privateValidator
,
func
(
addr
string
,
hash
[]
byte
)
proxy
.
AppConn
{
return
NewLocalClient
(
new
(
sync
.
Mutex
),
application
)
})
listener
:=
p2p
.
NewDefaultListener
(
"tcp"
,
tmintConfig
.
GetString
(
"node_laddr"
),
tmintConfig
.
GetBool
(
"skip_upnp"
))
newNode
.
AddListener
(
listener
)
// TODO: [ben] delay starting the node to a different function, to hand
// control over events to Core
if
err
:=
newNode
.
Start
();
err
!=
nil
{
newNode
.
Stop
()
return
nil
,
fmt
.
Errorf
(
"Failed to start Tendermint consensus node: %v"
,
err
)
}
log
.
WithFields
(
log
.
Fields
{
"nodeAddress"
:
tmintConfig
.
GetString
(
"node_laddr"
),
"transportProtocol"
:
"tcp"
,
"upnp"
:
!
tmintConfig
.
GetBool
(
"skip_upnp"
),
"moniker"
:
tmintConfig
.
GetString
(
"moniker"
),
})
.
Info
(
"Tendermint consensus node started"
)
// If seedNode is provided by config, dial out.
if
tmintConfig
.
GetString
(
"seeds"
)
!=
""
{
seeds
:=
strings
.
Split
(
tmintConfig
.
GetString
(
"seeds"
),
","
)
newNode
.
DialSeeds
(
seeds
)
log
.
WithFields
(
log
.
Fields
{
"seeds"
:
seeds
,
})
.
Debug
(
"Tendermint node called seeds"
)
}
return
&
TendermintNode
{
tmintNode
:
newNode
,
tmintConfig
:
tmintConfig
,
},
nil
application
manager_types
.
Application
)
(
*
TendermintNode
,
error
)
{
// re-assert proper configuration for module
if
moduleConfig
.
Version
!=
GetTendermintVersion
()
.
GetMinorVersionString
()
{
return
nil
,
fmt
.
Errorf
(
"Version string %s did not match %s"
,
moduleConfig
.
Version
,
GetTendermintVersion
()
.
GetMinorVersionString
())
}
// loading the module has ensured the working and data directory
// for tendermint have been created, but the config files needs
// to be written in tendermint's root directory.
// NOTE: [ben] as elsewhere Sub panics if config file does not have this
// subtree. To shield in go-routine, or PR to viper.
tendermintConfigViper
:=
moduleConfig
.
Config
.
Sub
(
"configuration"
)
if
tendermintConfigViper
==
nil
{
return
nil
,
fmt
.
Errorf
(
"Failed to extract Tendermint configuration subtree."
)
}
// wrap a copy of the viper config in a tendermint/go-config interface
tmintConfig
:=
GetTendermintConfig
(
tendermintConfigViper
)
// complete the tendermint configuration with default flags
tmintConfig
.
AssertTendermintDefaults
(
moduleConfig
.
ChainId
,
moduleConfig
.
WorkDir
,
moduleConfig
.
DataDir
,
moduleConfig
.
RootDir
)
privateValidatorFilePath
:=
path
.
Join
(
moduleConfig
.
RootDir
,
moduleConfig
.
Config
.
GetString
(
"private_validator_file"
))
if
moduleConfig
.
Config
.
GetString
(
"private_validator_file"
)
==
""
{
return
nil
,
fmt
.
Errorf
(
"No private validator file provided."
)
}
// override tendermint configurations to force consistency with overruling
// settings
tmintConfig
.
AssertTendermintConsistency
(
moduleConfig
,
privateValidatorFilePath
)
log
.
WithFields
(
log
.
Fields
{
"chainId"
:
tmintConfig
.
GetString
(
"chain_id"
),
"genesisFile"
:
tmintConfig
.
GetString
(
"genesis_file"
),
"nodeLocalAddress"
:
tmintConfig
.
GetString
(
"node_laddr"
),
"moniker"
:
tmintConfig
.
GetString
(
"moniker"
),
"seeds"
:
tmintConfig
.
GetString
(
"seeds"
),
"fastSync"
:
tmintConfig
.
GetBool
(
"fast_sync"
),
"rpcLocalAddress"
:
tmintConfig
.
GetString
(
"rpc_laddr"
),
"databaseDirectory"
:
tmintConfig
.
GetString
(
"db_dir"
),
"privateValidatorFile"
:
tmintConfig
.
GetString
(
"priv_validator_file"
),
"privValFile"
:
moduleConfig
.
Config
.
GetString
(
"private_validator_file"
),
})
.
Debug
(
"Loaded Tendermint sub-configuration"
)
// TODO: [ben] do not "or Generate Validator keys", rather fail directly
// TODO: [ben] implement the signer for Private validator over eris-keys
// TODO: [ben] copy from rootDir to tendermint workingDir;
privateValidator
:=
tendermint_types
.
LoadOrGenPrivValidator
(
path
.
Join
(
moduleConfig
.
RootDir
,
moduleConfig
.
Config
.
GetString
(
"private_validator_file"
)))
newNode
:=
node
.
NewNode
(
tmintConfig
,
privateValidator
,
func
(
_
,
_
string
,
hash
[]
byte
)
proxy
.
AppConn
{
return
NewLocalClient
(
new
(
sync
.
Mutex
),
application
)
})
listener
:=
p2p
.
NewDefaultListener
(
"tcp"
,
tmintConfig
.
GetString
(
"node_laddr"
),
tmintConfig
.
GetBool
(
"skip_upnp"
))
newNode
.
AddListener
(
listener
)
// TODO: [ben] delay starting the node to a different function, to hand
// control over events to Core
if
err
:=
newNode
.
Start
();
err
!=
nil
{
newNode
.
Stop
()
return
nil
,
fmt
.
Errorf
(
"Failed to start Tendermint consensus node: %v"
,
err
)
}
log
.
WithFields
(
log
.
Fields
{
"nodeAddress"
:
tmintConfig
.
GetString
(
"node_laddr"
),
"transportProtocol"
:
"tcp"
,
"upnp"
:
!
tmintConfig
.
GetBool
(
"skip_upnp"
),
"moniker"
:
tmintConfig
.
GetString
(
"moniker"
),
})
.
Info
(
"Tendermint consensus node started"
)
// If seedNode is provided by config, dial out.
if
tmintConfig
.
GetString
(
"seeds"
)
!=
""
{
seeds
:=
strings
.
Split
(
tmintConfig
.
GetString
(
"seeds"
),
","
)
newNode
.
DialSeeds
(
seeds
)
log
.
WithFields
(
log
.
Fields
{
"seeds"
:
seeds
,
})
.
Debug
(
"Tendermint node called seeds"
)
}
return
&
TendermintNode
{
tmintNode
:
newNode
,
tmintConfig
:
tmintConfig
,
},
nil
}
//------------------------------------------------------------------------------
// Helper functions
...
...
This diff is collapsed.
Click to expand it.
consensus/tmsp/server.go
+
36
−
35
View file @
5149db8e
...
...
@@ -93,7 +93,7 @@ func (s *Server) acceptConnectionsRoutine() {
fmt
.
Println
(
"Accepted a new connection"
)
}
closeConn
:=
make
(
chan
error
,
2
)
// Push to signal connection closed
closeConn
:=
make
(
chan
error
,
2
)
// Push to signal connection closed
responses
:=
make
(
chan
*
tmsp_types
.
Response
,
1000
)
// A channel to buffer responses
// Read requests from conn and deal with them
...
...
@@ -145,45 +145,46 @@ func (s *Server) handleRequests(closeConn chan error, conn net.Conn, responses c
}
func
(
s
*
Server
)
handleRequest
(
req
*
tmsp_types
.
Request
,
responses
chan
<-
*
tmsp_types
.
Response
)
{
switch
r
eq
.
T
ype
{
case
tmsp_types
.
MessageType
_Echo
:
responses
<-
tmsp_types
.
ResponseEcho
(
string
(
req
.
Data
)
)
case
tmsp_types
.
MessageType
_Flush
:
responses
<-
tmsp_types
.
ResponseFlush
()
case
tmsp_types
.
MessageType
_Info
:
switch
r
:=
req
.
Value
.
(
t
ype
)
{
case
*
tmsp_types
.
Request
_Echo
:
responses
<-
tmsp_types
.
To
ResponseEcho
(
r
.
Echo
.
Message
)
case
*
tmsp_types
.
Request
_Flush
:
responses
<-
tmsp_types
.
To
ResponseFlush
()
case
*
tmsp_types
.
Request
_Info
:
data
:=
s
.
app
.
Info
()
responses
<-
tmsp_types
.
ResponseInfo
(
data
)
case
tmsp_types
.
MessageType_SetOption
:
logStr
:=
s
.
app
.
SetOption
(
req
.
Key
,
req
.
Value
)
responses
<-
tmsp_types
.
ResponseSetOption
(
logStr
)
case
tmsp_types
.
MessageType_AppendTx
:
res
:=
s
.
app
.
AppendTx
(
req
.
Data
)
responses
<-
tmsp_types
.
ResponseAppendTx
(
res
.
Code
,
res
.
Data
,
res
.
Log
)
case
tmsp_types
.
MessageType_CheckTx
:
res
:=
s
.
app
.
CheckTx
(
req
.
Data
)
responses
<-
tmsp_types
.
ResponseCheckTx
(
res
.
Code
,
res
.
Data
,
res
.
Log
)
case
tmsp_types
.
MessageType_Commit
:
responses
<-
tmsp_types
.
ToResponseInfo
(
data
)
case
*
tmsp_types
.
Request_SetOption
:
so
:=
r
.
SetOption
logStr
:=
s
.
app
.
SetOption
(
so
.
Key
,
so
.
Value
)
responses
<-
tmsp_types
.
ToResponseSetOption
(
logStr
)
case
*
tmsp_types
.
Request_AppendTx
:
res
:=
s
.
app
.
AppendTx
(
r
.
AppendTx
.
Tx
)
responses
<-
tmsp_types
.
ToResponseAppendTx
(
res
.
Code
,
res
.
Data
,
res
.
Log
)
case
*
tmsp_types
.
Request_CheckTx
:
res
:=
s
.
app
.
CheckTx
(
r
.
CheckTx
.
Tx
)
responses
<-
tmsp_types
.
ToResponseCheckTx
(
res
.
Code
,
res
.
Data
,
res
.
Log
)
case
*
tmsp_types
.
Request_Commit
:
res
:=
s
.
app
.
Commit
()
responses
<-
tmsp_types
.
ResponseCommit
(
res
.
Code
,
res
.
Data
,
res
.
Log
)
case
tmsp_types
.
MessageType
_Query
:
res
:=
s
.
app
.
Query
(
r
eq
.
Data
)
responses
<-
tmsp_types
.
ResponseQuery
(
res
.
Code
,
res
.
Data
,
res
.
Log
)
case
tmsp_types
.
MessageType
_InitChain
:
if
app
,
ok
:=
s
.
app
.
(
manager
_types
.
BlockchainAware
);
ok
{
app
.
InitChain
(
r
eq
.
Validators
)
responses
<-
tmsp_types
.
ResponseInitChain
()
responses
<-
tmsp_types
.
To
ResponseCommit
(
res
.
Code
,
res
.
Data
,
res
.
Log
)
case
*
tmsp_types
.
Request
_Query
:
res
:=
s
.
app
.
Query
(
r
.
Query
.
Query
)
responses
<-
tmsp_types
.
To
ResponseQuery
(
res
.
Code
,
res
.
Data
,
res
.
Log
)
case
*
tmsp_types
.
Request
_InitChain
:
if
app
,
ok
:=
s
.
app
.
(
tmsp
_types
.
BlockchainAware
);
ok
{
app
.
InitChain
(
r
.
InitChain
.
Validators
)
responses
<-
tmsp_types
.
To
ResponseInitChain
()
}
else
{
responses
<-
tmsp_types
.
ResponseInitChain
()
responses
<-
tmsp_types
.
To
ResponseInitChain
()
}
case
tmsp_types
.
MessageType
_EndBlock
:
if
app
,
ok
:=
s
.
app
.
(
manager
_types
.
BlockchainAware
);
ok
{
validators
:=
app
.
EndBlock
(
r
eq
.
Height
)
responses
<-
tmsp_types
.
ResponseEndBlock
(
validators
)
case
*
tmsp_types
.
Request
_EndBlock
:
if
app
,
ok
:=
s
.
app
.
(
tmsp
_types
.
BlockchainAware
);
ok
{
validators
:=
app
.
EndBlock
(
r
.
EndBlock
.
Height
)
responses
<-
tmsp_types
.
To
ResponseEndBlock
(
validators
)
}
else
{
responses
<-
tmsp_types
.
ResponseEndBlock
(
nil
)
responses
<-
tmsp_types
.
To
ResponseEndBlock
(
nil
)
}
default
:
responses
<-
tmsp_types
.
ResponseException
(
"Unknown request"
)
responses
<-
tmsp_types
.
To
ResponseException
(
"Unknown request"
)
}
}
...
...
@@ -198,10 +199,10 @@ func (s *Server) handleResponses(closeConn chan error, responses <-chan *tmsp_ty
closeConn
<-
fmt
.
Errorf
(
"Error in handleResponses: %v"
,
err
.
Error
())
return
}
if
res
.
Type
==
tmsp_types
.
M
es
sageTyp
e_Flush
{
if
_
,
ok
:=
res
.
Value
.
(
*
tmsp_types
.
R
es
pons
e_Flush
);
ok
{
err
=
bufWriter
.
Flush
()
if
err
!=
nil
{
closeConn
<-
fmt
.
Errorf
(
"Error in handle
Responses
: %v"
,
err
.
Error
())
closeConn
<-
fmt
.
Errorf
(
"Error in handle
Value
: %v"
,
err
.
Error
())
return
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment