Example #1
0
  virtual void edge(
    uint64_t       value,
    const uint8_t *upTXHash,
    uint64_t       outputIndex,
    const uint8_t *outputScript,
    uint64_t       outputScriptSize,
    const uint8_t *downTXHash,
    uint64_t       inputIndex,
    const uint8_t *inputScript,
    uint64_t       inputScriptSize
    ) {
    uint256_t h;
    uint32_t  oi = outputIndex;

    memcpy(h.v, upTXHash, kSHA256ByteSize);

    uintptr_t ih  = reinterpret_cast<uintptr_t>(h.v);
    uint32_t *h32 = reinterpret_cast<uint32_t *>(ih);
    h32[0] ^= oi;

    auto src = outputMap.find(h.v);

    if (outputMap.end() == src) {
      errFatal("unconnected input");
    }

    if (blkID >= firstBlock) {
      fprintf(
        inputFile,
        "%" PRIu64 "|"
        "%" PRIu64 "|"
        "%" PRIu64 "|"
        "%" PRIu32 "\n"
        ,
        inputID++,
        src->second,
        txID,
        (uint32_t)inputIndex
        );
    } else {
      inputID++;
    }
  }
Example #2
0
    virtual void edge(
        uint64_t      value,
        const uint8_t *upTXHash,
        uint64_t      outputIndex,
        const uint8_t *outputScript,
        uint64_t      outputScriptSize,
        const uint8_t *downTXHash,
        uint64_t      inputIndex,
        const uint8_t *inputScript,
        uint64_t      inputScriptSize
    )
    {
        uint256_t h;
        uint32_t oi = outputIndex;
        memcpy(h.v, upTXHash, kSHA256ByteSize);

        uintptr_t ih = reinterpret_cast<uintptr_t>(h.v);
        uint32_t *h32 = reinterpret_cast<uint32_t*>(ih);
        h32[0] ^= oi;

        auto src = outputMap.find(h.v);
        if(outputMap.end()==src) errFatal("unconnected input");

        // id BIGINT PRIMARY KEY
        // outputID BIGINT
        // txID BIGINT
        // offset INT
        fprintf(
            inputFile,
            "%" PRIu64 "\t"
            "%" PRIu64 "\t"
            "%" PRIu64 "\t"
            "%" PRIu32 "\n"
            ,
            inputID++,
            src->second,
            txID,
            (uint32_t)outputIndex
        );
    }