fix: WELCOME wire format — flags+update_sig parsing, peer_needed gap, invalid join_sig skip
This commit is contained in:
1 parent
39a376e255
commit
586d46f1e6
2 files changed
+37
-25
No files matched your search
@@ -431,7 +431,8 @@ int topo_node_sqlite_channel_peers_all(sqlite3* db, const char* channel_id,
|
||||
}
|
||||
sqlite3_finalize(ast);
|
||||
|
||||
size_t peer_needed = 8 + 32 + 32 + 1 + 64 + 8 + 64 + 8 + 1 + (size_t)nl + 1;
|
||||
uint8_t flags = (join_sig && join_ts) ? PEERS_FLAG_HAS_JOIN : 0;
|
||||
size_t peer_needed = 8 + 32 + 32 + 1 + (flags & PEERS_FLAG_HAS_JOIN ? 64+8 : 0) + 64 + 8 + 1 + (size_t)nl + 1;
|
||||
size_t addr_sz = off - addr_start;
|
||||
if (addr_cnt > 0) {
|
||||
if (off + peer_needed > buf_sz) { sqlite3_finalize(stmt); return -2; }
|
||||
@@ -444,7 +445,6 @@ int topo_node_sqlite_channel_peers_all(sqlite3* db, const char* channel_id,
|
||||
memcpy(buf + off, &node_id, 8); off += 8;
|
||||
memcpy(buf + off, x25519, 32); off += 32;
|
||||
memcpy(buf + off, ed_pub, 32); off += 32;
|
||||
uint8_t flags = (join_sig && join_ts) ? PEERS_FLAG_HAS_JOIN : 0;
|
||||
buf[off++] = flags;
|
||||
if (flags & PEERS_FLAG_HAS_JOIN) {
|
||||
memcpy(buf + off, join_sig, 64); off += 64;
|
||||
|
||||
Reference in new issue
Block a user