Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

joinmarket.cfg missing default settings #734

Closed
kmajs opened this issue Sep 13, 2024 · 6 comments
Closed

joinmarket.cfg missing default settings #734

kmajs opened this issue Sep 13, 2024 · 6 comments

Comments

@kmajs
Copy link

kmajs commented Sep 13, 2024

The defaults were removed here, but it appears jmclient/configure.py is not setting them properly. The [POLICY] section is missing and it doesn't look like the joinmarket code has fallback values if these are missing.

@erikarvstedt
Copy link
Collaborator

it appears jmclient/configure.py is not setting them properly

How can I reproduce this?

@kmajs
Copy link
Author

kmajs commented Sep 13, 2024

I thought the jmclient/configure.py script was called somewhere in the nix-bitcoin module, but looking back through, I couldn't find where that happens.

There may be an easier way to do this, but I used this flake to make a container so I could check the contents of a fresh joinmarket.cfg.

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
    nix-bitcoin.url = "github:fort-nix/nix-bitcoin/release";
  };

  outputs =
    { nixpkgs, nix-bitcoin, ... }:
    {
      nixosConfigurations.btc = nixpkgs.lib.nixosSystem {
        modules = [
          (
            { ... }:
            {
              imports = [ nix-bitcoin.nixosModules.default ];
              nixpkgs.hostPlatform = "x86_64-linux";
              boot.isContainer = true;
              nix-bitcoin.generateSecrets = true;
              services.joinmarket.enable = true;
            }
          )
        ];
      };
    };
}

Then:
sudo nixos-container create --flake .#btc btc
sudo nixos-container run btc
sudo nixos-container root-login btc
# cat /var/lib/joinmarket/joinmarket.cfg

@erikarvstedt
Copy link
Collaborator

erikarvstedt commented Sep 13, 2024

Joinmarket loads the default config from jmclient/configure.py and then merges the user-provided config (/var/lib/joinmarket/joinmarket.cfg) into it.
Why do you think the default settings from jmclient/configure.py are not present in the final config at runtime?

@kmajs
Copy link
Author

kmajs commented Sep 13, 2024

Oh, I see - yes, that makes a lot more sense. :)

I changed a joinmarket [POLICY] setting:

joinmarket = {
  enable = true;
  settings.POLICY.merge_algorithm = "gradual";
  yieldgenerator = { enable = true; };
};

and my yield-generator stopped filling offers and the joinmarketd logs showed lots of these:
Received commitment broadcast by other maker: 4ef0...ae, now blacklisted.
I pasted in the defaults that had been removed and the yieldgenerator started filling orders again.

Note: I get the same behavior even if settings is not defined.

@erikarvstedt
Copy link
Collaborator

I still can't reproduce this. In my tests the config merging works correctly.

Can you share the nix-bitcoin config where joinmarket-yieldgenerator works correctly for you and the config where it fails?
I'll then check how both joinmarket configs differ at runtime.

DIY debugging

This section is from an older version of this post. It's only relevant if you want to try debugging this by yourself.

Here's a version of nix-bitcoin that patches joinmarket to print its config at startup.
(Unfortunately, because of NixOS/nixpkgs#44426, we can't simply add a config setting that overrides joinmarket, but we have to change nix-bitcoin instead.)

Do the following:

  1. Switch to the custom nix-bitcoin version linked above. This is easy with Flakes, let me know if you need help with this.
  2. Run joinmarket-yieldgenerator with the config that's working for you.
  3. Print the logs of the currently runningjoinmarket-yieldgenerator instance:
    journalctl --since "$(systemctl show -p InactiveExitTimestamp --timestamp=us --value joinmarket-yieldgenerator)" -u joinmarket-yieldgenerator
    Copy the printed config values from the beginning of the log. It should look like this:
    {'DAEMON': [('no_daemon', '0'),
                ('daemon_port', '27183'),
                ...
     'BLOCKCHAIN': [('blockchain_source', 'bitcoin-rpc'),
                    ('network', 'mainnet'),
      ...                
    
  4. Then switch to the config that fails for you and also copy its config values from the log.
  5. Post the diff of both configs (or just post both configs and I'll do the diff).

@kmajs
Copy link
Author

kmajs commented Nov 12, 2024

I can no longer reproduce the behavior I experienced, so the source of errors must have been elsewhere. It's possible there was a joinmarket "network" issue (tor?) during my earlier attempts. The joinmarket directory nodes have been inconsistent for me lately but at least orders are being filled.

Thank you for your work on nix-bitcoin!

@kmajs kmajs closed this as completed Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants