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

Function utxos_for_channel

tests/utils.py:219–245  ·  view source on GitHub ↗
(utxoset, channel_id)

Source from the content-addressed store, hash-verified

217
218
219def utxos_for_channel(utxoset, channel_id):
220 relevant_txids = []
221 chan_utxos = {}
222
223 def _add_relevant(txid, utxo):
224 if txid not in chan_utxos:
225 chan_utxos[txid] = []
226 chan_utxos[txid].append(utxo)
227
228 for txid, utxo_list in utxoset.items():
229 for utxo in utxo_list:
230 if utxo[0]['account_id'] == channel_id:
231 _add_relevant(txid, utxo)
232 relevant_txids.append(txid)
233 if utxo[1]:
234 relevant_txids.append(utxo[1]['txid'])
235 elif txid in relevant_txids:
236 _add_relevant(txid, utxo)
237 if utxo[1]:
238 relevant_txids.append(utxo[1]['txid'])
239
240 # if they're not well ordered, we'll leave some txids out
241 for txid in relevant_txids:
242 if txid not in chan_utxos:
243 chan_utxos[txid] = utxoset[txid]
244
245 return chan_utxos
246
247
248def matchup_events(u_set, evs, chans, tag_list):

Callers 1

check_utxos_channelFunction · 0.85

Calls 1

_add_relevantFunction · 0.85

Tested by

no test coverage detected