Esempio n. 1
0
        public void TransactionCreated(int cycleId, TransactionType type, uint256 txId, CorrelationId correlation)
        {
            var record = new TrackerRecord()
            {
                Cycle           = cycleId,
                RecordType      = RecordType.Transaction,
                TransactionType = type,
                TransactionId   = txId,
                Correlation     = correlation,
            };

            bool isNew = true;

            //The
            var uniqueKey = NBitcoin.Crypto.Hashes.Hash256(txId.ToBytes().Concat(correlation.ToBytes()).ToArray()).GetLow64();

            _Repo.UpdateOrInsert(GetCyclePartition(cycleId), uniqueKey.ToString(), record, (a, b) =>
            {
                isNew = false;
                return(b);
            });
            _Repo.UpdateOrInsert("Search", "t:" + txId.ToString(), cycleId, (a, b) => b);

            if (isNew)
            {
                Logs.Tracker.LogInformation($"Tracking transaction {type} of cycle {cycleId} with correlation {correlation.ToString(false)} ({txId})");
            }
        }
Esempio n. 2
0
        public void AddressCreated(int cycleId, TransactionType type, Script scriptPubKey, CorrelationId correlation)
        {
            var record = new TrackerRecord()
            {
                Cycle           = cycleId,
                RecordType      = RecordType.ScriptPubKey,
                TransactionType = type,
                ScriptPubKey    = scriptPubKey,
                Correlation     = correlation
            };

            bool isNew = true;

            _Repo.UpdateOrInsert(GetCyclePartition(cycleId), Rand(), record, (a, b) =>
            {
                isNew = false;
                return(b);
            });
            _Repo.UpdateOrInsert("Search", "t:" + scriptPubKey.Hash.ToString(), cycleId, (a, b) => b);

            if (isNew)
            {
                Logs.Tracker.LogInformation($"Tracking address {type} of cycle {cycleId} with correlation {correlation.ToString(false)} ({scriptPubKey.GetDestinationAddress(Network)})");
            }
        }
Esempio n. 3
0
        public void TransactionCreated(int cycleId, TransactionType type, uint256 txId, CorrelationId correlation)
        {
            var record = new TrackerRecord()
            {
                Cycle           = cycleId,
                RecordType      = RecordType.Transaction,
                TransactionType = type,
                TransactionId   = txId,
                Correlation     = correlation,
            };

            bool isNew = true;

            _Repo.UpdateOrInsert(GetCyclePartition(cycleId), txId.GetLow64().ToString(), record, (a, b) =>
            {
                isNew = false;
                return(b);
            });
            _Repo.UpdateOrInsert("Search", "t:" + txId.ToString(), cycleId, (a, b) => b);

            if (isNew)
            {
                Logs.Tracker.LogInformation($"Tracking transaction {type} of cycle {cycleId} with correlation {correlation} ({txId})");
            }
        }