HomePhabricator

[electrum] fix signature updating in fusion code

Description

[electrum] fix signature updating in fusion code

Summary:
This is a bugfix follow-up to D14472.

tx.inputs() now builds the coin dicts on demand, and changing the returned coin dicts no longer affects the transaction in any way. The code needs to operate on tx.txinputs() which returns a list of references to the actual coin stored in the transaction.

Test Plan:
Check that there are no other signatures updating in coin dicts left in the codebase (except for some coin dict serialization code for legacy IO):

grep -r '\["signatures"\] =' .
grep -r '\["signatures"\]\[' .

Patch the server code to allow for testing with two wallets:

diff --git a/electrum/electrumabc_plugins/fusion/server.py b/electrum/electrumabc_plugins/fusion/server.py
index 8242a2686a..ac85a86ea7 100644
--- a/electrum/electrumabc_plugins/fusion/server.py
+++ b/electrum/electrumabc_plugins/fusion/server.py
@@ -113,12 +113,12 @@ class Params:
     ]

     # How many clients do we want before starting a fusion?
-    min_clients = 8
+    min_clients = 2
     # If all clients submitted largest possible component (uncompressed p2pkh input), how many could we take until the result would exceed 100 kB standard tx size limitation?
     max_clients = (100000 - 12) // (num_components * 173)

     # Every round, clients leave ... How many clients do we need as an absolute minimum (for privacy)?
-    min_safe_clients = 6
+    min_safe_clients = 2

     # Choose the minimum excess fee based on dividing the overhead amongst players, in the smallest fusion
     # (these overhead numbers assume op_return script size of 1 + 5 (lokad) + 33 (session hash) )
@@ -137,17 +137,17 @@ class Params:
     max_tier_client_tags = 100

     # For a given IP, how many players can they represent in the same fuse?
-    ip_max_simul_fuse = 3
+    ip_max_simul_fuse = 6

     # Guaranteed time to launch a fusion if the pool has stayed at or above min_clients for this long.
-    start_time_max = 1200
+    start_time_max = 60
     # Inter-fusion delay -- after starting any fusion, wait this long before starting the next one (unless hit max time or pool is full).
-    start_time_spacing = 120
+    start_time_spacing = 20
     # But don't start a fusion if it has only been above min_clients for a short time (unless pool is full).
-    start_time_min = 400
+    start_time_min = 20

     # whether to print a lot of logs
-    noisy = False
+    noisy = True

 # How long covert connections are allowed to stay open without activity.

Start the server:

./electrum-abc -v daemon start
./electrum-abc daemon fusion_server_start

Start two wallets on another computer and change the fusion server IP and port to the test server. Check that it fuses successfully.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D14810

Details

Provenance
PiRKAuthored on Nov 17 2023, 15:07
PiRKPushed on Nov 20 2023, 11:32
Reviewer
Restricted Project
Differential Revision
D14810: [electrum] fix signature updating in fusion code
Parents
rABC458ea52968ab: [avalanche] Don't log all the avahello we send
Branches
Unknown
Tags
Unknown