@@ -941,16 +941,16 @@ func (exeNode *ExecutionNode) LoadExecutionStateLedger(
941941 module.ReadyDoneAware ,
942942 error ,
943943) {
944+ // Ledger selection is two independent choices passed to the factory:
945+ // - --payloadless picks the payloadless vs. full ledger (this branch).
946+ // - --ledger-service-addr (Config.LedgerServiceAddr), when set, means this
947+ // node connects to a remote ledger service rather than running a local
948+ // ledger; the factory then returns a gRPC client instead of a local one.
949+ // Combined: payloadless + remote address -> remote payloadless client;
950+ // payloadless + no address -> local payloadless ledger; likewise for full mode.
944951 if exeNode .exeConf .payloadless {
945952 // Payloadless mode. ValidateFlags enforces --enable-storehouse,
946953 // so the storehouse is the value source for reads.
947- //
948- // The factory call mirrors the full-mode call below: same Config,
949- // same triggerCheckpoint. Today the factory body is a placeholder
950- // (no WAL, no checkpoint load) — see TODOs at
951- // ledgerfactory.NewPayloadlessLedger. When the WAL/checkpoint
952- // pieces land, only the factory body changes; this call site stays
953- // the same.
954954 pl , err := ledgerfactory .NewPayloadlessLedger (ledgerfactory.Config {
955955 LedgerServiceAddr : exeNode .exeConf .ledgerServiceAddr ,
956956 LedgerMaxRequestSize : exeNode .exeConf .ledgerMaxRequestSize ,
@@ -1501,11 +1501,16 @@ func (exeNode *ExecutionNode) LoadBootstrapper(node *NodeConfig) error {
15011501 // HasRootCheckpointV7 guard keeps a re-entry after an interrupted
15021502 // bootstrap from hitting ConvertCheckpointV6ToV7's "output exists" check.
15031503 //
1504+ // Only nodes running a local payloadless ledger need this: a node using a
1505+ // remote ledger service (ledgerServiceAddr set) never reads its local trie
1506+ // dir, and the remote ledger service performs its own V7 bootstrap. Skipping
1507+ // the conversion avoids a needless full-forest load on remote-ledger nodes.
1508+ //
15041509 // TODO: ConvertCheckpointV6ToV7 reads the entire V6 forest into memory
15051510 // before emitting V7, a memory/time spike at first boot for mainnet-scale
15061511 // root checkpoints. A future optimization is to convert subtrie-by-subtrie
15071512 // without loading the whole forest.
1508- if exeNode .exeConf .payloadless {
1513+ if exeNode .exeConf .payloadless && exeNode . exeConf . ledgerServiceAddr == "" {
15091514 triedir := exeNode .exeConf .triedir
15101515 hasV7Root , err := wal .HasRootCheckpointV7 (triedir )
15111516 if err != nil {
0 commit comments