mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-29 13:32:33 +02:00
Merge wallet_avoid_newerchange
This commit is contained in:
commit
bacea8923d
@ -20,6 +20,7 @@ std::unique_ptr<CWallet> CreateSyncedWallet(interfaces::Chain& chain, CChain& cc
|
|||||||
{
|
{
|
||||||
LOCK2(wallet->cs_wallet, ::cs_main);
|
LOCK2(wallet->cs_wallet, ::cs_main);
|
||||||
wallet->SetLastBlockProcessed(cchain.Height(), cchain.Tip()->GetBlockHash());
|
wallet->SetLastBlockProcessed(cchain.Height(), cchain.Tip()->GetBlockHash());
|
||||||
|
wallet->m_default_address_type = OutputType::BECH32M;
|
||||||
}
|
}
|
||||||
wallet->LoadWallet();
|
wallet->LoadWallet();
|
||||||
{
|
{
|
||||||
|
@ -2327,7 +2327,7 @@ OutputType CWallet::TransactionChangeType(const std::optional<OutputType>& chang
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bool has_bech32m_spkman(GetScriptPubKeyMan(OutputType::BECH32M, /*internal=*/true));
|
const bool has_bech32m_spkman(GetScriptPubKeyMan(OutputType::BECH32M, /*internal=*/true));
|
||||||
if (has_bech32m_spkman && any_tr) {
|
if (has_bech32m_spkman && any_tr && m_default_address_type == OutputType::BECH32M) {
|
||||||
// Currently tr is the only type supported by the BECH32M spkman
|
// Currently tr is the only type supported by the BECH32M spkman
|
||||||
return OutputType::BECH32M;
|
return OutputType::BECH32M;
|
||||||
}
|
}
|
||||||
@ -2347,6 +2347,16 @@ OutputType CWallet::TransactionChangeType(const std::optional<OutputType>& chang
|
|||||||
// Currently pkh is the only type supported by the LEGACY spkman
|
// Currently pkh is the only type supported by the LEGACY spkman
|
||||||
return OutputType::LEGACY;
|
return OutputType::LEGACY;
|
||||||
}
|
}
|
||||||
|
if (!GetScriptPubKeyMan(m_default_address_type, /*internal=*/true)) {
|
||||||
|
// Default type not available, so look for anything else to fallback to
|
||||||
|
// NOTE: Sane behaviour assumes OUTPUT_TYPES is sorted oldest to newest
|
||||||
|
for (const auto& ot : OUTPUT_TYPES) {
|
||||||
|
if (GetScriptPubKeyMan(ot, /*internal=*/true)) {
|
||||||
|
return ot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m_default_address_type;
|
||||||
|
|
||||||
if (has_bech32m_spkman) {
|
if (has_bech32m_spkman) {
|
||||||
return OutputType::BECH32M;
|
return OutputType::BECH32M;
|
||||||
|
@ -194,6 +194,8 @@ class WalletTaprootTest(BitcoinTestFramework):
|
|||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.extra_args = [['-keypool=100'], ['-keypool=100']]
|
self.extra_args = [['-keypool=100'], ['-keypool=100']]
|
||||||
|
for ea in self.extra_args:
|
||||||
|
ea.append('-addresstype=bech32m')
|
||||||
self.supports_cli = False
|
self.supports_cli = False
|
||||||
|
|
||||||
def skip_test_if_missing_module(self):
|
def skip_test_if_missing_module(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user