fix(protocol-thp): add error to getExpectedHeaders

This commit is contained in:
Tomas Martykan
2025-09-24 18:08:02 +02:00
committed by Tomáš Martykán
parent 7dfeebf26a
commit 37a4375b33

View File

@@ -95,7 +95,10 @@ export const getExpectedResponses = (bytes: Buffer) => {
// get expected responses from ThpState (stored as numbers)
// and join them with the channel to receive 3 bytes header
export const getExpectedHeaders = (state: ThpState): Buffer[] =>
state.expectedResponses.map(resp => {
[
...state.expectedResponses,
THP_ERROR_HEADER_BYTE, // error could be sent any time
].map(resp => {
let magic;
switch (resp) {
case THP_CONTINUATION_PACKET: