Skip to content

Commit fe3b30c

Browse files
committed
[Cleanup] Remove obsolete multisig code
1 parent a2850ce commit fe3b30c

File tree

11 files changed

+4
-141
lines changed

11 files changed

+4
-141
lines changed

src/keystore.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -87,32 +87,6 @@ bool CBasicKeyStore::HaveWatchOnly() const
8787
return (!setWatchOnly.empty());
8888
}
8989

90-
bool CBasicKeyStore::AddMultiSig(const CScript& dest)
91-
{
92-
LOCK(cs_KeyStore);
93-
setMultiSig.insert(dest);
94-
return true;
95-
}
96-
97-
bool CBasicKeyStore::RemoveMultiSig(const CScript& dest)
98-
{
99-
LOCK(cs_KeyStore);
100-
setMultiSig.erase(dest);
101-
return true;
102-
}
103-
104-
bool CBasicKeyStore::HaveMultiSig(const CScript& dest) const
105-
{
106-
LOCK(cs_KeyStore);
107-
return setMultiSig.count(dest) > 0;
108-
}
109-
110-
bool CBasicKeyStore::HaveMultiSig() const
111-
{
112-
LOCK(cs_KeyStore);
113-
return (!setMultiSig.empty());
114-
}
115-
11690
bool CBasicKeyStore::HaveKey(const CKeyID& address) const
11791
{
11892
bool result;

src/keystore.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ class CKeyStore
4646
virtual bool RemoveWatchOnly(const CScript& dest) = 0;
4747
virtual bool HaveWatchOnly(const CScript& dest) const = 0;
4848
virtual bool HaveWatchOnly() const = 0;
49-
50-
//! Support for MultiSig addresses
51-
virtual bool AddMultiSig(const CScript& dest) = 0;
52-
virtual bool RemoveMultiSig(const CScript& dest) = 0;
53-
virtual bool HaveMultiSig(const CScript& dest) const = 0;
54-
virtual bool HaveMultiSig() const = 0;
5549
};
5650

5751
typedef std::map<CKeyID, CKey> KeyMap;
@@ -82,11 +76,6 @@ class CBasicKeyStore : public CKeyStore
8276
virtual bool RemoveWatchOnly(const CScript& dest);
8377
virtual bool HaveWatchOnly(const CScript& dest) const;
8478
virtual bool HaveWatchOnly() const;
85-
86-
virtual bool AddMultiSig(const CScript& dest);
87-
virtual bool RemoveMultiSig(const CScript& dest);
88-
virtual bool HaveMultiSig(const CScript& dest) const;
89-
virtual bool HaveMultiSig() const;
9079
};
9180

9281
typedef std::vector<unsigned char, secure_allocator<unsigned char> > CKeyingMaterial;

src/qt/coincontroldialog.cpp

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ bool CCoinControlWidgetItem::operator<(const QTreeWidgetItem &other) const {
4545
}
4646

4747

48-
CoinControlDialog::CoinControlDialog(QWidget* parent, bool fMultisigEnabled) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint),
48+
CoinControlDialog::CoinControlDialog(QWidget* parent) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint),
4949
ui(new Ui::CoinControlDialog),
5050
model(0)
5151
{
@@ -94,8 +94,6 @@ CoinControlDialog::CoinControlDialog(QWidget* parent, bool fMultisigEnabled) : Q
9494
setCssProperty({ui->pushButtonSelectAll, ui->pushButtonToggleLock}, "btn-check");
9595
ui->pushButtonOk->setProperty("cssClass", "btn-primary");
9696

97-
this->fMultisigEnabled = fMultisigEnabled;
98-
9997
// context menu actions
10098
QAction* copyAddressAction = new QAction(tr("Copy address"), this);
10199
QAction* copyLabelAction = new QAction(tr("Copy label"), this);
@@ -811,10 +809,6 @@ void CoinControlDialog::updateView()
811809
int nInputSum = 0;
812810
for(const COutput& out: coins.second) {
813811
isminetype mine = pwalletMain->IsMine(out.tx->vout[out.i]);
814-
bool fMultiSigUTXO = (mine & ISMINE_MULTISIG);
815-
// when multisig is enabled, it will only display outputs from multisig addresses
816-
if (fMultisigEnabled && !fMultiSigUTXO)
817-
continue;
818812
int nInputSize = 0;
819813
nSum += out.tx->vout[out.i].nValue;
820814
nChildren++;
@@ -827,17 +821,6 @@ void CoinControlDialog::updateView()
827821
itemOutput->setFlags(flgCheckbox);
828822
itemOutput->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
829823

830-
//MultiSig
831-
if (fMultiSigUTXO) {
832-
833-
if (!fMultisigEnabled) {
834-
COutPoint outpt(out.tx->GetHash(), out.i);
835-
coinControl->UnSelect(outpt); // just to be sure
836-
itemOutput->setDisabled(true);
837-
itemOutput->setIcon(COLUMN_CHECKBOX, QIcon(":/icons/lock_closed"));
838-
}
839-
}
840-
841824
// address
842825
const bool fDelegated = (bool)(mine & ISMINE_SPENDABLE_DELEGATED);
843826
CTxDestination outputAddress;

src/qt/coincontroldialog.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class CoinControlDialog : public QDialog
4444
Q_OBJECT
4545

4646
public:
47-
explicit CoinControlDialog(QWidget* parent = nullptr, bool fMultisigEnabled = false);
47+
explicit CoinControlDialog(QWidget* parent = nullptr);
4848
~CoinControlDialog();
4949

5050
void setModel(WalletModel* model);
@@ -66,7 +66,6 @@ class CoinControlDialog : public QDialog
6666
WalletModel* model;
6767
int sortColumn;
6868
Qt::SortOrder sortOrder;
69-
bool fMultisigEnabled;
7069
bool fSelectAllToggled{true}; // false when pushButtonSelectAll text is "Unselect All"
7170

7271
QMenu* contextMenu;

src/qt/walletmodel.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ WalletModel::WalletModel(CWallet* wallet, OptionsModel* optionsModel, QObject* p
3939
cachedNumBlocks(0)
4040
{
4141
fHaveWatchOnly = wallet->HaveWatchOnly();
42-
fHaveMultiSig = wallet->HaveMultiSig();
4342
fForceCheckBalanceChanged = false;
4443

4544
addressTableModel = new AddressTableModel(wallet, this);
@@ -367,12 +366,6 @@ void WalletModel::updateWatchOnlyFlag(bool fHaveWatchonly)
367366
Q_EMIT notifyWatchonlyChanged(fHaveWatchonly);
368367
}
369368

370-
void WalletModel::updateMultiSigFlag(bool fHaveMultiSig)
371-
{
372-
this->fHaveMultiSig = fHaveMultiSig;
373-
Q_EMIT notifyMultiSigChanged(fHaveMultiSig);
374-
}
375-
376369
bool WalletModel::getMint(const uint256& hashSerial, CZerocoinMint& mint)
377370
{
378371
return wallet->GetMint(hashSerial, mint);
@@ -845,12 +838,6 @@ static void NotifyWatchonlyChanged(WalletModel* walletmodel, bool fHaveWatchonly
845838
Q_ARG(bool, fHaveWatchonly));
846839
}
847840

848-
static void NotifyMultiSigChanged(WalletModel* walletmodel, bool fHaveMultiSig)
849-
{
850-
QMetaObject::invokeMethod(walletmodel, "updateMultiSigFlag", Qt::QueuedConnection,
851-
Q_ARG(bool, fHaveMultiSig));
852-
}
853-
854841
static void NotifyZerocoinChanged(WalletModel* walletmodel, CWallet* wallet, const std::string& hexString,
855842
const std::string& isUsed, ChangeType status)
856843
{
@@ -901,7 +888,6 @@ void WalletModel::subscribeToCoreSignals()
901888
wallet->NotifyTransactionChanged.connect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3));
902889
wallet->ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2));
903890
wallet->NotifyWatchonlyChanged.connect(boost::bind(NotifyWatchonlyChanged, this, _1));
904-
wallet->NotifyMultiSigChanged.connect(boost::bind(NotifyMultiSigChanged, this, _1));
905891
wallet->NotifyZerocoinChanged.connect(boost::bind(NotifyZerocoinChanged, this, _1, _2, _3, _4));
906892
wallet->NotifyzPIVReset.connect(boost::bind(NotifyzPIVReset, this));
907893
wallet->NotifyWalletBacked.connect(boost::bind(NotifyWalletBacked, this, _1, _2));
@@ -915,7 +901,6 @@ void WalletModel::unsubscribeFromCoreSignals()
915901
wallet->NotifyTransactionChanged.disconnect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3));
916902
wallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2));
917903
wallet->NotifyWatchonlyChanged.disconnect(boost::bind(NotifyWatchonlyChanged, this, _1));
918-
wallet->NotifyMultiSigChanged.disconnect(boost::bind(NotifyMultiSigChanged, this, _1));
919904
wallet->NotifyZerocoinChanged.disconnect(boost::bind(NotifyZerocoinChanged, this, _1, _2, _3, _4));
920905
wallet->NotifyzPIVReset.disconnect(boost::bind(NotifyzPIVReset, this));
921906
wallet->NotifyWalletBacked.disconnect(boost::bind(NotifyWalletBacked, this, _1, _2));

