void ZeroConfContainer::addRawTx(const BinaryData& rawTx, uint32_t txtime) { /*** Saves new ZC by txtime. txtime will always be unique, as it is grabbed locally and the protocol enforces a limit of 7 Tx per seconds, guaranteeing sufficient time granularity. ***/ if (enabled_ == false) return; //convert raw ZC to a Tx object BinaryData ZCkey = getNewZCkey(); Tx zcTx(rawTx); zcTx.setTxTime(txtime); unique_lock<mutex> lock(mu_); newZCMap_[ZCkey] = zcTx; }
void ZeroConfContainer::addRawTx(const BinaryData& rawTx, uint32_t txtime) { /*** Saves new ZC by txtime. txtime will always be unique, as it is grabbed locally and the protocol enforces a limit of 7 Tx per seconds, guaranteeing sufficient time granularity. ***/ if (enabled_ == false) return; //convert raw ZC to a Tx object BinaryData ZCkey = getNewZCkey(); Tx zcTx(rawTx); zcTx.setTxTime(txtime); //grab container lock while (lock_.fetch_or(1, memory_order_acquire)); newZCMap_[ZCkey] = zcTx; //release lock lock_.store(0, memory_order_release); }