Skip to content

Commit

Permalink
Code for dumping all the ISLocked transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
psolstice committed Apr 27, 2024
1 parent 95622c6 commit 2fcb6de
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/llmq/quorums_instantsend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,39 @@ void CInstantSendManager::NotifyChainLock(const CBlockIndex* pindexChainLock)

void CInstantSendManager::UpdatedBlockTip(const CBlockIndex* pindexNew)
{
/*uint256 txhash;
txhash.SetHex("af274b213d1210694d6f0933ddab0c15e00f66185ed6cd93b496f578a5864905");
AskNodesForLockedTx(txhash);*/

static bool firstIteration = true;

if (firstIteration) {
FILE *f = fopen("/tmp/islock.dump", "wt");

auto it = std::unique_ptr<CDBIterator>(db.db.NewIterator());
auto firstKey = std::make_tuple(std::string("is_i"), uint256());
it->Seek(firstKey);
while (it->Valid()) {
decltype(firstKey) curKey;
if (!it->GetKey(curKey) || std::get<0>(curKey) != "is_i")
break;

CInstantSendLock islock;

if (db.db.Read(curKey, islock)) {
bool fArchived = db.HasArchivedInstantSendLock(std::get<1>(curKey));
fprintf(f, "[%c] %s:\n", fArchived ? 'A' : ' ', islock.txid.ToString().c_str());
for (auto &in: islock.inputs) {
fprintf(f, " %s:%d\n", in.hash.ToString().c_str(), (int)in.n);
}
}

it->Next();
}
fclose(f);
firstIteration = false;
}

bool fDIP0008Active = pindexNew->pprev && pindexNew->pprev->nHeight >= Params().GetConsensus().DIP0008Height;

if (fDIP0008Active && IsChainlocksEnabled()) {
Expand Down
1 change: 1 addition & 0 deletions src/llmq/quorums_instantsend.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ typedef std::shared_ptr<CInstantSendLock> CInstantSendLockPtr;

class CInstantSendDb
{
friend class CInstantSendManager;
private:
CDBWrapper& db;

Expand Down

0 comments on commit 2fcb6de

Please sign in to comment.