Skip to content

Commit 0b8de24

Browse files
committed
Add a multi-tx test block, expose electrum fixture query_.
1 parent 7061c6f commit 0b8de24

4 files changed

Lines changed: 112 additions & 8 deletions

File tree

test/protocols/blocks.cpp

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,110 @@ bool setup_ten_block_store(query_t& query) NOEXCEPT
103103
query.push_confirmed(query.to_header(block8_hash), false) &&
104104
query.push_confirmed(query.to_header(block9_hash), false);
105105
}
106+
107+
using namespace chain;
108+
const chain::block bogus_block10
109+
{
110+
header
111+
{
112+
0x31323334,
113+
block9_hash,
114+
one_hash,
115+
0x41424344,
116+
0x51525354,
117+
0x61626364
118+
},
119+
transactions
120+
{
121+
transaction
122+
{
123+
0x01,
124+
inputs
125+
{
126+
input
127+
{
128+
point{},
129+
script{},
130+
witness{},
131+
0x02
132+
},
133+
input
134+
{
135+
point{},
136+
script{},
137+
witness{},
138+
0x03
139+
}
140+
},
141+
outputs
142+
{
143+
output
144+
{
145+
0x04,
146+
script{}
147+
}
148+
},
149+
0x05
150+
},
151+
transaction
152+
{
153+
0x06,
154+
inputs
155+
{
156+
input
157+
{
158+
point{},
159+
script{},
160+
witness{},
161+
0x07
162+
},
163+
input
164+
{
165+
point{},
166+
script{},
167+
witness{},
168+
0x08
169+
}
170+
},
171+
outputs
172+
{
173+
output
174+
{
175+
0x09,
176+
script{}
177+
}
178+
},
179+
0x0a
180+
},
181+
transaction
182+
{
183+
0x0b,
184+
inputs
185+
{
186+
input
187+
{
188+
point{},
189+
script{},
190+
witness{},
191+
0x0c
192+
},
193+
input
194+
{
195+
point{},
196+
script{},
197+
witness{},
198+
0x0d
199+
}
200+
},
201+
outputs
202+
{
203+
output
204+
{
205+
0x0e,
206+
script{}
207+
}
208+
},
209+
0x0f
210+
}
211+
}
212+
};

test/protocols/blocks.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ extern const system::chain::block block6;
8383
extern const system::chain::block block7;
8484
extern const system::chain::block block8;
8585
extern const system::chain::block block9;
86+
extern const system::chain::block bogus_block10;
8687

8788
bool setup_ten_block_store(query_t& query) NOEXCEPT;
8889

test/protocols/electrum/electrum.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,6 @@ electrum_setup_fixture::~electrum_setup_fixture()
8383
BOOST_WARN_MESSAGE(test::clear(test::directory), "electrum cleanup");
8484
}
8585

86-
const configuration& electrum_setup_fixture::config() const NOEXCEPT
87-
{
88-
return config_;
89-
}
90-
9186
boost::json::value electrum_setup_fixture::get(const std::string& request)
9287
{
9388
socket_.send(boost::asio::buffer(request));
@@ -126,6 +121,6 @@ bool electrum_setup_fixture::handshake(const std::string& version,
126121
const auto& result = response.at("result").as_array();
127122
return (result.size() == two) &&
128123
(result.at(0).is_string() && result.at(1).is_string()) &&
129-
(result.at(0).as_string() == config().server.electrum.server_name) &&
124+
(result.at(0).as_string() == config_.server.electrum.server_name) &&
130125
(result.at(1).as_string() == version);
131126
}

test/protocols/electrum/electrum.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,16 @@ struct electrum_setup_fixture
3131
electrum_setup_fixture();
3232
~electrum_setup_fixture();
3333

34-
const configuration& config() const NOEXCEPT;
3534
boost::json::value get(const std::string& request);
3635
bool handshake(const std::string& version="1.4",
3736
const std::string& name="test", network::rpc::code_t id=0);
3837

39-
private:
38+
protected:
4039
configuration config_;
4140
store_t store_;
4241
query_t query_;
42+
43+
private:
4344
network::logger log_;
4445
server::server_node server_;
4546
boost::asio::io_context io{};

0 commit comments

Comments
 (0)