From a3d04ed72e77135600af7ae1949950b85e7911f1 Mon Sep 17 00:00:00 2001 From: pasta Date: Wed, 7 Oct 2026 01:09:10 -0500 Subject: [PATCH 1/2] 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 b06652025431..91490990e630 100644 --- a/src/coinjoin/server.cpp +++ b/src/coinjoin/server.cpp @@ -10,10 +10,12 @@ #include #include +#include #include #include #include #include +#include #include #include