Commit 38386fe
committed
feat: Automatically negotiate protocol version on connect
Send `server.version` as the first message after establishing a
connection, as required by Electrum protocol v1.6. The negotiated
protocol version is stored in `RawClient` and can be retrieved via
the new `protocol_version()` method.
- Add `CLIENT_NAME`, `PROTOCOL_VERSION_MIN`, `PROTOCOL_VERSION_MAX` constants
- Add `protocol_version` field to `RawClient` to store negotiated version
- All constructors (`new`, `new_ssl`, `new_ssl_from_stream`, `new_proxy`)
now automatically call `server.version` after connecting
- The `server_version()` method also updates the stored version when called
This is a breaking change as the constructors now return errors if
protocol negotiation fails.
Co-Authored-By: Claude Code AI
Signed-off-by: Elias Rohrer <dev@tnull.de>1 parent 22ad6bc commit 38386fe
2 files changed
Lines changed: 87 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
48 | 57 | | |
49 | 58 | | |
50 | 59 | | |
| |||
142 | 151 | | |
143 | 152 | | |
144 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
145 | 157 | | |
146 | 158 | | |
147 | 159 | | |
| |||
163 | 175 | | |
164 | 176 | | |
165 | 177 | | |
| 178 | + | |
| 179 | + | |
166 | 180 | | |
167 | 181 | | |
168 | 182 | | |
| |||
173 | 187 | | |
174 | 188 | | |
175 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
176 | 193 | | |
177 | 194 | | |
178 | 195 | | |
| |||
187 | 204 | | |
188 | 205 | | |
189 | 206 | | |
190 | | - | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
191 | 210 | | |
192 | 211 | | |
193 | 212 | | |
| |||
285 | 304 | | |
286 | 305 | | |
287 | 306 | | |
288 | | - | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
289 | 310 | | |
290 | 311 | | |
291 | 312 | | |
| |||
466 | 487 | | |
467 | 488 | | |
468 | 489 | | |
469 | | - | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
470 | 493 | | |
471 | 494 | | |
472 | 495 | | |
| |||
496 | 519 | | |
497 | 520 | | |
498 | 521 | | |
499 | | - | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
500 | 525 | | |
501 | 526 | | |
502 | 527 | | |
| |||
551 | 576 | | |
552 | 577 | | |
553 | 578 | | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
554 | 603 | | |
555 | 604 | | |
556 | 605 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| |||
202 | 204 | | |
203 | 205 | | |
204 | 206 | | |
205 | | - | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
206 | 239 | | |
207 | 240 | | |
208 | 241 | | |
| |||
0 commit comments