PayJoin *client* randomly fails with bogus error "Some of our outputs are not included in the proposal"
See original GitHub issueDescribe the bug When testing loptos with BTCPayServer wallet as the client it occasionally reports correctly-looking (see log below) PSBT as missing outputs.
To Reproduce the bug Steps to reproduce the reported bug:
- Deploy regtest setup with a version of lnd created by merging https://github.com/lightningnetwork/lnd/pull/5363
- Deploy loptos
- Create a store with hot wallet
- Send 1 regtest BTC to BTCPay internal wallet
- Spawn a secondary node
- Connect from LND to secondary node
- Launch loptos - attempt to open 1M channel
- Copy BIP21 from output of loptos and paste it in BTCPay wallet “Send” tab
- Broadcast transaction
- If it succeeded, mine 7 blocks and repeat steps starting from 5
- If BTCPay failed with above-mentioned message observe debug output
Expected behavior
PayJoin succeeds every time (or fails for reason unrelated to BTCPayServer)
Your BTCPay Environment (please complete the following information):
- BTCPay Server Version: 1.1.2
- Deployment Method: Debian package
- Browser: Firefox ESR (irrelevant)
Logs (if applicable)
Nothing interesting in BTCPay log.
Log from loptos
[src/main.rs:56] req.uri().query() = Some(
"v=1&additionalfeeoutputindex=1&maxadditionalfeecontribution=6800",
)
Received transaction: PartiallySignedTransaction {
global: Global {
unsigned_tx: Transaction {
version: 2,
lock_time: 0,
input: [
TxIn {
previous_output: OutPoint {
txid: 5108f7639e6d141b2c2520c58e73fb2aa278a512965a7921bcfd2f8c1f0a81ee,
vout: 0,
},
script_sig: Script(),
sequence: 4294967295,
witness: [],
},
],
output: [
TxOut {
value: 1000000,
script_pubkey: Script(OP_0 OP_PUSHBYTES_20 6dbfaed20d0eb3091ada404ac829f5266e55c01b),
},
TxOut {
value: 95943600,
script_pubkey: Script(OP_0 OP_PUSHBYTES_20 b271f99690c5c011f62f124d92a9f126cccee3d8),
},
],
},
version: 0,
xpub: {},
proprietary: {},
unknown: {},
},
inputs: [
Input {
non_witness_utxo: None,
witness_utxo: Some(
TxOut {
value: 96957700,
script_pubkey: Script(OP_0 OP_PUSHBYTES_20 111ea18add90174f4b5d5e534ba1b6683e8b04f0),
},
),
partial_sigs: {},
sighash_type: None,
redeem_script: None,
witness_script: None,
bip32_derivation: {},
final_script_sig: None,
final_script_witness: Some(
[
[
48,
68,
2,
32,
94,
131,
215,
30,
29,
225,
153,
242,
18,
52,
132,
114,
224,
96,
98,
229,
236,
103,
66,
207,
12,
56,
163,
54,
120,
132,
84,
63,
180,
193,
119,
224,
2,
32,
27,
188,
120,
192,
109,
26,
117,
144,
89,
228,
78,
69,
3,
41,
236,
35,
52,
33,
46,
215,
31,
250,
213,
217,
156,
33,
125,
39,
36,
37,
37,
83,
1,
],
[
3,
196,
202,
61,
183,
121,
82,
47,
63,
217,
149,
156,
141,
64,
52,
243,
240,
144,
66,
33,
207,
111,
68,
13,
132,
76,
214,
236,
253,
101,
5,
92,
148,
],
],
),
ripemd160_preimages: {},
sha256_preimages: {},
hash160_preimages: {},
hash256_preimages: {},
proprietary: {},
unknown: {},
},
],
outputs: [
Output {
redeem_script: None,
witness_script: None,
bip32_derivation: {},
proprietary: {},
unknown: {},
},
Output {
redeem_script: None,
witness_script: None,
bip32_derivation: {},
proprietary: {},
unknown: {},
},
],
}
After removing our output: PartiallySignedTransaction {
global: Global {
unsigned_tx: Transaction {
version: 2,
lock_time: 0,
input: [
TxIn {
previous_output: OutPoint {
txid: 5108f7639e6d141b2c2520c58e73fb2aa278a512965a7921bcfd2f8c1f0a81ee,
vout: 0,
},
script_sig: Script(),
sequence: 4294967295,
witness: [],
},
],
output: [
TxOut {
value: 95943600,
script_pubkey: Script(OP_0 OP_PUSHBYTES_20 b271f99690c5c011f62f124d92a9f126cccee3d8),
},
],
},
version: 0,
xpub: {},
proprietary: {},
unknown: {},
},
inputs: [
Input {
non_witness_utxo: None,
witness_utxo: Some(
TxOut {
value: 96957700,
script_pubkey: Script(OP_0 OP_PUSHBYTES_20 111ea18add90174f4b5d5e534ba1b6683e8b04f0),
},
),
partial_sigs: {},
sighash_type: None,
redeem_script: None,
witness_script: None,
bip32_derivation: {},
final_script_sig: None,
final_script_witness: Some(
[
[
48,
68,
2,
32,
94,
131,
215,
30,
29,
225,
153,
242,
18,
52,
132,
114,
224,
96,
98,
229,
236,
103,
66,
207,
12,
56,
163,
54,
120,
132,
84,
63,
180,
193,
119,
224,
2,
32,
27,
188,
120,
192,
109,
26,
117,
144,
89,
228,
78,
69,
3,
41,
236,
35,
52,
33,
46,
215,
31,
250,
213,
217,
156,
33,
125,
39,
36,
37,
37,
83,
1,
],
[
3,
196,
202,
61,
183,
121,
82,
47,
63,
217,
149,
156,
141,
64,
52,
243,
240,
144,
66,
33,
207,
111,
68,
13,
132,
76,
214,
236,
253,
101,
5,
92,
148,
],
],
),
ripemd160_preimages: {},
sha256_preimages: {},
hash160_preimages: {},
hash256_preimages: {},
proprietary: {},
unknown: {},
},
],
outputs: [
Output {
redeem_script: None,
witness_script: None,
bip32_derivation: {},
proprietary: {},
unknown: {},
},
Output {
redeem_script: None,
witness_script: None,
bip32_derivation: {},
proprietary: {},
unknown: {},
},
],
}
PSBT received from LND: PartiallySignedTransaction {
global: Global {
unsigned_tx: Transaction {
version: 2,
lock_time: 0,
input: [],
output: [
TxOut {
value: 1000000,
script_pubkey: Script(OP_0 OP_PUSHBYTES_32 2f550284b82d23461e055a1faeec23a9efed25e7986da3a09784dd07a6a19775),
},
],
},
version: 0,
xpub: {},
proprietary: {},
unknown: {},
},
inputs: [],
outputs: [
Output {
redeem_script: None,
witness_script: None,
bip32_derivation: {},
proprietary: {},
unknown: {},
},
],
}
PSBT to be given to LND: PartiallySignedTransaction {
global: Global {
unsigned_tx: Transaction {
version: 2,
lock_time: 0,
input: [
TxIn {
previous_output: OutPoint {
txid: 5108f7639e6d141b2c2520c58e73fb2aa278a512965a7921bcfd2f8c1f0a81ee,
vout: 0,
},
script_sig: Script(),
sequence: 4294967295,
witness: [],
},
],
output: [
TxOut {
value: 95943600,
script_pubkey: Script(OP_0 OP_PUSHBYTES_20 b271f99690c5c011f62f124d92a9f126cccee3d8),
},
TxOut {
value: 1000000,
script_pubkey: Script(OP_0 OP_PUSHBYTES_32 2f550284b82d23461e055a1faeec23a9efed25e7986da3a09784dd07a6a19775),
},
],
},
version: 0,
xpub: {},
proprietary: {},
unknown: {},
},
inputs: [
Input {
non_witness_utxo: None,
witness_utxo: Some(
TxOut {
value: 96957700,
script_pubkey: Script(OP_0 OP_PUSHBYTES_20 111ea18add90174f4b5d5e534ba1b6683e8b04f0),
},
),
partial_sigs: {},
sighash_type: None,
redeem_script: None,
witness_script: None,
bip32_derivation: {},
final_script_sig: None,
final_script_witness: Some(
[
[
48,
68,
2,
32,
94,
131,
215,
30,
29,
225,
153,
242,
18,
52,
132,
114,
224,
96,
98,
229,
236,
103,
66,
207,
12,
56,
163,
54,
120,
132,
84,
63,
180,
193,
119,
224,
2,
32,
27,
188,
120,
192,
109,
26,
117,
144,
89,
228,
78,
69,
3,
41,
236,
35,
52,
33,
46,
215,
31,
250,
213,
217,
156,
33,
125,
39,
36,
37,
37,
83,
1,
],
[
3,
196,
202,
61,
183,
121,
82,
47,
63,
217,
149,
156,
141,
64,
52,
243,
240,
144,
66,
33,
207,
111,
68,
13,
132,
76,
214,
236,
253,
101,
5,
92,
148,
],
],
),
ripemd160_preimages: {},
sha256_preimages: {},
hash160_preimages: {},
hash256_preimages: {},
proprietary: {},
unknown: {},
},
],
outputs: [
Output {
redeem_script: None,
witness_script: None,
bip32_derivation: {},
proprietary: {},
unknown: {},
},
Output {
redeem_script: None,
witness_script: None,
bip32_derivation: {},
proprietary: {},
unknown: {},
},
],
}
PSBT that will be returned: PartiallySignedTransaction {
global: Global {
unsigned_tx: Transaction {
version: 2,
lock_time: 0,
input: [
TxIn {
previous_output: OutPoint {
txid: 5108f7639e6d141b2c2520c58e73fb2aa278a512965a7921bcfd2f8c1f0a81ee,
vout: 0,
},
script_sig: Script(),
sequence: 4294967295,
witness: [],
},
],
output: [
TxOut {
value: 95943600,
script_pubkey: Script(OP_0 OP_PUSHBYTES_20 b271f99690c5c011f62f124d92a9f126cccee3d8),
},
TxOut {
value: 1000000,
script_pubkey: Script(OP_0 OP_PUSHBYTES_32 2f550284b82d23461e055a1faeec23a9efed25e7986da3a09784dd07a6a19775),
},
],
},
version: 0,
xpub: {},
proprietary: {},
unknown: {},
},
inputs: [
Input {
non_witness_utxo: None,
witness_utxo: None,
partial_sigs: {},
sighash_type: None,
redeem_script: None,
witness_script: None,
bip32_derivation: {},
final_script_sig: None,
final_script_witness: None,
ripemd160_preimages: {},
sha256_preimages: {},
hash160_preimages: {},
hash256_preimages: {},
proprietary: {},
unknown: {},
},
],
outputs: [
Output {
redeem_script: None,
witness_script: None,
bip32_derivation: {},
proprietary: {},
unknown: {},
},
Output {
redeem_script: None,
witness_script: None,
bip32_derivation: {},
proprietary: {},
unknown: {},
},
],
}
Additional context
I attempted to check the logic first to see why it reports removed output despite the output being there but couldn’t find the code handling it in BTCPayServer repository.
Issue Analytics
- State:
- Created 2 years ago
- Comments:21 (20 by maintainers)
Top Results From Across the Web
Queries on possible changes to payjoin-spec · Issue #486
Proposal : Enable the merchant to construct transactions with redundant inputs to create false PayJoins which throw off any statistical analysis ...
Read more >2020-05-05-socratic-seminar-payjoins
I think the main problem is the connection between outputs. ... the customer who is paying sends this non-payjoin transaction first?
Read more >BTCPay Server Payjoin Guide
BTCPay Server Payjoin Guide. This document explains how to use BTCPay Server's Payjoin feature. For a detailed, technical explanation of how payjoin is ......
Read more >Centrally Coordinated CoinJoins with Variable Amounts
Abstract. Bitcoin transfers value on a public ledger of transactions anyone can verify. Coin ownership is defined in terms of public keys.
Read more >Missing Inputs Bitcoin
Each transaction is represented by a list of inputs and a list of outputs, ... It is still missing our signature, which we...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for quick release!
Sorry @Kixunil for taking time about this one, forgot about it. I’ll dig into it for next small release.