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

Function parse_splice_script

common/splice_script.c:2455–2568  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2453}
2454
2455struct splice_script_error *parse_splice_script(const tal_t *ctx,
2456 const char *script,
2457 struct splice_script_chan **channels,
2458 struct splice_script_result ***result)
2459{
2460 struct splice_script_error *error;
2461 struct token **tokens = tal_arr(ctx, struct token *,
2462 strlen(script) + 1);
2463
2464 for (size_t i = 0; i < strlen(script); i++) {
2465 tokens[i] = new_token(tokens, is_delimiter(script[i])
2466 ? TOK_DELIMITER
2467 : TOK_CHAR, i);
2468 tokens[i]->c = script[i];
2469 }
2470
2471 /* We add a delimiter on the end to make life simple. */
2472 tokens[strlen(script)] = new_token(tokens, TOK_DELIMITER,
2473 strlen(script));
2474
2475 if ((error = clean_whitespace(ctx, &tokens)))
2476 return error;
2477
2478 if ((error = find_arrows_and_strs(ctx, &tokens)))
2479 return error;
2480
2481 if ((error = process_top_separators(ctx, &tokens)))
2482 return error;
2483
2484 if ((error = process_2nd_separators(ctx, &tokens)))
2485 return error;
2486
2487 if ((error = process_3rd_separators(ctx, &tokens)))
2488 return error;
2489
2490 if ((error = type_data(ctx, channels, &tokens)))
2491 return error;
2492
2493 if ((error = compress_top_operands(ctx, &tokens)))
2494 return error;
2495
2496 if ((error = compress_2nd_operands(ctx, &tokens)))
2497 return error;
2498
2499 if ((error = resolve_channel_ids(ctx, channels, &tokens)))
2500 return error;
2501
2502 if ((error = make_segments(ctx, &tokens)))
2503 return error;
2504
2505 if ((error = expand_multichans(ctx, &tokens)))
2506 return error;
2507
2508 if ((error = validate_and_clean(ctx, channels, &tokens)))
2509 return error;
2510
2511 if ((error = calculate_amounts(ctx, &tokens)))
2512 return error;

Callers 2

mainFunction · 0.85

Calls 15

new_tokenFunction · 0.85
is_delimiterFunction · 0.85
clean_whitespaceFunction · 0.85
find_arrows_and_strsFunction · 0.85
process_top_separatorsFunction · 0.85
process_2nd_separatorsFunction · 0.85
process_3rd_separatorsFunction · 0.85
type_dataFunction · 0.85
compress_top_operandsFunction · 0.85
compress_2nd_operandsFunction · 0.85
resolve_channel_idsFunction · 0.85
make_segmentsFunction · 0.85

Tested by 1

mainFunction · 0.68