Skip to content

Commit

Permalink
Add NamespaceIndentation
Browse files Browse the repository at this point in the history
  • Loading branch information
prasannavl committed Oct 31, 2023
1 parent cc97b20 commit bf16f01
Show file tree
Hide file tree
Showing 13 changed files with 1,769 additions and 1,754 deletions.
2 changes: 1 addition & 1 deletion src/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ LambdaBodyIndentation: Signature
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
NamespaceIndentation: All
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
Expand Down
32 changes: 16 additions & 16 deletions src/dfi/anchors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1161,24 +1161,24 @@ bool GetAnchorEmbeddedData(const CKeyID &data,
}

namespace spv {
const PendingOrderType PendingOrder =
PendingOrderType([](const CAnchorIndex::AnchorRec &a, const CAnchorIndex::AnchorRec &b) {
if (a.btcHeight == b.btcHeight) {
if (a.anchor.height == b.anchor.height) {
if (a.anchor.height >= static_cast<THeight>(Params().GetConsensus().DF8EunosHeight)) {
const auto blockHash = panchors->ReadBlockHash(a.btcHeight);
auto aHash = Hash(a.txHash.begin(), a.txHash.end(), blockHash.begin(), blockHash.end());
auto bHash = Hash(b.txHash.begin(), b.txHash.end(), blockHash.begin(), blockHash.end());
return aHash < bHash;
const PendingOrderType PendingOrder =
PendingOrderType([](const CAnchorIndex::AnchorRec &a, const CAnchorIndex::AnchorRec &b) {
if (a.btcHeight == b.btcHeight) {
if (a.anchor.height == b.anchor.height) {
if (a.anchor.height >= static_cast<THeight>(Params().GetConsensus().DF8EunosHeight)) {
const auto blockHash = panchors->ReadBlockHash(a.btcHeight);
auto aHash = Hash(a.txHash.begin(), a.txHash.end(), blockHash.begin(), blockHash.end());
auto bHash = Hash(b.txHash.begin(), b.txHash.end(), blockHash.begin(), blockHash.end());
return aHash < bHash;
}

return a.txHash < b.txHash;
}

return a.txHash < b.txHash;
// Higher DeFi comes first
return a.anchor.height > b.anchor.height;
}

// Higher DeFi comes first
return a.anchor.height > b.anchor.height;
}

return a.btcHeight < b.btcHeight;
});
return a.btcHeight < b.btcHeight;
});
}
14 changes: 7 additions & 7 deletions src/dfi/anchors.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ class CKey;
class CPubkey;

namespace spv {
class CSpvWrapper;
struct BtcAnchorTx;
class CSpvWrapper;
struct BtcAnchorTx;
} // namespace spv

namespace Consensus {
struct Params;
struct Params;
}

typedef uint32_t THeight; // cause not decided yet which type to use for heights
Expand Down Expand Up @@ -499,10 +499,10 @@ extern std::unique_ptr<CAnchorIndex> panchors;
extern std::unique_ptr<CAnchorAwaitingConfirms> panchorAwaitingConfirms;

namespace spv {
// Define comparator and set to hold pending anchors
using PendingOrderType = std::function<bool(const CAnchorIndex::AnchorRec &, const CAnchorIndex::AnchorRec &)>;
using PendingSet = std::set<CAnchorIndex::AnchorRec, PendingOrderType>;
extern const PendingOrderType PendingOrder;
// Define comparator and set to hold pending anchors
using PendingOrderType = std::function<bool(const CAnchorIndex::AnchorRec &, const CAnchorIndex::AnchorRec &)>;
using PendingSet = std::set<CAnchorIndex::AnchorRec, PendingOrderType>;
extern const PendingOrderType PendingOrder;
} // namespace spv

#endif // DEFI_DFI_ANCHORS_H
12 changes: 6 additions & 6 deletions src/dfi/consensus/txvisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class CVaultAssets;
class TransactionContext;

namespace Consensus {
struct Params;
struct Params;
}

enum AuthStrategy : uint32_t {
Expand All @@ -35,11 +35,11 @@ enum AuthStrategy : uint32_t {
};

namespace AuthFlags {
enum Type : uint32_t {
None = 0,
Bech32InSource = 1 << 1,
PKHashInSource = 1 << 2,
};
enum Type : uint32_t {
None = 0,
Bech32InSource = 1 << 1,
PKHashInSource = 1 << 2,
};
}

Res HasAuth(const CTransaction &tx,
Expand Down
2 changes: 1 addition & 1 deletion src/dfi/govvariables/attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <dfi/oracles.h>

namespace Consensus {
struct Params;
struct Params;
}

enum VersionTypes : uint8_t {
Expand Down
Loading

0 comments on commit bf16f01

Please sign in to comment.