Beispiel #1
0
    virtual void startInput(
        const uint8_t *p
    )
    {
        if(dump) {
            printf(
                "    input[%" PRIu64 "] = {\n\n",
                nbInputs++
            );

            static uint256_t gNullHash;
            LOAD(uint256_t, upTXHash, p);
            LOAD(uint32_t, upOutputIndex, p);
            LOAD_VARINT(inputScriptSize, p);
            isGenTX = (0==memcmp(gNullHash.v, upTXHash.v, sizeof(gNullHash)));
            if(isGenTX) {
                //uint64_t reward = getBaseReward(currBlock);
                printf("        generation transaction\n");
                //printf("        proof of work block reward:, reward = %.8f\n", 1e-6*reward);
                printf("        hex dump of coinbase follows:\n\n");
                canonicalHexDump(p, inputScriptSize, "        ");
                //valueIn += reward;
            }
        }
    }
Beispiel #2
0
    virtual void startInput(
        const uint8_t *p
    ) {
        if(dump) {
            printf(
                "    input[%" PRIu64 "] = {\n\n",
                nbInputs++
            );

            static uint256_t gNullHash;
            LOAD(uint256_t, upTXHash, p);
            LOAD(uint32_t, upOutputIndex, p);
            LOAD_VARINT(inputScriptSize, p);
            showScript(p, inputScriptSize, 0, "        ");

            isGenTX = (0==memcmp(gNullHash.v, upTXHash.v, sizeof(gNullHash)));
            if(isGenTX) {
                uint64_t reward = getBaseReward(currBlock);
                printf("        generation transaction\n");
                printf("        based on block height, reward = %.8f\n", satoshisToNormaForm(reward));
                printf("        hex dump of coinbase follows:\n\n");
                canonicalHexDump(p, inputScriptSize, "        ");
                valueIn += reward;
            }
        }
    }
Beispiel #3
0
 virtual void endOutputs(
     const uint8_t *p
 ) {
     #if defined(CLAM)
         if(1<txVersion) {
             LOAD_VARINT(strCLAMSpeechLen, p);
             printf("    comment = '\n");
                 canonicalHexDump(
                     p,
                     strCLAMSpeechLen,
                     "    "
                 );
             printf("'\n");
         }
     #endif
 }
Beispiel #4
0
    // Called when a TX input is encountered
    virtual void startInput(
        const uint8_t *p
    ) {
        printf(
            "%sinput%d = {\n",
            spaces,
            (int)inputId
        );
        push();

        static uint256_t gNullHash;
        LOAD(uint256_t, upTXHash, p);
        LOAD(uint32_t, upOutputIndex, p);
        LOAD_VARINT(inputScriptSize, p);

        printf("%sscript = '\n", spaces);
            pop();
                showScript(p, inputScriptSize, 0, (const char *)spaces);
            push();
        printf("%s'\n", spaces);

        p += inputScriptSize;
        LOAD(uint32_t, sequence, p);
        printf("%snsequence = %" PRIu32 "\n",spaces, sequence);

        isCoinBase = (0==memcmp(gNullHash.v, upTXHash.v, sizeof(gNullHash)));
        if(isCoinBase) {
            uint64_t value = getBaseReward(currBlock);
            printf("%sisCoinBase = true\n", spaces);
            printf(
                "%svalue = %" PRIu64 " # %.08f\n",
                spaces,
                value,
                satoshisToNormaForm(value)
            );
            printf("%scoinBase = '\n", spaces);
            push();
                canonicalHexDump(
                    p,
                    inputScriptSize,
                    (const char *)spaces
                );
            pop();
            printf("%s'\n", spaces);
        }
    }
Beispiel #5
0
    // Called when the end of a TX's output array is encountered
    virtual void endOutputs(
        const uint8_t *p
    ) {
        #if defined(CLAM)
            if(1<txVersion) {
                LOAD_VARINT(strCLAMSpeechLen, p);
                printf("%stxComment = '\n", spaces);
                    push();
                        canonicalHexDump(
                            p,
                            strCLAMSpeechLen,
                            (const char *)spaces
                        );
                    pop();
                printf("%s'\n", spaces);
            }
        #endif

        pop();
        printf("%s}\n", spaces);
    }