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

Method insert

plugins/lsps-plugin/src/core/tlv.rs:135–144  ·  view source on GitHub ↗

Insert a TLV record (replaces if type already exists).

(&mut self, type_: u64, value: Vec<u8>)

Source from the content-addressed store, hash-verified

133
134 /// Insert a TLV record (replaces if type already exists).
135 pub fn insert(&mut self, type_: u64, value: Vec<u8>) {
136 // If the type already exists, replace its value.
137 if let Some(rec) = self.0.iter_mut().find(|rec| rec.type_ == type_) {
138 rec.value = value;
139 return;
140 }
141 // Otherwise push and re-sort to maintain canonical order.
142 self.0.push(TlvRecord { type_, value });
143 self.0.sort_by_key(|r| r.type_);
144 }
145
146 /// Remove a record by type.
147 pub fn remove(&mut self, type_: u64) -> Option<Vec<u8>> {

Callers 15

conf.pyFile · 0.45
test_rpc_command_hookFunction · 0.45
test_notimestamp_loggingFunction · 0.45
recklessFunction · 0.45
make_chansFunction · 0.45
newMethod · 0.45
refresh_currencyMethod · 0.45
background_refreshMethod · 0.45
register_pathFunction · 0.45
merge_maps_disjointFunction · 0.45
verify_runeFunction · 0.45

Calls

no outgoing calls

Tested by 4

test_rpc_command_hookFunction · 0.36
test_notimestamp_loggingFunction · 0.36
recklessFunction · 0.36
make_chansFunction · 0.36