MCPcopy Create free account
hub / github.com/ElementsProject/lightning / populate_layer

Function populate_layer

plugins/askrene/layer.c:772–818  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

770}
771
772static void populate_layer(struct askrene *askrene,
773 const char *layername TAKES,
774 const u8 *data)
775{
776 struct layer *layer;
777 size_t len = tal_bytelen(data);
778
779 layer = add_layer(askrene, layername, true);
780 plugin_log(askrene->plugin, LOG_DBG,
781 "Loaded level %s (%zu bytes)",
782 layer->name, len);
783
784 while (len != 0) {
785 enum dstore_layer_type type;
786 type = fromwire_peektypen(data, len);
787
788 switch (type) {
789 case DSTORE_CHANNEL:
790 load_channel(askrene->plugin, layer, &data, &len);
791 continue;
792 case DSTORE_CHANNEL_UPDATE:
793 load_channel_update(askrene->plugin, layer, &data, &len);
794 continue;
795 case DSTORE_CHANNEL_CONSTRAINT:
796 load_channel_constraint(askrene->plugin, layer, &data, &len);
797 continue;
798 case DSTORE_CHANNEL_BIAS:
799 load_channel_bias(askrene->plugin, layer, &data, &len);
800 continue;
801 case DSTORE_CHANNEL_BIAS_V2:
802 load_channel_bias_v2(askrene->plugin, layer, &data, &len);
803 continue;
804 case DSTORE_DISABLED_NODE:
805 load_disabled_node(askrene->plugin, layer, &data, &len);
806 continue;
807 case DSTORE_NODE_BIAS:
808 load_node_bias(askrene->plugin, layer, &data, &len);
809 continue;
810 }
811 plugin_err(askrene->plugin, "Invalid type %i in datastore: layer %s %s",
812 type, layer->name, tal_hexstr(tmpctx, data, len));
813 }
814 if (!data)
815 plugin_log(askrene->plugin, LOG_BROKEN,
816 "%s: invalid data in datastore",
817 layer->name);
818}
819
820void load_layers(struct askrene *askrene, struct command *init_cmd)
821{

Callers 1

load_layersFunction · 0.85

Calls 13

tal_bytelenFunction · 0.85
fromwire_peektypenFunction · 0.85
load_channelFunction · 0.85
load_channel_updateFunction · 0.85
load_channel_constraintFunction · 0.85
load_channel_biasFunction · 0.85
load_channel_bias_v2Function · 0.85
load_disabled_nodeFunction · 0.85
load_node_biasFunction · 0.85
tal_hexstrFunction · 0.85
add_layerFunction · 0.70
plugin_logFunction · 0.50

Tested by

no test coverage detected