From bb0c9abb83090fa1d271aad6711c9670dac97893 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Wed, 16 Sep 2026 13:56:40 -0700 Subject: [PATCH] Spec txid wire encoding and database repair Add client Gherkin pinning little-endian wire order for every action that embeds a parent txid (like, reply, poll option, poll vote), and a psf-memo-db Gherkin for a utility that repairs existing byte-reversed references and rebuilds the affected indexes. By specifier. --- .../specs/txid-wire-encoding.feature | 59 +++++++++++++++ .../specs/repair-txid-encoding.feature | 74 +++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 psf-memo-client/specs/txid-wire-encoding.feature create mode 100644 psf-memo-db/specs/repair-txid-encoding.feature diff --git a/psf-memo-client/specs/txid-wire-encoding.feature b/psf-memo-client/specs/txid-wire-encoding.feature new file mode 100644 index 0000000..9e5c3b7 --- /dev/null +++ b/psf-memo-client/specs/txid-wire-encoding.feature @@ -0,0 +1,59 @@ +# Scenarios: Txid wire encoding - 1, Txid wire encoding - 2, Txid wire encoding - 3, Txid wire encoding - 4 +# +# Memo actions that reference a parent transaction embed that txid as 32 raw +# bytes. The wire order is little-endian: the reverse of the 64-character +# display txid. The indexer reverses those bytes back into the display txid so +# the referenced post, reply, or poll can be found. This feature pins the wire +# byte order for every client action that references a parent txid: like, +# reply, poll option, and poll vote. +Feature: Txid wire encoding + + Background: + Given a wallet authenticated for the address bitcoincash:qqlrzp23w08434twmvr4fxw672whkjy0py26r63g3d + Given the wallet has spendable output to pay the transaction fee + + Scenario Outline: Txid wire encoding - 1 a like broadcasts the post txid in little-endian wire order + Given a post with the txid authored by the author address + When I click the heart icon on the post with txid + When I submit the like without a tip + Then the wallet broadcasts an OP_RETURN transaction with the Memo like prefix and the post txid + + Examples: + | txid | + | 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef | + | 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff | + + Scenario Outline: Txid wire encoding - 2 a reply broadcasts the parent txid in little-endian wire order + Given I open the thread for the post with txid + When I type a reply with the text "" + When I submit the reply + Then the wallet broadcasts an OP_RETURN transaction with the Memo reply prefix + + Examples: + | txid | message | + | 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef | hello memo | + | 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff | a second one | + + Scenario Outline: Txid wire encoding - 3 a poll option broadcasts the poll txid in little-endian wire order + Given a poll with the txid + When I open the poll with txid + When I compose an option with the text "