Closed younicoin closed 8 months ago
I noted that error occurs after invoking MigrateSettings() and exactly in line 553 of src/qt/bitcoin.cpp const QStringList legacyKeys(legacy.allKeys());
So, using QStringList containing elemenrs of class BitcoinUnits::Unit is wrong. This is wrong, because we run BitcoinThread in a strange way : with pointer to another Qt thread. This us why needs to check this process to be sure BitcoinUnits::Unit registered as MetaType, as QVariant requires.
Thanks for the report, we will look into this
Adding one line to src/qt/bitcoin.cpp
qRegisterMetaType<Config *>();
+ qRegisterMetaType<BitcoinUnits::Unit>("BitcoinUnits::Unit");
I compiled and got an error ./src/qt/bitcoin-qt QVariant::load: unable to load type 1038.
this error might happen here src/qt/bitcoin.cpp const QStringList legacyKeys(legacy.allKeys()); https://github.com/Bitcoin-ABC/bitcoin-abc/blob/0886c422af1e55749eb923f85e816629344487c7/src/qt/bitcoin.cpp#L644
Some people say in internet, that need to use QVariantList instead of QList, but making so I got error:
qt/bitcoinunits.h:52:12: error: ‘QVariantList’ {aka ‘QList
’} is not a template 52 | static QVariantList availableUnits();
replacing line https://github.com/Bitcoin-ABC/bitcoin-abc/blob/0886c422af1e55749eb923f85e816629344487c7/src/qt/bitcoin.cpp#L644
with this:
const QStringList legacyKeys;
so I just created empty variable. This solved issue. But I dont know what that variable use for and what actually it should contain. But the call off legacy.allKeys()
works bad and need to dig there
I added some debug lines and watched that variable legacyKeys:
vim src/qt/bitcoin.cpp 72:#include
575:const QStringList legacyKeys(legacy.allKeys()); //const QStringList legacyKeys; qDebug() << legacyKeys; ninja ./src/qt/bitcoin-qt QVariant::load: unknown user type with name BitcoinUnits::Unit. ("DisplayBitcoinUnit", "MainWindowGeometry", "PeersTabBanlistHeaderState", "PeersTabPeerHeaderState", "RPCConsoleWindowGeometry", "RPCConsoleWindowPeersTabSplitterSizes", "RecentRequestsViewHeaderState", "SubFeeFromAmount", "TransactionViewHeaderState", "UseEmbeddedMonospacedFont", "enable_psbt_controls", "fCoinControlFeatures", "fFeeSectionMinimized", "fHideTrayIcon", "fMinimizeOnClose", "fMinimizeToTray", "fReset", "fRestartRequired", "mask_values", "nConfTarget", "nFeeRadio", "nSettingsVersion", "nSmartFeeSliderPosition", "nTransactionFee", "strDataDir", "strThirdPartyTxUrls")
As I can consume, this is used on ios and macos and may be some other operating systems for translation and may be some other functions, but the main is translation, and this is why we list all words for you can translate it if you want.
This is useful, but gives error now. So, it is fine to stop call legacy.allKeys()
that causes the error
QVariant::load: unknown user type with name BitcoinUnits::Unit.
or if i become Pro today i will somehow register class BitcoinUnits::Unit in bitcoin.cpp
I just brainstormed this part and concreted this
It is likely that the MigrateSettings
function is no longer necessary. It was introduced for users upgrading from v0.14.6 to a newer version, and this is now very unlikely to happen as an upgrade has been mandatory every 6 months for more than 6 years. We are currently at 0.28.11
i'll have a look at this tomorrow, and remove that entire codepath if possible.
Thanks for the investigation.
should be fixed by D15682
hello. yes, built and run without warnings.
mkdir bitcoin-abc-2024-03-12
cd bitcoin-abc-2024-03-12/
git clone https://github.com/Bitcoin-ABC/bitcoin-abc.git
cd bitcoin-abc
mkdir build && cd build
cmake -GNinja ..
ninja
[130/543] Generating bitcoin_tr.qm
Removed plural forms as the target language has less forms.
If this sounds wrong, possibly the target language is not set or recognized.
[212/543] Building native src/secp256k1/gen_context
[2/2] Linking C executable src/secp256k1/gen_context
[543/543] Linking CXX executable src/qt/bitcoin-qt
./src/qt/bitcoin-qt
##no warnings
Hello, I built Bitcoin-ABC on Devuan Linux, g++ version 12.2, qt version 5.15.8. I see this message in terminal on every start:
Actually, wallet works, but I think it would be great to make it completely fine. And I started to dig. I found the reason here https://doc.qt.io/qt-5/qvariant.html
and here https://doc.qt.io/qt-6/qvariant.html
I tried to solve this editing src/qt/bitcoingui.cpp, src/qt/bitcoinunits.cpp, but my debug messages are shown after that error, so, the error occurs before includes of src/qt/bitcoingui.cpp, src/qt/bitcoinunits.cpp, and I think that error message appears in early start of thread here src/qt/bitcoin.cpp. I saw the comment here src/qt/bitcoin.cpp :
I think, developers had some headache with QVariant, trying to register new type before it actually declared? Is that type BitcoinUnits::Unit should be registered before starting coreThread->start()? Finally, they could not hack it, and error message still appears. Could you note that issue again and continue to solve that?