Page MenuHomePhabricator

[electrum] fix signature updating in fusion code
ClosedPublic

Authored by PiRK on Nov 17 2023, 15:21.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCfe2b435dc1e9: [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.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK retitled this revision from [electrum] fix signature updating in fusion.server to [electrum] fix signature updating in fusion code.
PiRK edited the test plan for this revision. (Show Details)

fix more code

PiRK published this revision for review.Nov 20 2023, 09:11
This revision is now accepted and ready to land.Nov 20 2023, 10:11