src/qt/walletmodel.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ class WalletModel : public QObject
309309
private:
310310
CWallet* wallet;
311311
bool fHaveWatchOnly;
312-
bool fHaveMultiSig;
313312
bool fForceCheckBalanceChanged;
314313

315314
// Wallet has an options model for wallet-specific options
@@ -370,9 +369,6 @@ class WalletModel : public QObject
370369
// Watch-only address added
371370
void notifyWatchonlyChanged(bool fHaveWatchonly);
372371

373-
// MultiSig address added
374-
void notifyMultiSigChanged(bool fHaveMultiSig);
375-
376372
// Receive tab address may have changed
377373
void notifyReceiveAddressChanged();
378374

@@ -387,8 +383,6 @@ public Q_SLOTS:
387383
void updateAddressBook(const QString &pubCoin, const QString &isUsed, int status);
388384
/* Watch-only added */
389385
void updateWatchOnlyFlag(bool fHaveWatchonly);
390-
/* MultiSig added */
391-
void updateMultiSigFlag(bool fHaveMultiSig);
392386
/* Current, immature or unconfirmed balance might have changed - emit 'balanceChanged' if so */
393387
void pollBalanceChanged();
394388
/* Update address book labels in the database */

src/wallet/wallet.cpp

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -264,36 +264,6 @@ bool CWallet::LoadWatchOnly(const CScript& dest)
264264
return CCryptoKeyStore::AddWatchOnly(dest);
265265
}
266266

267-
bool CWallet::AddMultiSig(const CScript& dest)
268-
{
269-
if (!CCryptoKeyStore::AddMultiSig(dest))
270-
return false;
271-
nTimeFirstKey = 1; // No birthday information
272-
NotifyMultiSigChanged(true);
273-
if (!fFileBacked)
274-
return true;
275-
return CWalletDB(strWalletFile).WriteMultiSig(dest);
276-
}
277-
278-
bool CWallet::RemoveMultiSig(const CScript& dest)
279-
{
280-
AssertLockHeld(cs_wallet);
281-
if (!CCryptoKeyStore::RemoveMultiSig(dest))
282-
return false;
283-
if (!HaveMultiSig())
284-
NotifyMultiSigChanged(false);
285-
if (fFileBacked)
286-
if (!CWalletDB(strWalletFile).EraseMultiSig(dest))
287-
return false;
288-
289-
return true;
290-
}
291-
292-
bool CWallet::LoadMultiSig(const CScript& dest)
293-
{
294-
return CCryptoKeyStore::AddMultiSig(dest);
295-
}
296-
297267
bool CWallet::Unlock(const SecureString& strWalletPassphrase, bool stakingOnly)
298268
{
299269
CCrypter crypter;
@@ -2075,7 +2045,7 @@ bool CWallet::AvailableCoins(std::vector<COutput>* pCoins, // --> populates
20752045

20762046
isminetype mine = IsMine(pcoin->vout[i]);
20772047
if ( (mine == ISMINE_NO) ||
2078-
((mine == ISMINE_MULTISIG || mine == ISMINE_SPENDABLE) && nWatchonlyConfig == 2) ||
2048+
(mine == ISMINE_SPENDABLE && nWatchonlyConfig == 2) ||
20792049
(mine == ISMINE_WATCH_ONLY && nWatchonlyConfig == 1) ||
20802050
(IsLockedCoin((*it).first, i) && nCoinType != ONLY_10000) ||
20812051
(pcoin->vout[i].nValue <= 0 && !fIncludeZeroValue) ||
@@ -2092,7 +2062,7 @@ bool CWallet::AvailableCoins(std::vector<COutput>* pCoins, // --> populates
20922062

20932063
bool fIsValid = (
20942064
((mine & ISMINE_SPENDABLE) != ISMINE_NO) ||
2095-
((mine & (ISMINE_MULTISIG | (fIncludeColdStaking ? ISMINE_COLD : ISMINE_NO) |
2065+
((mine & ((fIncludeColdStaking ? ISMINE_COLD : ISMINE_NO) |
20962066
(fIncludeDelegated ? ISMINE_SPENDABLE_DELEGATED : ISMINE_NO) )) != ISMINE_NO));
20972067

20982068
// found valid coin

src/wallet/wallet.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,6 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
412412
//! Adds a watch-only address to the store, without saving it to disk (used by LoadWallet)
413413
bool LoadWatchOnly(const CScript& dest);
414414

415-
//! Adds a MultiSig address to the store, and saves it to disk.
416-
bool AddMultiSig(const CScript& dest);
417-
bool RemoveMultiSig(const CScript& dest);
418-
//! Adds a MultiSig address to the store, without saving it to disk (used by LoadWallet)
419-
bool LoadMultiSig(const CScript& dest);
420-
421415
//! Lock Wallet
422416
bool Lock();
423417
bool Unlock(const SecureString& strWalletPassphrase, bool anonimizeOnly = false);
@@ -576,9 +570,6 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
576570
/** Watch-only address added */
577571
boost::signals2::signal<void(bool fHaveWatchOnly)> NotifyWatchonlyChanged;
578572

579-
/** MultiSig address added */
580-
boost::signals2::signal<void(bool fHaveMultiSig)> NotifyMultiSigChanged;
581-
582573
/** notify wallet file backed up */
583574
boost::signals2::signal<void (const bool& fSuccess, const std::string& filename)> NotifyWalletBacked;
584575

src/wallet/wallet_ismine.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,11 @@ isminetype IsMine(const CKeyStore& keystore, const CTxDestination& dest)
3535

3636
isminetype IsMine(const CKeyStore& keystore, const CScript& scriptPubKey)
3737
{
38-
if(keystore.HaveWatchOnly(scriptPubKey))
39-
return ISMINE_WATCH_ONLY;
40-
if(keystore.HaveMultiSig(scriptPubKey))
41-
return ISMINE_MULTISIG;
42-
4338
std::vector<valtype> vSolutions;
4439
txnouttype whichType;
4540
if(!Solver(scriptPubKey, whichType, vSolutions)) {
4641
if(keystore.HaveWatchOnly(scriptPubKey))
4742
return ISMINE_WATCH_ONLY;
48-
if(keystore.HaveMultiSig(scriptPubKey))
49-
return ISMINE_MULTISIG;
5043

5144
return ISMINE_NO;
5245
}
@@ -106,8 +99,6 @@ isminetype IsMine(const CKeyStore& keystore, const CScript& scriptPubKey)
10699

107100
if(keystore.HaveWatchOnly(scriptPubKey))
108101
return ISMINE_WATCH_ONLY;
109-
if(keystore.HaveMultiSig(scriptPubKey))
110-
return ISMINE_MULTISIG;
111102

112103
return ISMINE_NO;
113104
}

src/wallet/wallet_ismine.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ enum isminetype {
1818
ISMINE_NO = 0,
1919
//! Indicates that we dont know how to create a scriptSig that would solve this if we were given the appropriate private keys
2020
ISMINE_WATCH_ONLY = 1,
21-
//! Indicates that we know how to create a scriptSig that would solve this if we were given the appropriate private keys
22-
ISMINE_MULTISIG = 2,
2321
ISMINE_SPENDABLE = 4,
2422
//! Indicates that we have the staking key of a P2CS
2523
ISMINE_COLD = 8,

0 commit comments

Comments
 (0)