Skip to content

Commit 87393b9

Browse files
Merge branch 'develop' of https://github.com/dashpay/dash into develop
2 parents f43da65 + 67b2153 commit 87393b9

File tree

6 files changed

+26
-7
lines changed

6 files changed

+26
-7
lines changed

doc/release-notes-6607.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Updated RPCs
2+
------------
3+
4+
* `getislocks` will now return request `id` for each InstantSend Lock in results

src/qt/bitcoingui.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,10 @@ void BitcoinGUI::setWalletController(WalletController* wallet_controller)
899899

900900
GUIUtil::ExceptionSafeConnect(wallet_controller, &WalletController::walletAdded, this, &BitcoinGUI::addWallet);
901901
connect(wallet_controller, &WalletController::walletRemoved, this, &BitcoinGUI::removeWallet);
902+
connect(wallet_controller, &WalletController::destroyed, this, [this] {
903+
// wallet_controller gets destroyed manually, but it leaves our member copy dangling
904+
m_wallet_controller = nullptr;
905+
});
902906

903907
auto activity = new LoadWalletsActivity(m_wallet_controller, this);
904908
activity->load();
@@ -911,7 +915,7 @@ WalletController* BitcoinGUI::getWalletController()
911915

912916
void BitcoinGUI::addWallet(WalletModel* walletModel)
913917
{
914-
if (!walletFrame) return;
918+
if (!walletFrame || !m_wallet_controller) return;
915919

916920
WalletView* wallet_view = new WalletView(walletModel, walletFrame);
917921
if (!walletFrame->addView(wallet_view)) return;
@@ -959,7 +963,7 @@ void BitcoinGUI::removeWallet(WalletModel* walletModel)
959963

960964
void BitcoinGUI::setCurrentWallet(WalletModel* wallet_model)
961965
{
962-
if (!walletFrame) return;
966+
if (!walletFrame || !m_wallet_controller) return;
963967
walletFrame->setCurrentWallet(wallet_model);
964968
for (int index = 0; index < m_wallet_selector->count(); ++index) {
965969
if (m_wallet_selector->itemData(index).value<WalletModel*>() == wallet_model) {

src/qt/sendcoinsdialog.cpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -604,10 +604,15 @@ SendCoinsEntry *SendCoinsDialog::addEntry()
604604
entry->clear();
605605
entry->setFocus();
606606
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->sizeHint());
607-
qApp->processEvents();
608-
QScrollBar* bar = ui->scrollArea->verticalScrollBar();
609-
if(bar)
610-
bar->setSliderPosition(bar->maximum());
607+
608+
// Scroll to the newly added entry on a QueuedConnection because Qt doesn't
609+
// adjust the scroll area and scrollbar immediately when the widget is added.
610+
// Invoking on a DirectConnection will only scroll to the second-to-last entry.
611+
QMetaObject::invokeMethod(ui->scrollArea, [this] {
612+
if (ui->scrollArea->verticalScrollBar()) {
613+
ui->scrollArea->verticalScrollBar()->setValue(ui->scrollArea->verticalScrollBar()->maximum());
614+
}
615+
}, Qt::QueuedConnection);
611616

612617
updateTabsAndLabels();
613618
return entry;

src/qt/test/wallettests.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ void TestGUI(interfaces::Node& node)
163163
QCOMPARE(transactionTableModel->rowCount({}), 105);
164164
uint256 txid1 = SendCoins(*wallet.get(), sendCoinsDialog, PKHash(), 5 * COIN);
165165
uint256 txid2 = SendCoins(*wallet.get(), sendCoinsDialog, PKHash(), 10 * COIN);
166+
// Transaction table model updates on a QueuedConnection, so process events to ensure it's updated.
167+
qApp->processEvents();
166168
QCOMPARE(transactionTableModel->rowCount({}), 107);
167169
QVERIFY(FindTx(*transactionTableModel, txid1).isValid());
168170
QVERIFY(FindTx(*transactionTableModel, txid2).isValid());

src/rpc/rawtransaction.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ static RPCHelpMan getislocks()
387387
},
388388
},
389389
}},
390+
{RPCResult::Type::STR_HEX, "id", "Request ID"},
390391
{RPCResult::Type::STR_HEX, "cycleHash", "The Cycle Hash"},
391392
{RPCResult::Type::STR_HEX, "signature", "The InstantSend's BLS signature"},
392393
{RPCResult::Type::STR_HEX, "hex", "The serialized, hex-encoded data for 'txid'"},
@@ -424,6 +425,7 @@ static RPCHelpMan getislocks()
424425
inputs.push_back(outpoint);
425426
}
426427
objIS.pushKV("inputs", inputs);
428+
objIS.pushKV("id", islock->GetRequestId().ToString());
427429
objIS.pushKV("cycleHash", islock->cycleHash.ToString());
428430
objIS.pushKV("signature", islock->sig.ToString());
429431
{

test/functional/rpc_verifyislock.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from test_framework.messages import CTransaction, from_hex, hash256, ser_compact_size, ser_string
77
from test_framework.test_framework import DashTestFramework
8-
from test_framework.util import assert_raises_rpc_error, satoshi_round
8+
from test_framework.util import assert_equal, assert_raises_rpc_error, satoshi_round
99

1010
'''
1111
rpc_verifyislock.py
@@ -41,6 +41,8 @@ def run_test(self):
4141
self.wait_for_instantlock(txid, node)
4242

4343
request_id = self.get_request_id(self.nodes[0].getrawtransaction(txid))
44+
request_id_rpc = self.nodes[0].getislocks([txid])[0]["id"]
45+
assert_equal(request_id, request_id_rpc)
4446
self.wait_until(lambda: node.quorum("hasrecsig", 103, request_id, txid))
4547

4648
rec_sig = node.quorum("getrecsig", 103, request_id, txid)['sig']

0 commit comments

Comments
 (0)