FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
beam/node/functionaltests/send_wrong_newtip_test.cpp at master · pilot-SyS/beam · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
pilot-SyS
/
beam
Public
forked from
BeamMW/beam
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
beam
/
node
/
functionaltests
/
send_wrong_newtip_test.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
96 lines (79 loc) · 2.19 KB
Breadcrumbs
beam
/
node
/
functionaltests
/
send_wrong_newtip_test.cpp
Copy path
File metadata and controls
96 lines (79 loc) · 2.19 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//
Copyright 2018 The Beam Team
//
//
Licensed under the Apache License, Version 2.0 (the "License");
//
you may not use this file except in compliance with the License.
//
You may obtain a copy of the License at
//
//
http://www.apache.org/licenses/LICENSE-2.0
//
//
Unless required by applicable law or agreed to in writing, software
//
distributed under the License is distributed on an "AS IS" BASIS,
//
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
See the License for the specific language governing permissions and
//
limitations under the License.
#
include
"
node/node.h
"
#
include
"
utility/logger.h
"
#
include
"
tools/base_node_connection.h
"
using
namespace
beam
;
class
TestNodeConnection
:
public
BaseTestNode
{
public:
TestNodeConnection
(
int
argc,
char
* argv[]);
private:
bool
OnMsg2
(proto::Boolean&& msg)
override
;
bool
OnMsg2
(proto::NewTip&& msg)
override
;
private:
Height m_Height;
};
TestNodeConnection::TestNodeConnection
(
int
argc,
char
* argv[])
: BaseTestNode(argc, argv)
, m_Height(
0
)
{
m_Timeout =
60
*
1000
;
}
bool
TestNodeConnection::OnMsg2
(proto::Boolean&& msg)
{
LOG_INFO
() <<
"
Node returned:
"
<< msg.
m_Value
;
return
true
;
}
bool
TestNodeConnection::OnMsg2
(proto::NewTip&& msg)
{
Block::SystemState::
ID
id;
msg.
m_Description
.
get_ID
(id);
LOG_INFO
() <<
"
NewTip:
"
<< id;
if
(m_Height ==
0
)
{
LOG_INFO
() <<
"
Send NewTip with height =
"
<< msg.
m_Description
.
m_Height
+
5
;
proto::NewTip newMsg;
newMsg.
m_Description
= msg.
m_Description
;
newMsg.
m_Description
.
m_Height
+=
5
;
m_Height = newMsg.
m_Description
.
m_Height
;
Send
(newMsg);
m_Timer->
start
(
3
*
60
*
1000
,
false
, [
this
]()
{
m_Failed =
true
;
io::Reactor::get_Current
().
stop
();
});
}
else
{
if
(msg.
m_Description
.
m_Height
== m_Height)
{
LOG_INFO
() <<
"
Ok
"
;
}
else
{
LOG_INFO
() <<
"
Failed
"
;
}
io::Reactor::get_Current
().
stop
();
}
return
true
;
}
int
main
(
int
argc,
char
* argv[])
{
int
logLevel =
LOG_LEVEL_DEBUG
;
auto
logger =
Logger::create
(logLevel, logLevel);
TestNodeConnection
connection
(argc, argv);
connection.
Run
();
return
connection.
CheckOnFailed
();
}
Back
|
FazBrowse Home
|
New Git URL