File tree 4 files changed +37
-210
lines changed
test/message-generator/test/bad-pool-config-test
4 files changed +37
-210
lines changed Original file line number Diff line number Diff line change 11
11
- main
12
12
13
13
jobs :
14
- bad-pool-config-test :
15
- runs-on : ubuntu-latest
16
- steps :
17
- - name : Checkout repository
18
- uses : actions/checkout@v4
19
- - name : Install cargo-llvm-cov
20
- run : cargo install cargo-llvm-cov
21
- - name : Run bad-pool-config-test
22
- run : sh ./test/message-generator/test/bad-pool-config-test/bad-pool-config-test.sh
23
-
24
14
interop-jd-translator :
25
15
runs-on : ubuntu-latest
26
16
steps :
@@ -167,7 +157,6 @@ jobs:
167
157
runs-on : ubuntu-latest
168
158
if : always()
169
159
needs : [
170
- bad-pool-config-test,
171
160
interop-jd-translator,
172
161
interop-proxy-with-multi-ups,
173
162
interop-proxy-with-multi-ups-extended,
@@ -188,8 +177,7 @@ jobs:
188
177
steps :
189
178
- name : Aggregate Results
190
179
run : |
191
- if [ "${{ needs.bad-pool-config-test.result }}" != "success" ] ||
192
- [ "${{ needs.interop-jd-translator.result }}" != "success" ] ||
180
+ if [ "${{ needs.interop-jd-translator.result }}" != "success" ] ||
193
181
[ "${{ needs.interop-proxy-with-multi-ups.result }}" != "success" ] ||
194
182
[ "${{ needs.interop-proxy-with-multi-ups-extended.result }}" != "success" ] ||
195
183
[ "${{ needs.jds-do-not-fail-on-wrong-tsdatasucc.result }}" != "success" ] ||
@@ -209,4 +197,4 @@ jobs:
209
197
exit 1
210
198
else
211
199
echo "All MG tests completed successfully"
212
- fi
200
+ fi
Original file line number Diff line number Diff line change @@ -101,3 +101,38 @@ impl PoolSv2 {
101
101
}
102
102
}
103
103
}
104
+
105
+ #[ cfg( test) ]
106
+ mod tests {
107
+ use super :: * ;
108
+ use ext_config:: { Config , File , FileFormat } ;
109
+
110
+ #[ tokio:: test]
111
+ async fn pool_bad_coinbase_output ( ) {
112
+ let invalid_coinbase_output = vec ! [ mining_pool:: CoinbaseOutput :: new(
113
+ "P2PK" . to_string( ) ,
114
+ "wrong" . to_string( ) ,
115
+ ) ] ;
116
+ let config_path = "config-examples/pool-config-hosted-tp-example.toml" ;
117
+ let mut config: Configuration = match Config :: builder ( )
118
+ . add_source ( File :: new ( config_path, FileFormat :: Toml ) )
119
+ . build ( )
120
+ {
121
+ Ok ( settings) => match settings. try_deserialize :: < Configuration > ( ) {
122
+ Ok ( c) => c,
123
+ Err ( e) => {
124
+ error ! ( "Failed to deserialize config: {}" , e) ;
125
+ return ;
126
+ }
127
+ } ,
128
+ Err ( e) => {
129
+ error ! ( "Failed to build config: {}" , e) ;
130
+ return ;
131
+ }
132
+ } ;
133
+ config. coinbase_outputs = invalid_coinbase_output;
134
+ let pool = PoolSv2 :: new ( config) ;
135
+ let result = pool. start ( ) . await ;
136
+ assert ! ( result. is_err( ) ) ;
137
+ }
138
+ }
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments