damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 5a956248f9c017a5d9afba2a2ffc47afc4934535
parent cf615b82b24206b258d25931455013feb259d232
Author: William Casarin <jb55@jb55.com>
Date:   Sun,  1 Jan 2023 11:31:36 -0800

bolt11: fix bug where text not showing after invoice

Changelog-Fixed: Fix but where text was not showing after invoices

Diffstat:
Mdamus-c/damus.c | 2+-
MdamusTests/InvoiceTests.swift | 7++-----
2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/damus-c/damus.c b/damus-c/damus.c @@ -241,7 +241,7 @@ static int parse_invoice(struct cursor *cur, struct block *block) { block->block.invoice.invstr.end = (const char*)end; block->block.invoice.bolt11 = bolt11; - cur->p += end - start; + cur->p = end; return 1; } diff --git a/damusTests/InvoiceTests.swift b/damusTests/InvoiceTests.swift @@ -36,17 +36,14 @@ final class InvoiceTests: XCTestCase { func testTextAfterInvoice() throws { let invstr = """ -LNBC1P3MR5UJSP5G7SA48YD4JWTTPCHWMY4QYN4UWZQCJQ8NMWKD6QE3HCRVYTDLH9SPP57YM9TSA9NN4M4XU59XMJCXKR7YDV29DDP6LVQUT46ZW6CU3KE9GQDQ9V9H8JXQ8P3MYLZJCQPJRZJQF60PZDVNGGQWQDNERZSQN35L8CVQ3QG2Z5NSZYD0D3Q0JW2TL6VUZA7FYQQWKGQQYQQQQLGQQQQXJQQ9Q9QXPQYSGQ39EM4QJMQFKZGJXZVGL7QJMYNSWA8PGDTAGXXRG5Z92M7VLCGKQK2L2THDF8LM0AUKAURH7FVAWDLRNMVF38W4EYJDNVN9V4Z9CRS5CQCV465C - -hi there +LNBC1P3MR5UJSP5G7SA48YD4JWTTPCHWMY4QYN4UWZQCJQ8NMWKD6QE3HCRVYTDLH9SPP57YM9TSA9NN4M4XU59XMJCXKR7YDV29DDP6LVQUT46ZW6CU3KE9GQDQ9V9H8JXQ8P3MYLZJCQPJRZJQF60PZDVNGGQWQDNERZSQN35L8CVQ3QG2Z5NSZYD0D3Q0JW2TL6VUZA7FYQQWKGQQYQQQQLGQQQQXJQQ9Q9QXPQYSGQ39EM4QJMQFKZGJXZVGL7QJMYNSWA8PGDTAGXXRG5Z92M7VLCGKQK2L2THDF8LM0AUKAURH7FVAWDLRNMVF38W4EYJDNVN9V4Z9CRS5CQCV465C hi there """ let parsed = parse_mentions(content: invstr, tags: []) XCTAssertNotNil(parsed) XCTAssertEqual(parsed.count, 2) - print(parsed) XCTAssertNotNil(parsed[0].is_invoice) - XCTAssertNotNil(parsed[1].is_text, "hi there") + XCTAssertEqual(parsed[1].is_text, " hi there") guard let invoice = parsed[0].is_invoice else { return }