From 3d0c416ab761946d60ac30ad271fd215952b3345 Mon Sep 17 00:00:00 2001 From: pasta Date: Wed, 7 Oct 2026 01:09:10 -0500 Subject: [PATCH 1/4] fix(coinjoin): bind signatures to the approved transaction CoinJoin entries reach the coordinator without their memory-only prevPubKey, so IsInputScriptSigValid verified each scriptSig against an empty script on a reconstructed, unsorted transaction. Any push-only scriptSig that left true on the stack passed, so the signature check did not authenticate the input. Record each input's scriptPubKey from the coin view under cs_main when the entry is admitted, and reject the entry if an input is missing or spent. When a signature arrives, require the signing state, bind it to an input of the sender's own admitted entry, and verify it with standard script flags against the canonical final transaction before changing any accepted state. Co-Authored-By: Claude Opus 5.5 (1M context) --- src/coinjoin/server.cpp | 123 +++++++++++----------------- src/coinjoin/server.h | 4 +- src/test/coinjoin_inouts_tests.cpp | 127 ++++++++++++++++++++++++++++- 3 files changed, 176 insertions(+), 78 deletions(-) diff --git a/src/coinjoin/server.cpp b/src/coinjoin/server.cpp index b9cbb197e414..5eefed8201b3 100644 --- a/src/coinjoin/server.cpp +++ b/src/coinjoin/server.cpp @@ -10,11 +10,13 @@ #include #include +#include #include #include #include #include #include +#include #include #include