Skip to content

Commit 56ac184

Browse files
fmt: apply clang-format suggestions
1 parent e18f621 commit 56ac184

File tree

2 files changed

+20
-27
lines changed

2 files changed

+20
-27
lines changed

src/evo/deterministicmns.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,8 @@ void CDeterministicMNList::RemoveMN(const uint256& proTxHash)
578578
throw(std::runtime_error(strprintf("%s: Can't delete a masternode %s with a keyIDOwner=%s", __func__,
579579
proTxHash.ToString(), EncodeDestination(PKHash(dmn->pdmnState->keyIDOwner)))));
580580
}
581-
if (dmn->pdmnState->pubKeyOperator != CBLSLazyPublicKey() && !DeleteUniqueProperty(*dmn, dmn->pdmnState->pubKeyOperator)) {
581+
if (dmn->pdmnState->pubKeyOperator != CBLSLazyPublicKey() &&
582+
!DeleteUniqueProperty(*dmn, dmn->pdmnState->pubKeyOperator)) {
582583
mnUniquePropertyMap = mnUniquePropertyMapSaved;
583584
throw(std::runtime_error(strprintf("%s: Can't delete a masternode %s with a pubKeyOperator=%s", __func__,
584585
proTxHash.ToString(), dmn->pdmnState->pubKeyOperator.ToString())));
@@ -840,7 +841,8 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, gsl::no
840841
}
841842
if (newState->IsBanned()) {
842843
// only revive when all keys are set
843-
if (newState->pubKeyOperator != CBLSLazyPublicKey() && !newState->keyIDVoting.IsNull() && !newState->keyIDOwner.IsNull()) {
844+
if (newState->pubKeyOperator != CBLSLazyPublicKey() && !newState->keyIDVoting.IsNull() &&
845+
!newState->keyIDOwner.IsNull()) {
844846
newState->Revive(nHeight);
845847
if (debugLogs) {
846848
LogPrintf("CDeterministicMNManager::%s -- MN %s revived at height %d\n",

src/test/bls_tests.cpp

+16-25
Original file line numberDiff line numberDiff line change
@@ -473,43 +473,36 @@ BOOST_AUTO_TEST_CASE(bls_threshold_signature_tests)
473473
}
474474

475475
// A dummy BLS object that satisfies the minimal interface expected by CBLSLazyWrapper.
476-
class DummyBLS {
476+
class DummyBLS
477+
{
477478
public:
478479
// Define a fixed serialization size (for testing purposes).
479480
static const size_t SerSize = 4;
480481
std::array<uint8_t, SerSize> data{};
481482

482-
DummyBLS() {
483-
data.fill(0);
484-
}
483+
DummyBLS() { data.fill(0); }
485484

486485
// A dummy validity check: valid if any byte is non-zero.
487-
bool IsValid() const {
488-
return std::any_of(data.begin(), data.end(), [](uint8_t c){ return c != 0; });
486+
bool IsValid() const
487+
{
488+
return std::any_of(data.begin(), data.end(), [](uint8_t c) { return c != 0; });
489489
}
490490

491491
// Convert to bytes; ignore the legacy flag for simplicity.
492-
std::array<uint8_t, SerSize> ToBytes(bool /*legacy*/) const {
493-
return data;
494-
}
492+
std::array<uint8_t, SerSize> ToBytes(bool /*legacy*/) const { return data; }
495493

496494
// Set from bytes; again, ignore the legacy flag.
497-
void SetBytes(const std::array<uint8_t, SerSize>& bytes, bool /*legacy*/) {
498-
data = bytes;
499-
}
495+
void SetBytes(const std::array<uint8_t, SerSize>& bytes, bool /*legacy*/) { data = bytes; }
500496

501497
// A dummy malleability check: simply compares the stored data to the given bytes.
502-
bool CheckMalleable(const std::array<uint8_t, SerSize>& bytes, bool /*legacy*/) const {
503-
return data == bytes;
504-
}
498+
bool CheckMalleable(const std::array<uint8_t, SerSize>& bytes, bool /*legacy*/) const { return data == bytes; }
505499

506500
// Reset the object to an "empty" state.
507-
void Reset() {
508-
data.fill(0);
509-
}
501+
void Reset() { data.fill(0); }
510502

511503
// Produce a string representation.
512-
std::string ToString(bool /*legacy*/) const {
504+
std::string ToString(bool /*legacy*/) const
505+
{
513506
std::ostringstream oss;
514507
for (auto b : data) {
515508
oss << std::setfill('0') << std::setw(2) << std::hex << static_cast<int>(b);
@@ -518,9 +511,7 @@ class DummyBLS {
518511
}
519512

520513
// Equality operator.
521-
bool operator==(const DummyBLS& other) const {
522-
return data == other.data;
523-
}
514+
bool operator==(const DummyBLS& other) const { return data == other.data; }
524515
};
525516

526517
// Define a type alias for our lazy wrapper instantiated with DummyBLS.
@@ -541,7 +532,7 @@ BOOST_AUTO_TEST_CASE(test_non_default_vs_default)
541532
LazyDummyBLS lazy_default;
542533
LazyDummyBLS lazy_set;
543534
DummyBLS obj;
544-
obj.data = {1, 2, 3, 4}; // nonzero data makes the object valid
535+
obj.data = {1, 2, 3, 4}; // nonzero data makes the object valid
545536
lazy_set.Set(obj, false);
546537
BOOST_CHECK(!(lazy_default == lazy_set));
547538
BOOST_CHECK(lazy_default != lazy_set);
@@ -553,9 +544,9 @@ BOOST_AUTO_TEST_CASE(test_non_default_vs_different)
553544
LazyDummyBLS lazy_a;
554545
LazyDummyBLS lazy_b;
555546
DummyBLS obj;
556-
obj.data = {1, 2, 3, 4}; // nonzero data makes the object valid
547+
obj.data = {1, 2, 3, 4}; // nonzero data makes the object valid
557548
lazy_a.Set(obj, false);
558-
obj.data = {4, 3, 2, 1}; // nonzero data makes the object valid
549+
obj.data = {2, 2, 3, 4}; // nonzero data makes the object valid
559550
lazy_b.Set(obj, false);
560551
BOOST_CHECK(lazy_a != lazy_b);
561552
}

0 commit comments

Comments
 (0)