Skip to content

Conversation

@knst
Copy link
Collaborator

@knst knst commented Nov 29, 2023

Issue being fixed or feature implemented

Wallet library should not depends on server code (libbitcoin_server).

Untie this library will help to finish backport bitcoin#15639 and will unblock multiprocess: bitcoin#18677

Prior work:

What was done?

  • using havePruned from interface instead direct fPrune
  • removed dependency scriptpubkeyman on uiInterface
  • removed usage fShutdown from scriptpubkeyman
  • usages llmq::quorumInstantSendManager/llmq::chainLocksHandler are wrapper in interface
  • dropped direct usages of deterministicMNManager from wallet code

How Has This Been Tested?

Amount of linkage errors is decreased from 196 to 141 if libbitcoin_server is excluded during linkage:

diff --git a/src/Makefile.am b/src/Makefile.am
index fb4850429f..c9c9c331a7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -865,9 +865,7 @@ endif
 # https://eli.thegreenplace.net/2013/07/09/library-order-in-static-linking#circular-dependency)
 dash_wallet_LDADD = \
   $(LIBBITCOIN_WALLET_TOOL) \
-  $(LIBBITCOIN_SERVER) \
   $(LIBBITCOIN_WALLET) \
-  $(LIBBITCOIN_SERVER) \
   $(LIBBITCOIN_COMMON) \
   $(LIBBITCOIN_CONSENSUS) \
   $(LIBBITCOIN_UTIL) \

Breaking Changes

N/A

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

@knst knst added this to the 20.1 milestone Nov 29, 2023
@knst knst force-pushed the bitcoinserver-15639-p1 branch from 71292ec to 3f77c9d Compare November 30, 2023 15:11
@knst knst force-pushed the bitcoinserver-15639-p1 branch from 3f77c9d to c234a00 Compare November 30, 2023 15:50
@UdjinM6
Copy link

UdjinM6 commented Nov 30, 2023

tool_wallet.py is crashing... 🙈 this should help

diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 206ff59f54..81ac0b7edb 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -5517,7 +5517,7 @@ bool CWallet::GenerateNewHDChainEncrypted(const SecureString& secureMnemonic, co
 
 bool CWallet::ShutdownRequested()
 {
-    return chain().shutdownRequested();
+    return HaveChain() && chain().shutdownRequested();
 }
 
 void CWallet::UpdateProgress(const std::string& title, int nProgress)

@knst knst force-pushed the bitcoinserver-15639-p1 branch from c234a00 to a2ca4a1 Compare November 30, 2023 17:33
UdjinM6
UdjinM6 previously approved these changes Nov 30, 2023
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, light ACK 👍

@github-actions
Copy link

github-actions bot commented Dec 4, 2023

This pull request has conflicts, please rebase.

UdjinM6
UdjinM6 previously approved these changes Dec 5, 2023
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-utACK

@UdjinM6
Copy link

UdjinM6 commented Dec 11, 2023

ping @PastaPastaPasta

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it'd be nice to use string_view here but I think ShowProgress probably wants a std::string

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, ShowProgress indeed uses std::string even in the latest version of bitcoin core:

    boost::signals2::signal<void (const std::string &title, int nProgress)> ShowProgress;

The strMsg that is used in scriptpubkeyman.cpp is also std::string, so, using string_view will add a new allocation here, I will keep it as it is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rework this comment; doesn't make sense

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactor to use std::all_of, std::any_of or std::none_of ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's not new code, I just moved a function to a new place. Anyway, I provided a refactoring in an extra commit

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-utACK

@knst knst changed the title refactor: Pull wallet code out of libbitcoin_server 3/N refactor: pull libbitcoin_server code out of wallet code 3/N Dec 15, 2023
Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK for merging via merge commit

@PastaPastaPasta PastaPastaPasta merged commit 714be63 into dashpay:develop Dec 17, 2023
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

Successfully merging this pull request may close these issues.

3 participants