Skip to content

Commit 9d61734

Browse files
authored
Merge pull request #1226 from psgreco/elements-22_1_1_rc2
elements-22.1.1-rc2
2 parents eb83661 + ad10204 commit 9d61734

File tree

6 files changed

+23
-15
lines changed

6 files changed

+23
-15
lines changed

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ AC_PREREQ([2.69])
22
define(_CLIENT_VERSION_MAJOR, 22)
33
define(_CLIENT_VERSION_MINOR, 1)
44
define(_CLIENT_VERSION_BUILD, 1)
5-
define(_CLIENT_VERSION_RC, 1)
5+
define(_CLIENT_VERSION_RC, 2)
66
define(_CLIENT_VERSION_IS_RELEASE, true)
77
define(_COPYRIGHT_YEAR, 2023)
88
define(_COPYRIGHT_HOLDERS,[The %s developers])

src/chain.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ class CBlockIndex
200200
std::optional<CScriptWitness> m_signblock_witness{};
201201

202202
bool m_trimmed{false};
203+
bool m_trimmed_dynafed_block{false};
203204

204205
friend class CBlockTreeDB;
205206

@@ -210,6 +211,7 @@ class CBlockIndex
210211
void trim() {
211212
assert_untrimmed();
212213
m_trimmed = true;
214+
m_trimmed_dynafed_block = !m_dynafed_params.value().IsNull();
213215
proof = std::nullopt;
214216
m_dynafed_params = std::nullopt;
215217
m_signblock_witness = std::nullopt;
@@ -228,6 +230,13 @@ class CBlockIndex
228230
return proof.value();
229231
}
230232

233+
const bool dynafed_block() const {
234+
if (m_trimmed) {
235+
return m_trimmed_dynafed_block;
236+
}
237+
return !m_dynafed_params.value().IsNull();
238+
}
239+
231240
const DynaFedParams& dynafed_params() const {
232241
assert_untrimmed();
233242
return m_dynafed_params.value();

src/qt/sendcoinsdialog.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -777,21 +777,25 @@ void SendCoinsDialog::useAvailableBalance(SendCoinsEntry* entry)
777777
// Include watch-only for wallets without private key
778778
m_coin_control->fAllowWatchOnly = model->wallet().privateKeysDisabled() && !model->wallet().hasExternalSigner();
779779

780+
SendAssetsRecipient recipient = entry->getValue();
780781
// Calculate available amount to send.
781-
CAmount amount = valueFor(model->wallet().getAvailableBalance(*m_coin_control), ::policyAsset);
782+
CAmount amount = valueFor(model->wallet().getAvailableBalance(*m_coin_control), recipient.asset);
782783
for (int i = 0; i < ui->entries->count(); ++i) {
783784
SendCoinsEntry* e = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
784-
if (e && !e->isHidden() && e != entry) {
785+
if (e && !e->isHidden() && e != entry && e->getValue().asset == recipient.asset) {
785786
amount -= e->getValue().asset_amount;
786787
}
787788
}
788789

789790
if (amount > 0) {
790-
entry->checkSubtractFeeFromAmount();
791-
entry->setAmount(amount);
791+
if (recipient.asset == ::policyAsset) {
792+
entry->checkSubtractFeeFromAmount();
793+
}
794+
recipient.asset_amount = amount;
792795
} else {
793-
entry->setAmount(0);
796+
recipient.asset_amount = 0;
794797
}
798+
entry->setValue(recipient);
795799
}
796800

797801
void SendCoinsDialog::updateFeeSectionControls()

src/rpc/blockchain.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ UniValue blockheaderToJSON(const CBlockIndex* tip, const CBlockIndex* blockindex
248248
result.pushKV("difficulty", GetDifficulty(blockindex));
249249
result.pushKV("chainwork", blockindex->nChainWork.GetHex());
250250
} else {
251-
if (blockindex->dynafed_params().IsNull()) {
251+
if (!blockindex->dynafed_block()) {
252252
if (blockindex->trimmed()) {
253253
result.pushKV("signblock_witness_asm", "<trimmed>");
254254
result.pushKV("signblock_witness_hex", "<trimmed>");
@@ -280,13 +280,7 @@ UniValue blockheaderToJSON(const CBlockIndex* tip, const CBlockIndex* blockindex
280280

281281
UniValue blockToJSON(const CBlock& block, const CBlockIndex* tip, const CBlockIndex* blockindex, bool txDetails)
282282
{
283-
UniValue result;
284-
if (blockindex->trimmed()) {
285-
CBlockIndex tmp = CBlockIndex(block.GetBlockHeader());
286-
result = blockheaderToJSON(tip, &tmp);
287-
} else {
288-
result = blockheaderToJSON(tip, blockindex);
289-
}
283+
UniValue result = blockheaderToJSON(tip, blockindex);
290284

291285
result.pushKV("strippedsize", (int)::GetSerializeSize(block, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS));
292286
result.pushKV("size", (int)::GetSerializeSize(block, PROTOCOL_VERSION));

src/rpc/mining.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,7 @@ static RPCHelpMan testproposedblock()
17161716
"\nChecks a block proposal for validity, and that it extends chaintip\n",
17171717
{
17181718
{"blockhex", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex-encoded block from getnewblockhex"},
1719-
{"acceptnonstd", RPCArg::Type::BOOL, RPCArg::Optional::OMITTED_NAMED_ARG, "If set false, returns error if block contains non-standard transaction. Default is set via `-acceptnonstdtxn`. If PAK enforcement is set, block commitment mismatches with configuration PAK lists are rejected as well."},
1719+
{"acceptnonstd", RPCArg::Type::BOOL, RPCArg::Optional::OMITTED_NAMED_ARG, "If set false, returns error if block contains non-standard transaction. Default is set via `-acceptnonstdtxn`."},
17201720
},
17211721
RPCResult{RPCResult::Type::NONE, "", ""},
17221722
RPCExamples{

src/txdb.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams,
389389
}
390390
} else {
391391
pindexNew->m_trimmed = true;
392+
pindexNew->m_trimmed_dynafed_block = !diskindex.m_dynafed_params.value().IsNull();
392393
}
393394

394395
pcursor->Next();

0 commit comments

Comments
 (0)