Skip to content

Commit 767073f

Browse files
committed
Shrink CAddress from 48 to 40 bytes on x64
`CAddress` inherits `CService` which is 28 bytes (on 64 bit machines). `CAddress` then adds two member variables - one that requires 4 byte alignment (`nTime`) and one that requires 8 byte alignment (`nServices`). Declare the smaller one first so that it fits in bytes 29..32. On 32 bit machines this change has no effect and `CAddress` remains 40 bytes.
1 parent bd00d3b commit 767073f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/protocol.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,10 @@ class CAddress : public CService
371371
READWRITEAS(CService, obj);
372372
}
373373

374-
ServiceFlags nServices{NODE_NONE};
375374
// disk and network only
376375
uint32_t nTime{TIME_INIT};
376+
377+
ServiceFlags nServices{NODE_NONE};
377378
};
378379

379380
/** getdata message type flags */

0 commit comments

Comments
 (0)