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

Function decode_truncated_value

plugins/lsps-plugin/src/core/tlv.rs:488–499  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

486
487 #[test]
488 fn decode_truncated_value() {
489 // type=1, len=2 but only 1 byte of value provided
490 let mut bytes = Vec::new();
491 bytes.extend(encode_bigsize(1));
492 bytes.extend(encode_bigsize(2));
493 bytes.push(0x00); // missing one more byte
494 let err = TlvStream::from_bytes(&bytes).unwrap_err();
495 assert!(
496 format!("{}", err).contains("truncated"),
497 "expected truncated error, got: {err}"
498 );
499 }
500
501 #[test]
502 fn set_and_get_u64_basic() -> Result<()> {

Callers

nothing calls this directly

Calls 2

encode_bigsizeFunction · 0.85
unwrap_errMethod · 0.80

Tested by

no test coverage detected